-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove-missing-tests.sh
44 lines (32 loc) · 1.08 KB
/
remove-missing-tests.sh
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
#!/usr/bin/env bash
# $1 - test order file (located in either DT_SUBJ or NEW_DT_SUBJ)
# $2 - Optional. 'new' or 'old'. Whether to run using new subject or old subject. Defaults to 'new'.
PREFIX="new"
if [[ ! -z "$2" ]]; then
PREFIX="$2"
fi
if [[ "$PREFIX" = "old" ]]; then
cd $DT_SUBJ_SRC
CLASSPATH=$DT_LIBS:$DT_TESTS:$DT_CLASS:$DT_TOOLS:
else
cd $NEW_DT_SUBJ_SRC
CLASSPATH=$NEW_DT_LIBS:$NEW_DT_TESTS:$NEW_DT_CLASS:$DT_TOOLS:
fi
MODIFIED_ORDER="$1-modified"
REMOVED_LIST="$1-removed"
# Create these files.
cp $1 $MODIFIED_ORDER
> $REMOVED_LIST
while true
do
echo "[INFO] Running $(cat $MODIFIED_ORDER | wc -l) tests."
MISSING_TEST=$(java -cp $DT_TOOLS: edu.washington.cs.dt.impact.Main.RunnerMain -classpath $CLASSPATH -inputTests $MODIFIED_ORDER |& grep "Test method not found: " | head -1 | sed -E "s/.*Test method not found: (.*)/\1/g")
if [[ -z "$MISSING_TEST" ]]; then
break
fi
echo "[INFO] Removing $MISSING_TEST"
echo $MISSING_TEST >> $REMOVED_LIST
grep -vFf $REMOVED_LIST $1 > $MODIFIED_ORDER
done
mv $1 $1-old
cp $MODIFIED_ORDER $1