-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·58 lines (44 loc) · 1.02 KB
/
build.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
54
55
56
57
58
#!/bin/bash
set -e
usage_exit()
{
echo "$0 <target directory>"
exit 1
}
if [ -z $1 ]; then
usage_exit;
fi
SOURCE_DIR=$1
TARGET_DIR="build/$1"
BASE_PATH=$(pwd)
if [[ $2 != *"keep"* ]]; then
echo "Build clean"
rm -rf $TARGET_DIR
fi
mkdir -p $TARGET_DIR
cp -a "../src/" "$TARGET_DIR/tests/"
cp -a "$SOURCE_DIR/src" $TARGET_DIR
cp -a "$SOURCE_DIR/tests" $TARGET_DIR
cd $TARGET_DIR
PATCH_FILE="../../$SOURCE_DIR.patch"
if [ -e $PATCH_FILE ]; then
patch -p0 < $PATCH_FILE
fi
if [[ $2 == *"assume_fail"* ]]; then
echo "Fail run, assume build ok, running fails"
make -f tests/tools/Makefile test_build
for tb in tests/build/bin/*; do
set +e
./$tb > /dev/null # Hide the output as its hidious since it fails
ret=$?
set -e
if [[ $ret == 0 ]];then
echo "The test '$tb' did not fail, though it should!"
return 1
fi;
done;
else
echo "Normal run - assume all ok"
make -f tests/tools/Makefile test_build test_run test_coverage
fi
echo "ALL DONE, BYE BYE"