-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·60 lines (50 loc) · 1.08 KB
/
test.sh
File metadata and controls
executable file
·60 lines (50 loc) · 1.08 KB
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
59
60
#!/bin/bash
NINJA_FILE="build.linux.ninja"
case "$(uname)" in
"Darwin")
NINJA_FILE="build.osx.ninja"
;;
"Linux")
NINJA_FILE="build.linux.ninja"
;;
*)
echo "Unsupported Operating System: $(uname)"
exit 1
;;
esac
target="$1"
if [[ -z "$1" ]]; then
target="main"
fi
if [[ "${BASHOPTS}" != *extdebug* ]]; then
set -e
fi
err_report() {
cd ${cwd}
echo "ERROR: $0:$*"
exit 8
}
if [[ "${BASHOPTS}" != *extdebug* ]]; then
trap 'err_report $LINENO' ERR
fi
cwd=$(cd "$(dirname $(dirname "${BASH_SOURCE[0]}"))" &> /dev/null && pwd)
cd ${cwd}
./cleanup.sh
# cleanup
ninja -f $NINJA_FILE -t clean > /dev/null 2>&1
# main target
ninja -f $NINJA_FILE ${target}
ninja -f $NINJA_FILE -t clean > /dev/null 2>&1
case "$(uname)" in
"Darwin")
codesign -s - --entitlements debug.entitlements -f ./test-${target}
leaks --atExit -- ./test-${target}
;;
"Linux")
valgrind ./test-${target}
;;
*)
echo "Unsupported Operating System: $(uname)"
exit 1
;;
esac