HBASE-2316 Need an ability to run shell tests w/o invoking junit

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@922408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-03-12 19:59:35 +00:00
parent 9adc7f52b2
commit dd8456b1be
3 changed files with 53 additions and 2 deletions

View File

@ -454,6 +454,8 @@ Release 0.21.0 - Unreleased
HBASE-2263 [stargate] multiuser mode: authenticator for zookeeper HBASE-2263 [stargate] multiuser mode: authenticator for zookeeper
HBASE-2273 [stargate] export metrics via Hadoop metrics, JMX, and zookeeper HBASE-2273 [stargate] export metrics via Hadoop metrics, JMX, and zookeeper
HBASE-2274 [stargate] filter support: JSON descriptors 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 OPTIMIZATIONS
HBASE-410 [testing] Speed up the test suite HBASE-410 [testing] Speed up the test suite

View File

@ -51,11 +51,20 @@ case "`uname`" in
CYGWIN*) cygwin=true;; CYGWIN*) cygwin=true;;
esac 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 no args specified, show usage
if [ $# = 0 ]; then if [ $# = 0 ]; then
echo "Usage: hbase <command>" echo "Usage: hbase <command>"
echo "where <command> is one of:" echo "where <command> is one of:"
echo " shell run the HBase shell" 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 " master run an HBase HMaster node"
echo " regionserver run an HBase HRegionServer node" echo " regionserver run an HBase HRegionServer node"
echo " thrift run an HBase Thrift server" echo " thrift run an HBase Thrift server"
@ -100,7 +109,7 @@ if [ -d "$HBASE_HOME/build/webapps" ]; then
fi fi
# Add maven target directory # 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/'` 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 MAVEN_TARGET_DIR=$HBASE_HOME/target/hbase-$HBASE_VER-bin/hbase-$HBASE_VER
if [ -d "$MAVEN_TARGET_DIR" ]; then if [ -d "$MAVEN_TARGET_DIR" ]; then
@ -184,6 +193,20 @@ unset IFS
# figure out which class to run # figure out which class to run
if [ "$COMMAND" = "shell" ] ; then if [ "$COMMAND" = "shell" ] ; then
CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb" 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 elif [ "$COMMAND" = "master" ] ; then
CLASS='org.apache.hadoop.hbase.master.HMaster' CLASS='org.apache.hadoop.hbase.master.HMaster'
if [ "$1" != "stop" ] ; then if [ "$1" != "stop" ] ; then

View File

@ -1,6 +1,26 @@
require 'rubygems' require 'rubygems'
require 'rake' 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' require 'test_helper'
puts "Running tests..." puts "Running tests..."
@ -15,4 +35,10 @@ files.each do |file|
end end
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