blob: 4cf5e42de47d69a8abacd84215ff05a569757ad4 (
plain)
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
|
#!/bin/env bash
cc="gcc"
ld="gcc"
rm -rf ./lib/
rm -rf ./bin/
mkdir ./lib/
mkdir ./bin/
echo "[BUILD] entry.c"
cflags="-std=c99 -Wall -Wextra -g -Wno-error -pedantic"
$cc $cflags \
-c -o lib/ungrateful.o \
-g src/ungrateful.c
if [[ $? -ne 0 ]]; then
exit
fi
if [[ $1 == "no_tests" ]]; then
exit
fi
echo
for test in tests/*.c; do
fname=$(basename -- "$test")
fname="${fname%.*}"
echo "[BUILD] $test"
$cc $cflags -o bin/$fname $test lib/ungrateful.o -Isrc/
done
for case in bin/*; do
if [[ $1 == "quiet" ]]; then
$case > /dev/null 2>&1
else
$case
fi
if [[ $? -eq 0 ]]; then
echo "[DONE] $case"
else
echo "[FAIL] $case"
fi
done
|