-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathtest.sh
executable file
·54 lines (42 loc) · 901 Bytes
/
test.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
50
51
52
53
#!/bin/bash
START_DIR=$(pwd)
SOURCE_DIR=$1
BUILD_DIR=$2
TESTS_DIR="test_cases"
if [[ "$SOURCE_DIR" == "" ]]; then
SOURCE_DIR=$(pwd)
fi
echo "Source Dir: ""$SOURCE_DIR"
cd "$SOURCE_DIR"
if [ -d $TESTS_DIR ]; then
echo "Test directory already exits"
else
git clone https://github.com/hasherezade/bearparser_tests.git
mv bearparser_tests $TESTS_DIR
fi
if [[ "$BUILD_DIR" == "" ]]; then
BUILD_DIR=build
fi
echo "Build Dir: ""$BUILD_DIR"
BCMD_DIR=$(pwd)/$BUILD_DIR/
FAILED=0
tests_list=$SOURCE_DIR/"tests_list.txt"
cd $TESTS_DIR
chmod +x test1.sh
while IFS=' ' read -r p1 p2
do
if [[ "$p2" == "" || "$p1" == "" ]]; then
continue;
fi
if [[ "$p1" == "#" ]]; then # allow for commenting out lines
continue;
fi
./test1.sh "$BCMD_DIR" "$p2" "$p1"
if [[ "$?" != 0 ]]; then
FAILED=$FAILED+1
fi
done < "$tests_list"
if [[ "$FAILED" == 0 ]]; then
echo "All passed"
fi
cd "$START_DIR"