1#!/usr/bin/env bash 2 3set -euxo pipefail 4 5mkdir -p out/ 6OUT_DIR="$(pwd)/out" 7 8# move to `pdl-compiler` directory 9cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &> /dev/null 10 11sed -e 's/little_endian_packets/big_endian_packets/' \ 12 -e '/Start: little_endian_only/,/End: little_endian_only/d' \ 13 < tests/canonical/le_test_file.pdl > "$OUT_DIR"/be_test_file.pdl 14 15pdlc tests/canonical/le_test_file.pdl > "$OUT_DIR"/le_test_file.json 16pdlc "$OUT_DIR"/be_test_file.pdl > "$OUT_DIR"/be_test_file.json 17 18python3 scripts/generate_python_backend.py \ 19 --input "$OUT_DIR"/le_test_file.json \ 20 --output "$OUT_DIR"/le_backend.py \ 21 --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize \ 22 --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize \ 23 --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount \ 24 --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize \ 25 --custom-type-location tests.custom_types 26python3 scripts/generate_python_backend.py \ 27 --input "$OUT_DIR"/be_test_file.json \ 28 --output "$OUT_DIR"/be_backend.py \ 29 --exclude-declaration Packet_Array_Field_VariableElementSize_ConstantSize \ 30 --exclude-declaration Packet_Array_Field_VariableElementSize_VariableSize \ 31 --exclude-declaration Packet_Array_Field_VariableElementSize_VariableCount \ 32 --exclude-declaration Packet_Array_Field_VariableElementSize_UnknownSize \ 33 --custom-type-location tests.custom_types 34 35export PYTHONPATH="$OUT_DIR:.:${PYTHONPATH:-}" 36python3 tests/python_generator_test.py 37