-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-with-tau.sh
executable file
·55 lines (45 loc) · 1.55 KB
/
test-with-tau.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
#!/bin/bash
# This helper script clones tau-lang and compiles it with current parser code.
# Then it runs tau-lang tests to check if parser changes do not break tau-lang.
#
# This script accepts an optional argument: BUILD_TYPE.
# It can be one of "debug" or "release".
# "release" is default if no argument is provided
TAUDIR="./tau-lang"
# check the first argument if it contains "release" or "debug".
# if no argument is provided "release" is used
BUILD_TYPE="${1:-release}"
BUILD_TYPE=$(echo "$BUILD_TYPE" | tr '[:upper:]' '[:lower:]')
BUILD_TYPES=("release" "debug")
if [[ ! " ${BUILD_TYPES[@]} " =~ " ${BUILD_TYPE} " ]]; then
echo "Invalid build type: ${BUILD_TYPE}"
echo "Valid build types are: ${BUILD_TYPES[*]}"
exit 1
fi
# clone tau
if [ ! -d "$TAUDIR" ]; then
echo "Cloning tau-lang"
git clone https://github.com/IDNI/tau-lang $TAUDIR
else
echo "tau-lang already cloned"
fi
# enter tau directory
cd $TAUDIR
# initialize submodule to prevent init when building
git submodule status | while read -r LINE; do
GIT_SUBMOD=$(echo $LINE | awk '{print $2}')
if [[ $LINE == -* ]]; then
echo "Initializing submodule $GIT_SUBMOD"
git submodule update --init --recursive $GIT_SUBMOD
else
echo "Submodule ${GIT_SUBMOD} is already initialized"
fi
done
# remove content of the submodule to be replaced by current code
rm -rf external/parser/*
# copy current parser source to place where tau expects it
cp -r ../cmake ../src ../tools ../CMakeLists.txt external/parser
# build tau with tests
./$BUILD_TYPE.sh -DTAU_BUILD_TESTS=ON
# run tests
./test-$BUILD_TYPE.sh