forked from cmccabe/cmccabe-hbin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runt
executable file
·40 lines (32 loc) · 892 Bytes
/
runt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
die() {
echo $@
exit 1
}
usage() {
cat <<EOF
runt: run native test(s) with appropriate CLASSPATH
usage: runt [options] [short-test-name]
-h: this help message
EOF
}
while getopts "h" flag; do
case $flag in
h) usage; exit 0;;
*) echo; usage; exit 1;;
esac
done
shift $(($OPTIND - 1))
[ $# -eq 1 ] || die "must give exactly one test to run. -h for usage."
TEST_NAME=$1
D=$(readlink -f "`dirname $0`")
[ -d $D ] || die "failed to locate enclosing directory of this script"
[ -d $HADOOP_HOME_BASE ] || die "you must set HADOOP_HOME_BASE to \
the directory where the Hadoop tar is installed."
source $D/jarjar.sh \
$HADOOP_HOME_BASE/share/hadoop/common \
$HADOOP_HOME_BASE/share/hadoop/hdfs
TEST_PATH="$(find . -name $TEST_NAME -type f)"
[ "x$TEST_PATH" = "x" ] && die "failed to locate $TEST_NAME"
$TEST_PATH || die "TEST FAILED"
exit 0