|
3 | 3 | set -euxo pipefail
|
4 | 4 |
|
5 | 5 | mkdir -p out/
|
| 6 | +OUT_DIR="$(pwd)/out" |
| 7 | + |
| 8 | +# move to `pdl-compiler` directory |
| 9 | +cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &> /dev/null |
6 | 10 |
|
7 | 11 | sed -e 's/little_endian_packets/big_endian_packets/' \
|
8 | 12 | -e '/Start: little_endian_only/,/End: little_endian_only/d' \
|
9 |
| - < tests/canonical/le_test_file.pdl > out/be_test_file.pdl |
| 13 | + < tests/canonical/le_test_file.pdl > "$OUT_DIR"/be_test_file.pdl |
10 | 14 |
|
11 |
| -pdlc tests/canonical/le_test_file.pdl > out/le_test_file.json |
12 |
| -pdlc out/be_test_file.pdl > out/be_test_file.json |
| 15 | +pdlc tests/canonical/le_test_file.pdl > "$OUT_DIR"/le_test_file.json |
| 16 | +pdlc "$OUT_DIR"/be_test_file.pdl > "$OUT_DIR"/be_test_file.json |
13 | 17 |
|
14 | 18 | python3 scripts/generate_cxx_backend.py \
|
15 |
| - --input out/le_test_file.json \ |
16 |
| - --output out/le_backend.h \ |
| 19 | + --input "$OUT_DIR"/le_test_file.json \ |
| 20 | + --output "$OUT_DIR"/le_backend.h \ |
17 | 21 | --namespace le_backend
|
18 | 22 | python3 scripts/generate_cxx_backend.py \
|
19 |
| - --input out/be_test_file.json \ |
20 |
| - --output out/be_backend.h \ |
| 23 | + --input "$OUT_DIR"/be_test_file.json \ |
| 24 | + --output "$OUT_DIR"/be_backend.h \ |
21 | 25 | --namespace be_backend
|
22 | 26 |
|
23 | 27 | python3 scripts/generate_cxx_backend_tests.py \
|
24 |
| - --input out/le_test_file.json \ |
25 |
| - --output out/le_backend_tests.cc \ |
| 28 | + --input "$OUT_DIR"/le_test_file.json \ |
| 29 | + --output "$OUT_DIR"/le_backend_tests.cc \ |
26 | 30 | --test-vectors tests/canonical/le_test_vectors.json \
|
27 | 31 | --namespace le_backend \
|
28 | 32 | --parser-test-suite le_backend_parser_test \
|
29 | 33 | --serializer-test-suite le_backend_serializer_test \
|
30 | 34 | --include-header le_backend.h
|
31 | 35 | python3 scripts/generate_cxx_backend_tests.py \
|
32 |
| - --input out/be_test_file.json \ |
33 |
| - --output out/be_backend_tests.cc \ |
| 36 | + --input "$OUT_DIR"/be_test_file.json \ |
| 37 | + --output "$OUT_DIR"/be_backend_tests.cc \ |
34 | 38 | --test-vectors tests/canonical/be_test_vectors.json \
|
35 | 39 | --namespace be_backend \
|
36 | 40 | --parser-test-suite be_backend_parser_test \
|
37 | 41 | --serializer-test-suite be_backend_serializer_test \
|
38 | 42 | --include-header be_backend.h
|
39 | 43 |
|
40 |
| -g++ -Iscripts -Iout \ |
41 |
| - out/le_backend_tests.cc \ |
42 |
| - out/be_backend_tests.cc \ |
43 |
| - -lgtest -lgtest_main -o out/cxx_backend_tests |
| 44 | +g++ -Iscripts -I"$OUT_DIR" \ |
| 45 | + "$OUT_DIR"/le_backend_tests.cc \ |
| 46 | + "$OUT_DIR"/be_backend_tests.cc \ |
| 47 | + -lgtest -lgtest_main -o "$OUT_DIR"/cxx_backend_tests |
44 | 48 |
|
45 |
| -./out/cxx_backend_tests \ |
46 |
| - --gtest_output="xml:out/cxx_backend_tests_detail.xml" |
| 49 | +"$OUT_DIR"/cxx_backend_tests \ |
| 50 | + --gtest_output="xml:$OUT_DIR/cxx_backend_tests_detail.xml" |
0 commit comments