hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/3] git commit: HBASE-11731 Add option to only run a subset of the shell tests (Sean Busbey)
Date Thu, 14 Aug 2014 18:52:14 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 3d292e8d7 -> eb175c2f1
  refs/heads/branch-1 a79e5ce52 -> fc5f0a672
  refs/heads/master 819b06d62 -> 865fae8a8


HBASE-11731 Add option to only run a subset of the shell tests (Sean Busbey)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/865fae8a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/865fae8a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/865fae8a

Branch: refs/heads/master
Commit: 865fae8a8056c1d3ffac32abe292017d3cc21155
Parents: 819b06d
Author: Andrew Purtell <apurtell@apache.org>
Authored: Thu Aug 14 11:49:59 2014 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Thu Aug 14 11:49:59 2014 -0700

----------------------------------------------------------------------
 hbase-shell/src/test/ruby/tests_runner.rb | 10 ++++++-
 src/main/docbkx/developer.xml             | 38 ++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/865fae8a/hbase-shell/src/test/ruby/tests_runner.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/test/ruby/tests_runner.rb b/hbase-shell/src/test/ruby/tests_runner.rb
index 7e40962..e1458db 100644
--- a/hbase-shell/src/test/ruby/tests_runner.rb
+++ b/hbase-shell/src/test/ruby/tests_runner.rb
@@ -54,7 +54,15 @@ files.each do |file|
   end
 end
 
-if !Test::Unit::AutoRunner.run
+# If this system property is set, we'll use it to filter the test cases.
+runner_args = []
+if java.lang.System.get_property('shell.test')
+  shell_test_pattern = java.lang.System.get_property('shell.test')
+  puts "Only running tests that match #{shell_test_pattern}"
+  runner_args << "--testcase=#{shell_test_pattern}"
+end
+# first couple of args are to match the defaults, so we can pass options to limit the tests
run
+if !(Test::Unit::AutoRunner.run(false, nil, runner_args))
   raise "Shell unit tests failed. Check output file for details."
 end
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/865fae8a/src/main/docbkx/developer.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/developer.xml b/src/main/docbkx/developer.xml
index 91fb5f3..bf34a34 100644
--- a/src/main/docbkx/developer.xml
+++ b/src/main/docbkx/developer.xml
@@ -513,6 +513,44 @@ HBase have a character not usually seen in other projects.</para>
                 the tests must be strict unit tests and just test the class under test -
no use of
                 the HBaseTestingUtility or minicluster is allowed (or even possible given
the
                 dependency tree).</para>
+  <section xml:id="hbase.moduletest.shell">
+    <title>Testing the HBase Shell</title>
+    <para>
+      The HBase shell and its tests are predominantly written in jruby. In order to make
these
+      tests run as a part of the standard build, there is a single JUnit test,
+      <classname>TestShell</classname>, that takes care of loading the jruby
implemented tests and
+      running them. You can run all of these tests from the top level with:
+    </para>
+    <programlisting language="bourne">
+      mvn clean test -Dtest=TestShell
+    </programlisting>
+    <para>
+      Alternatively, you may limit the shell tests that run using the system variable
+      <classname>shell.test</classname>. This value may specify a particular
test case by name. For
+      example, the tests that cover the shell commands for altering tables are contained
in the test
+      case <classname>AdminAlterTableTest</classname> and you can run them with:
+    </para>
+    <programlisting language="bourne">
+      mvn clean test -Dtest=TestShell -Dshell.test=AdminAlterTableTest
+    </programlisting>
+    <para>
+      You may also use a <link xlink:href=
+      "http://docs.ruby-doc.com/docs/ProgrammingRuby/html/language.html#UJ">Ruby Regular
Expression
+      literal</link> (in the <classname>/pattern/</classname> style) to
select a set of test cases.
+      You can run all of the HBase admin related tests, including both the normal administration
and
+      the security administration, with the command:
+    </para>
+    <programlisting language="bourne">
+      mvn clean test -Dtest=TestShell -Dshell.test=/.*Admin.*Test/
+    </programlisting>
+    <para>
+      In the event of a test failure, you can see details by examining the XML version of
the
+      surefire report results
+    </para>
+    <programlisting language="bourne">
+      vim hbase-shell/target/surefire-reports/TEST-org.apache.hadoop.hbase.client.TestShell.xml
+    </programlisting>
+  </section>
   <section xml:id="hbase.moduletest.run">
   <title>Running Tests in other Modules</title>
   <para>If the module you are developing in has no other dependencies on other HBase
modules, then


Mime
View raw message