-
Notifications
You must be signed in to change notification settings - Fork 6
/
run-recent-tests
executable file
·57 lines (48 loc) · 1.38 KB
/
run-recent-tests
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
NUM_COMMITS=4
TEST_DIR=src/test
while [ $# -gt 0 ]; do
case $1 in
-n)
shift
NUM_COMMITS=$1
;;
*)
echo bad param: $1
exit 1
;;
esac
shift
done
if grep -q test.hdfs.commit.tests.file build.xml ; then
TEST_TARGET=run-commit-test
TESTFILE_PROPERTY=test.hdfs.commit.tests.file
elif grep -q test.mapred.commit.tests.file build.xml ; then
TEST_TARGET=run-commit-test
TESTFILE_PROPERTY=test.mapred.commit.tests.file
elif grep -q test.all.tests.file build.xml ; then
TESTFILE_PROPERTY=test.all.tests.file
if grep -q '"run-test-core"' build.xml ; then
TEST_TARGET=run-test-core
else
TEST_TARGET=test-core
fi
else
echo No idea what target/property to use
exit 1
fi
if git rev-parse --show-cdup 2> /dev/null ; then
(git whatchanged -n$NUM_COMMITS src/test/ ; git diff --numstat src/test ) | \
egrep -o '/Test.*.java' | sed 's,^,**/,g' > /tmp/recent-tests
else
REV_FOR_DIFF=$(svn log -l $NUM_COMMITS src/test | egrep -o '^r[0-9]+' | tail -1)
(svn diff -r $REV_FOR_DIFF:HEAD --summarize ; svn stat ) | \
egrep -o '/Test.*.java' | sed 's,^,**/,g' > /tmp/recent-tests
fi
sort /tmp/recent-tests | uniq > /tmp/recent-tests-sorted
mv /tmp/recent-tests-sorted /tmp/recent-tests
echo Going to run the following tests:
cat /tmp/recent-tests
echo ----------
sleep 1
ant -D${TESTFILE_PROPERTY}=/tmp/recent-tests $TEST_TARGET