From: rootfs Date: Tue, 15 Jul 2014 11:39:32 +0000 (-0400) Subject: update hadoop-wordcount test to be able to run on hadoop 2.x. The hadoop and mapreduc... X-Git-Tag: v0.84~79^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d915ceb0a90c898e6b8f9d39d2a195afbf4c507f;p=ceph.git update hadoop-wordcount test to be able to run on hadoop 2.x. The hadoop and mapreduce library are no longer hard coded so they can be specified to point to the right path. The relative paths hdfs are changed to absolute paths. A sample command to run the test on hadoop 2.x is TESTDIR=/home/test HADOOP_HOME=/usr/lib/hadoop HADOOP_MR_HOME=/usr/lib/hadoop-mapreduce sh workunits/hadoop-wordcount/test.sh starting hadoop-wordcount test Signed-off-by: rootfs --- diff --git a/qa/workunits/hadoop-wordcount/test.sh b/qa/workunits/hadoop-wordcount/test.sh index 5d3f4ccc54f8..4cb4511133de 100755 --- a/qa/workunits/hadoop-wordcount/test.sh +++ b/qa/workunits/hadoop-wordcount/test.sh @@ -3,18 +3,24 @@ echo "starting hadoop-wordcount test" # bail if $TESTDIR is not set as this test will fail in that scenario -[ -z $TESTDIR] && { echo "\$TESTDIR needs to be set, but is not. Exiting."; exit 1; } +[ -z $TESTDIR ] && { echo "\$TESTDIR needs to be set, but is not. Exiting."; exit 1; } + +# if HADOOP_HOME is not set, use default +[ -z $HADOOP_HOME ] && { HADOOP_HOME=$TESTDIR/apache_hadoop; } + +# if HADOOP_MR_HOME is not set, use default +[ -z $HADOOP_MR_HOME ] && { HADOOP_MR_HOME=$TESTDIR/apache_hadoop/build; } command0="export JAVA_HOME=/usr/lib/jvm/default-java" command1="mkdir -p $TESTDIR/hadoop_input" command2="wget http://ceph.com/qa/hadoop_input_files.tar -O $TESTDIR/hadoop_input/files.tar" command3="cd $TESTDIR/hadoop_input" command4="tar -xf $TESTDIR/hadoop_input/files.tar" -command5="$TESTDIR/apache_hadoop/bin/hadoop fs -mkdir wordcount_input" -command6="$TESTDIR/apache_hadoop/bin/hadoop fs -put $TESTDIR/hadoop_input/*txt wordcount_input/" -command7="$TESTDIR/apache_hadoop/bin/hadoop jar $TESTDIR/apache_hadoop/build/hadoop-example*jar wordcount wordcount_input wordcount_output" -command8="rm -rf $TESTDIR/hadoop_input" - +command5="$HADOOP_HOME/bin/hadoop fs -mkdir /wordcount_input" +command6="$HADOOP_HOME/bin/hadoop fs -rm -r -f /wordcount_output" +command7="$HADOOP_HOME/bin/hadoop fs -put $TESTDIR/hadoop_input/*txt /wordcount_input/" +command8="$HADOOP_HOME/bin/hadoop jar $HADOOP_MR_HOME/hadoop-*examples.jar wordcount /wordcount_input /wordcount_output" +command9="rm -rf $TESTDIR/hadoop_input" #print out the command echo "----------------------" @@ -27,6 +33,7 @@ echo $command5 echo $command6 echo $command7 echo $command8 +echo $command9 echo "----------------------" #now execute the command @@ -39,6 +46,7 @@ $command5 $command6 $command7 $command8 +#$command9 echo "completed hadoop-wordcount test" exit 0