-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·55 lines (45 loc) · 1014 Bytes
/
Copy pathtest
File metadata and controls
executable file
·55 lines (45 loc) · 1014 Bytes
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
#! /usr/bin/env bash
INPUT_DIR="examples"
# INPUT_DIR="input"
ROOT_DIR="$(dirname "${BASH_SOURCE[0]}")"
function run_file() {
blitzc-debug "$1" >/dev/null 2>&1
OUT=$(echo $?)
if [ $OUT == 0 ]; then
echo "SUCCESS: $1"
else
echo "FAIL: $1"
fi
}
function test_files() {
for file in "$ROOT_DIR/$INPUT_DIR"/*; do
run_file "$file" &
done
}
if [ "$1" == "" ]; then
test_files
elif [ "$1" == "-c" ]; then
zig build
test_files
elif [ "$1" == "-p" ]; then
shopt -s nullglob
pattern="$ROOT_DIR/$INPUT_DIR/*$2*"
matches=($pattern)
if ((${#matches[@]})); then
first_match="${matches[0]}"
zig build run-compiler -- "$first_match"
else
echo "No file $pattern found"
exit 0
fi
elif [ "$1" == "build" ]; then
zig build
test_files
else
if [[ "$1" != *\.blitz ]]; then
echo "expected filename with [.blitz] extension"
exit 0
fi
zig build run-compiler -- "$1"
fi
wait