-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest-regression.sh
executable file
·49 lines (43 loc) · 1.3 KB
/
test-regression.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
44
45
46
47
48
49
#!/usr/bin/env bash
set -eo pipefail
scriptDir=$(cd $(dirname $0); pwd) # works on mac osx too
rootDir=$scriptDir/..
# Allow user to specify which ducttape directory to test so that we can test the packaged distribution on Travis
if (( $# > 1 )); then
DUCTTAPE_DIR=$1
else
DUCTTAPE_DIR=$rootDir
fi
# Make sure we're testing the version of ducttape in our current environment
function test_all {
echo >&2 $PATH
DUCTTAPE=$DUCTTAPE_DIR/ducttape
export PATH=$DUCTTAPE_DIR:$PATH
export PATH=$rootDir:$PATH
tutorialDir=$(cd $rootDir/tutorial; pwd)
for tape in $tutorialDir/*.tape; do
dir=$(dirname $tape)
basefile=$(basename $tape .tape)
customSh=$dir/$basefile.sh
if [ -e $customSh ]; then
# Run via the custom script, which may give additional arguments such as a .conf file
CMD=$customSh
else
# Just directly execute the .tape file with ducttape
CMD="$DUCTTAPE $tape"
fi
output=$(mktemp -d $tape.regression.TMP.XXXXXX)
echo "==================="
echo "Running test: $CMD"
echo "Output: $output"
echo "==================="
cd $dir
$CMD -y -O $output
# Remove output, if test was successful
rm -rf $output
done
}
time test_all
GREEN="\033[0;32m"
RESET="\033[0m"
echo -e "${GREEN}ALL REGRESSION TESTS PASSED${RESET}"