Allow test scripts to use additional command line options when running the tests.
Signed-off-by: Mike Leach mike.leach@linaro.org --- decoder/tests/run_pkt_decode_single.bash | 7 ++++--- decoder/tests/run_pkt_decode_tests-ete.bash | 11 +++++++---- decoder/tests/run_pkt_decode_tests.bash | 17 ++++++++++------- 3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/decoder/tests/run_pkt_decode_single.bash b/decoder/tests/run_pkt_decode_single.bash index b4ca58f..3025240 100755 --- a/decoder/tests/run_pkt_decode_single.bash +++ b/decoder/tests/run_pkt_decode_single.bash @@ -34,10 +34,10 @@ ################################################################################# # Usage options:- # * default: run test on binary + libs in ./bin/linux64/rel -# run_pkt_decode_tests.bash <test> +# run_pkt_decode_tests.bash <test> <options> # # * use installed opencsd libraries & program -# run_pkt_decode_tests.bash use-installed <test> +# run_pkt_decode_tests.bash use-installed <test> <options> # #
@@ -56,6 +56,7 @@ fi
if [ "$1" != "" ]; then TEST=$1 + shift fi
echo "Running trc_pkt_lister on single snapshot ${TEST}" @@ -70,7 +71,7 @@ else fi
# === test the decode set === -${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/${TEST}" -decode -logfilename "${OUT_DIR}/${TEST}.ppl" +${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/${TEST}" $@ -decode -logfilename "${OUT_DIR}/${TEST}.ppl" echo "Done : Return $?"
diff --git a/decoder/tests/run_pkt_decode_tests-ete.bash b/decoder/tests/run_pkt_decode_tests-ete.bash index c00631e..1b8c762 100755 --- a/decoder/tests/run_pkt_decode_tests-ete.bash +++ b/decoder/tests/run_pkt_decode_tests-ete.bash @@ -84,8 +84,11 @@ mkdir -p ${OUT_DIR}
if [ "$1" == "use-installed" ]; then BIN_DIR="" -elif [ "$1" != "" ]; then - BIN_DIR=$1 + shift +elif [ "$1" == "-bindir" ]; then + BIN_DIR=$2 + shift + shift fi
echo "Tests using BIN_DIR = ${BIN_DIR}" @@ -99,13 +102,13 @@ fi for test_dir in "${test_dirs_decode[@]}" do echo "Testing $test_dir..." - ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir" -decode -logfilename "${OUT_DIR}/$test_dir.ppl" + ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir" $@ -decode -logfilename "${OUT_DIR}/$test_dir.ppl" echo "Done : Return $?" done
for test_dir_n in "${test_dirs_decode_src_addr_opt[@]}" do echo "Testing with -src_addr_n $test_dir_n..." - ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir_n" -decode -src_addr_n -logfilename "${OUT_DIR}/${test_dir_n}_src_addr_N.ppl" + ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir_n" $@ -decode -src_addr_n -logfilename "${OUT_DIR}/${test_dir_n}_src_addr_N.ppl" echo "Done : Return $?" done diff --git a/decoder/tests/run_pkt_decode_tests.bash b/decoder/tests/run_pkt_decode_tests.bash index d9b7c8a..9ecb034 100755 --- a/decoder/tests/run_pkt_decode_tests.bash +++ b/decoder/tests/run_pkt_decode_tests.bash @@ -40,10 +40,10 @@ # run_pkt_decode_tests.bash # # * use installed opencsd libraries & program -# run_pkt_decode_tests.bash use-installed +# run_pkt_decode_tests.bash use-installed <options> # # * use supplied path for binary + libs (must have trailing /) -# run_pkt_decode_tests.bash <custom>/<path>/ +# run_pkt_decode_tests.bash -bindir <custom>/<path>/ <options> #
OUT_DIR=./results @@ -75,8 +75,11 @@ mkdir -p ${OUT_DIR}
if [ "$1" == "use-installed" ]; then BIN_DIR="" -elif [ "$1" != "" ]; then - BIN_DIR=$1 + shift +elif [ "$1" == "-bindir" ]; then + BIN_DIR=$2 + shift + shift fi
echo "Tests using BIN_DIR = ${BIN_DIR}" @@ -90,17 +93,17 @@ fi for test_dir in "${test_dirs_decode[@]}" do echo "Testing $test_dir..." - ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir" -decode -logfilename "${OUT_DIR}/$test_dir.ppl" + ${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/$test_dir" $@ -decode -logfilename "${OUT_DIR}/$test_dir.ppl" echo "Done : Return $?" done
# === test a packet only example === echo "Testing init-short-addr..." -${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/init-short-addr" -pkt_mon -logfilename "${OUT_DIR}/init-short-addr.ppl" +${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/init-short-addr" $@ -pkt_mon -logfilename "${OUT_DIR}/init-short-addr.ppl"
# === test the TPIU deformatter === echo "Testing a55-test-tpiu..." -${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/a55-test-tpiu" -dstream_format -o_raw_packed -o_raw_unpacked -logfilename "${OUT_DIR}/a55-test-tpiu.ppl" +${BIN_DIR}trc_pkt_lister -ss_dir "${SNAPSHOT_DIR}/a55-test-tpiu" $@ -dstream_format -o_raw_packed -o_raw_unpacked -logfilename "${OUT_DIR}/a55-test-tpiu.ppl" echo "Done : Return $?"
# === test the C-API lib - this test prog is not installed ===