summaryrefslogtreecommitdiff
path: root/apf_run_test.sh
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-07-09 00:01:57 +0900
committerLorenzo Colitti <lorenzo@google.com>2020-07-08 15:19:44 +0000
commit82f4e345aef14aafec68cc40fbd8dc7dce50b852 (patch)
tree2d1be8780e7fcd4ada28d66dccb6834b1eb737cb /apf_run_test.sh
parent164a8c4e4e8ffb194bd7b60ed9d7d48c6be2a64d (diff)
downloadapf-82f4e345aef14aafec68cc40fbd8dc7dce50b852.tar.gz
Add test coverage for the --age parameter to apf_run.android-r-beta-3android-r-beta-2
Currently this is untested, and, as it happened, didn't work when all the other parameters (program, packet, data, --trace) were specified. Currently each testcase is a set of 3 or 4 files with the same basename and with extensions .program, .packet, .output, and optionally .data. For simplicity, add another optional file with extension .age. Instead of recreating more testdata, re-use the existing testcase one_ra_with_counters, adding three more variants of it, one with age 30 (drop), one with age 600 (drop) and one with age 601 (pass). Avoid adding identical files by using symlinks for the program, packet and data files, and only define new files for the output and age files. Test: atest apf_run_test Change-Id: Idab8be57b1f98bd0246d9ec31695becce43c0d05
Diffstat (limited to 'apf_run_test.sh')
-rwxr-xr-xapf_run_test.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/apf_run_test.sh b/apf_run_test.sh
index b365e84..12bbfe0 100755
--- a/apf_run_test.sh
+++ b/apf_run_test.sh
@@ -8,7 +8,7 @@ testname=$(basename $(basename $0 .sh))
retcode=0
# Loop through testcases and run each one.
-# Each testcase is composed of a program, a packet, optionally the starting data, and the output.
+# Each testcase is composed of program, packet, output, and optionally, starting data and/or age.
for prog in testdata/*.program; do
testcase=$(basename $prog .program)
prog=$(cat testdata/$testcase.program)
@@ -19,6 +19,9 @@ for prog in testdata/*.program; do
if [[ -f testdata/$testcase.data ]]; then
args="$args --data $(cat testdata/$testcase.data)"
fi
+ if [[ -f testdata/$testcase.age ]]; then
+ args="$args --age $(cat testdata/$testcase.age)"
+ fi
if diff --color -u <(apf_run $args) <(cat $outputpath); then
echo $testname: $testcase: PASS