hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r922408 - in /hadoop/hbase/trunk: CHANGES.txt bin/hbase core/src/test/ruby/tests_runner.rb
Date Fri, 12 Mar 2010 19:59:35 GMT
Author: stack
Date: Fri Mar 12 19:59:35 2010
New Revision: 922408

URL: http://svn.apache.org/viewvc?rev=922408&view=rev
Log:
HBASE-2316 Need an ability to run shell tests w/o invoking junit

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/bin/hbase
    hadoop/hbase/trunk/core/src/test/ruby/tests_runner.rb

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=922408&r1=922407&r2=922408&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri Mar 12 19:59:35 2010
@@ -454,6 +454,8 @@ Release 0.21.0 - Unreleased
    HBASE-2263  [stargate] multiuser mode: authenticator for zookeeper
    HBASE-2273  [stargate] export metrics via Hadoop metrics, JMX, and zookeeper
    HBASE-2274  [stargate] filter support: JSON descriptors
+   HBASE-2316  Need an ability to run shell tests w/o invoking junit
+               (Alexey Kovyrin via Stack)
 
   OPTIMIZATIONS
    HBASE-410   [testing] Speed up the test suite

Modified: hadoop/hbase/trunk/bin/hbase
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hbase?rev=922408&r1=922407&r2=922408&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hbase (original)
+++ hadoop/hbase/trunk/bin/hbase Fri Mar 12 19:59:35 2010
@@ -51,11 +51,20 @@ case "`uname`" in
 CYGWIN*) cygwin=true;;
 esac
 
+# Detect if we are in hbase sources dir
+in_sources_dir=false
+if [ -f $HBASE_HOME/pom.xml ]; then
+  in_sources_dir=true
+fi
+
 # if no args specified, show usage
 if [ $# = 0 ]; then
   echo "Usage: hbase <command>"
   echo "where <command> is one of:"
   echo "  shell            run the HBase shell"
+  if $in_sources_dir; then
+    echo "  shell-tests      run the HBase shell tests"
+  fi
   echo "  master           run an HBase HMaster node" 
   echo "  regionserver     run an HBase HRegionServer node" 
   echo "  thrift           run an HBase Thrift server" 
@@ -100,7 +109,7 @@ if [ -d "$HBASE_HOME/build/webapps" ]; t
 fi
 
 # Add maven target directory
-if [ -f $HBASE_HOME/pom.xml ]; then
+if $in_sources_dir; then
   HBASE_VER=`grep '<version>' $HBASE_HOME/pom.xml | head -1 | sed 's/.*<version>\(.*\)<\/version>/\1/'`
   MAVEN_TARGET_DIR=$HBASE_HOME/target/hbase-$HBASE_VER-bin/hbase-$HBASE_VER
   if [ -d "$MAVEN_TARGET_DIR" ]; then
@@ -184,6 +193,20 @@ unset IFS
 # figure out which class to run
 if [ "$COMMAND" = "shell" ] ; then
   CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb"
+elif $in_sources_dir && [ "$COMMAND" = "shell-tests" ] ; then
+  # Finx maven build classpath
+  mvn -f core/pom.xml dependency:build-classpath -Dmdep.outputFile=/tmp/hbase-core-tests-classpath.txt
&> /dev/null
+  # Add tests classes
+  CLASSPATH=${CLASSPATH}:`cat /tmp/hbase-core-tests-classpath.txt`
+  for f in `find ${HBASE_HOME}/core/target -name '*.jar'`; do
+    if [ -f $f ]; then
+      CLASSPATH=${CLASSPATH}:$f;
+    fi
+  done
+  CLASSPATH=${HBASE_HOME}/core/target/test-classes:${CLASSPATH} # For configs
+  # Start the tests
+  CORESRC="${HBASE_HOME}/core/src"
+  CLASS="org.jruby.Main -I${CORESRC}/main/ruby -I${CORESRC}/test/ruby ${CORESRC}/test/ruby/tests_runner.rb"
 elif [ "$COMMAND" = "master" ] ; then
   CLASS='org.apache.hadoop.hbase.master.HMaster'
   if [ "$1" != "stop" ] ; then

Modified: hadoop/hbase/trunk/core/src/test/ruby/tests_runner.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/test/ruby/tests_runner.rb?rev=922408&r1=922407&r2=922408&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/test/ruby/tests_runner.rb (original)
+++ hadoop/hbase/trunk/core/src/test/ruby/tests_runner.rb Fri Mar 12 19:59:35 2010
@@ -1,6 +1,26 @@
 require 'rubygems'
 require 'rake'
 
+unless defined?($TEST_CLUSTER)
+  include Java
+
+  # Set logging level to avoid verboseness
+  org.apache.log4j.Logger.getRootLogger.setLevel(org.apache.log4j.Level::OFF)
+  org.apache.log4j.Logger.getLogger("org.apache.zookeeper").setLevel(org.apache.log4j.Level::OFF)
+  org.apache.log4j.Logger.getLogger("org.apache.hadoop.hdfs").setLevel(org.apache.log4j.Level::OFF)
+  org.apache.log4j.Logger.getLogger("org.apache.hadoop.hbase").setLevel(org.apache.log4j.Level::OFF)
+  org.apache.log4j.Logger.getLogger("org.apache.hadoop.ipc.HBaseServer").setLevel(org.apache.log4j.Level::OFF)
+
+  java_import org.apache.hadoop.hbase.HBaseTestingUtility
+
+  $TEST_CLUSTER = HBaseTestingUtility.new
+  $TEST_CLUSTER.configuration.setInt("hbase.regionserver.msginterval", 100)
+  $TEST_CLUSTER.configuration.setInt("hbase.client.pause", 250)
+  $TEST_CLUSTER.configuration.setInt("hbase.client.retries.number", 6)
+  $TEST_CLUSTER.startMiniCluster
+  @own_cluster = true
+end
+
 require 'test_helper'
 
 puts "Running tests..."
@@ -15,4 +35,10 @@ files.each do |file|
   end
 end
 
-puts "Done with tests!"
+Test::Unit::AutoRunner.run
+
+puts "Done with tests! Shutting down the cluster..."
+if @own_cluster
+  $TEST_CLUSTER.shutdownMiniCluster
+  java.lang.System.exit(0)
+end



Mime
View raw message