aboutsummaryrefslogtreecommitdiff
path: root/test/json_test/json_test.sh
blob: e08bab542e22e0a0523b090166601416634b0b75 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash

set -e
cd `dirname $0`/../..
ROOT=`pwd`
TMP=${ROOT}/build/tmp/test/json_test

CC=${CC:-cc}
${ROOT}/scripts/build.sh
mkdir -p ${TMP}
rm -rf ${TMP}/*

# could also use --json to generate both at once
bin/flatcc -av --json -o ${TMP} test/monster_test/monster_test.fbs

cp test/json_test/*.c ${TMP}
cp test/flatc_compat/monsterdata_test.golden ${TMP}
cp test/flatc_compat/monsterdata_test.mon ${TMP}

cd ${TMP}

$CC -g -I ${ROOT}/include test_basic_parse.c \
    ${ROOT}/lib/libflatccrt_d.a -o test_basic_parse_d

$CC -g -I ${ROOT}/include test_json_parser.c \
    ${ROOT}/lib/libflatccrt_d.a -o test_json_parser_d

$CC -g -I ${ROOT}/include test_json_printer.c \
    ${ROOT}/lib/libflatccrt_d.a -o test_json_printer_d

$CC -g -I ${ROOT}/include test_json.c\
    ${ROOT}/lib/libflatccrt_d.a -o test_json_d


echo "running json basic parse test debug"
./test_basic_parse_d

echo "running json parser test debug"
./test_json_parser_d

echo "running json printer test debug"
./test_json_printer_d

echo "running json test debug"
./test_json_d

$CC -O2 -DNDEBUG -I ${ROOT}/include test_basic_parse.c \
    ${ROOT}/lib/libflatccrt.a -o test_basic_parse

#$CC -O3 -DNDEBUG -I ${ROOT}/include test_json_parser.c \
#$CC -Os -save-temps -DNDEBUG -I ${ROOT}/include test_json_parser.c \

$CC -O2 -DNDEBUG -I ${ROOT}/include test_json_parser.c \
    ${ROOT}/lib/libflatccrt.a -o test_json_parser

$CC -O2 -DNDEBUG -I ${ROOT}/include test_json_printer.c\
    ${ROOT}/lib/libflatccrt.a -o test_json_printer

$CC -O2 -DNDEBUG -I ${ROOT}/include test_json.c\
    ${ROOT}/lib/libflatccrt.a -o test_json

echo "running json basic parse test optimized"
./test_basic_parse

echo "running json parser test optimized"
./test_json_parser

echo "running json printer test optimimized"
./test_json_printer

echo "running json test optimized"
./test_json

echo "json tests passed"