summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:31:20 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-06-21 14:31:20 +0000
commitc409fe72e51f8ef1a5fcca83df62d45f54d5f439 (patch)
treed4497b0d7a28a9ed7bf990a7669e8260e272a2db
parent937551c7d1467caec9164c320cb95abd9da12162 (diff)
parent780e2813a329152ed3762087924e2c0e2dd469ee (diff)
downloadapf-android12-mainline-adbd-release.tar.gz
Change-Id: I551e2315c4f75d1d177923ee16cd5b2d3e2f35dc
-rw-r--r--Android.bp19
-rw-r--r--METADATA3
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--TEST_MAPPING2
-rw-r--r--apf_run.c5
-rwxr-xr-xapf_run_test.sh7
-rw-r--r--apf_run_test.xml2
-rw-r--r--testdata/one_ra_with_counters_age_30.age1
l---------testdata/one_ra_with_counters_age_30.data1
-rw-r--r--testdata/one_ra_with_counters_age_30.output57
l---------testdata/one_ra_with_counters_age_30.packet1
l---------testdata/one_ra_with_counters_age_30.program1
-rw-r--r--testdata/one_ra_with_counters_age_600.age1
l---------testdata/one_ra_with_counters_age_600.data1
-rw-r--r--testdata/one_ra_with_counters_age_600.output57
l---------testdata/one_ra_with_counters_age_600.packet1
l---------testdata/one_ra_with_counters_age_600.program1
-rw-r--r--testdata/one_ra_with_counters_age_601.age1
l---------testdata/one_ra_with_counters_age_601.data1
-rw-r--r--testdata/one_ra_with_counters_age_601.output36
l---------testdata/one_ra_with_counters_age_601.packet1
l---------testdata/one_ra_with_counters_age_601.program1
22 files changed, 190 insertions, 10 deletions
diff --git a/Android.bp b/Android.bp
index 9c9870c..c0d3722 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,22 @@
// Copyright 2016 The Android Open Source Project
+package {
+ default_applicable_licenses: ["hardware_google_apf_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "hardware_google_apf_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "LICENSE",
+ ],
+}
+
cc_defaults {
name: "apf_defaults",
@@ -59,8 +76,8 @@ sh_test_host {
filename: "apf_run_test.sh",
test_suites: ["general-tests"],
test_config: "apf_run_test.xml",
- required: [":apf_run"],
data: ["testdata/*"],
+ data_bins: ["apf_run"],
target: {
darwin: {
enabled: false,
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+ license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 9135dc3..564bf92 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,5 +1,5 @@
{
- "postsubmit": [
+ "presubmit": [
{ "name": "NetworkStackTests" },
{ "name": "apf_run_test",
"host": true }
diff --git a/apf_run.c b/apf_run.c
index 0b36b0e..38d28a2 100644
--- a/apf_run.c
+++ b/apf_run.c
@@ -181,11 +181,6 @@ void print_usage(char* cmd) {
}
int main(int argc, char* argv[]) {
- if (argc > 9) {
- print_usage(argv[0]);
- exit(1);
- }
-
uint8_t* program = NULL;
uint32_t program_len;
const char* filename = NULL;
diff --git a/apf_run_test.sh b/apf_run_test.sh
index b365e84..ef47fc8 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,8 +19,11 @@ 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
+ if diff --color -u <(./apf_run $args) <(cat $outputpath); then
echo $testname: $testcase: PASS
else
echo $testname: $testcase: FAIL
diff --git a/apf_run_test.xml b/apf_run_test.xml
index 689d5a6..1719348 100644
--- a/apf_run_test.xml
+++ b/apf_run_test.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for running APF tools tests through atest">
<option name="test-suite-tag" value="apf_run_test" />
- <!-- This test requires a device, so it's not annotated with a null-device -->
+ <option name="null-device" value="true" />
<test class="com.android.tradefed.testtype.binary.ExecutableHostTest" >
<option name="binary" value="apf_run_test.sh" />
<!-- Script assumes a relative path with the tests/ folders -->
diff --git a/testdata/one_ra_with_counters_age_30.age b/testdata/one_ra_with_counters_age_30.age
new file mode 100644
index 0000000..64bb6b7
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_30.age
@@ -0,0 +1 @@
+30
diff --git a/testdata/one_ra_with_counters_age_30.data b/testdata/one_ra_with_counters_age_30.data
new file mode 120000
index 0000000..368e625
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_30.data
@@ -0,0 +1 @@
+one_ra_with_counters.data \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_30.output b/testdata/one_ra_with_counters_age_30.output
new file mode 100644
index 0000000..8797e74
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_30.output
@@ -0,0 +1,57 @@
+ R0 R1 PC Instruction
+-------------------------------------------------
+ 0 0 0: li r1, -4
+ 0 fffffffc 2: lddw r0, [r1+0]
+ 29 fffffffc 3: add r0, 1
+ 2a fffffffc 5: stdw r0, [r1+0]
+ 2a fffffffc 6: ldh r0, [12]
+ 86dd fffffffc 8: li r1, -104
+ 86dd ffffff98 10: jlt r0, 0x600, 503
+ 86dd ffffff98 15: li r1, -108
+ 86dd ffffff94 17: jeq r0, 0x88a2, 503
+ 86dd ffffff94 22: jeq r0, 0x88a4, 503
+ 86dd ffffff94 27: jeq r0, 0x88b8, 503
+ 86dd ffffff94 32: jeq r0, 0x88cd, 503
+ 86dd ffffff94 37: jeq r0, 0x88e3, 503
+ 86dd ffffff94 42: jne r0, 0x806, 115
+ 86dd ffffff94 115: jne r0, 0x800, 215
+ 86dd ffffff94 215: jeq r0, 0x86dd, 239
+ 86dd ffffff94 239: ldb r0, [20]
+ 3a ffffff94 241: jeq r0, 0x3a, 255
+ 3a ffffff94 255: ldb r0, [54]
+ 86 ffffff94 257: li r1, -84
+ 86 ffffffac 259: jeq r0, 0x85, 503
+ 86 ffffffac 262: jne r0, 0x88, 290
+ 86 ffffffac 290: ldm r0, m[14]
+ 96 ffffffac 292: jne r0, 0x96, 495
+ 96 ffffffac 295: ldm r0, m[15]
+ 1e ffffffac 297: jgt r0, 0x258, 495
+ 1e ffffffac 302: li r0, 0
+ 0 ffffffac 303: jnebs r0, 0xf, 495, 428e66343deb28a24b792e9086dd68
+ 0 ffffffac 321: li r0, 18
+ 12 ffffffac 323: jnebs r0, 0x26, 495, 00603afffe8000000000000002005efffe000265fe80000000000000408e66fffe343deb8600
+ 12 ffffffac 364: li r0, 58
+ 3a ffffffac 366: jnebs r0, 0x2, 495, 4000
+ 3a ffffffac 371: ldh r0, [60]
+ e10 ffffffac 373: jlt r0, 0x258, 495
+ e10 ffffffac 378: li r0, 62
+ 3e ffffffac 380: jnebs r0, 0x14, 495, 0000000000000000010100005e00026519050000
+ 3e ffffffac 403: ldw r0, [82]
+ e10 ffffffac 405: jlt r0, 0x258, 495
+ e10 ffffffac 410: li r0, 86
+ 56 ffffffac 412: jnebs r0, 0x24, 495, 2001486048600000000000000000884420014860486000000000000000008888030440c0
+ 56 ffffffac 451: ldw r0, [122]
+ 278d00 ffffffac 453: jlt r0, 0x258, 495
+ 278d00 ffffffac 458: ldw r0, [126]
+ 93a80 ffffffac 460: jlt r0, 0x258, 495
+ 93a80 ffffffac 465: li r0, 130
+ 82 ffffffac 468: jnebs r0, 0x14, 495, 000000002a0079e10abc0e000000000000000000
+ 82 ffffffac 491: li r1, -56
+ 82 ffffffc8 493: jmp 503
+ 82 ffffffc8 503: lddw r0, [r1+0]
+ 1b ffffffc8 504: add r0, 1
+ 1c ffffffc8 506: stdw r0, [r1+0]
+ 1c ffffffc8 507: jmp DROP
+ 1c ffffffc8 510: DROP
+Packet dropped
+Data: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a
diff --git a/testdata/one_ra_with_counters_age_30.packet b/testdata/one_ra_with_counters_age_30.packet
new file mode 120000
index 0000000..e32839c
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_30.packet
@@ -0,0 +1 @@
+one_ra_with_counters.packet \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_30.program b/testdata/one_ra_with_counters_age_30.program
new file mode 120000
index 0000000..2f0ad56
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_30.program
@@ -0,0 +1 @@
+one_ra_with_counters.program \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_600.age b/testdata/one_ra_with_counters_age_600.age
new file mode 100644
index 0000000..e9f960c
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_600.age
@@ -0,0 +1 @@
+600
diff --git a/testdata/one_ra_with_counters_age_600.data b/testdata/one_ra_with_counters_age_600.data
new file mode 120000
index 0000000..368e625
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_600.data
@@ -0,0 +1 @@
+one_ra_with_counters.data \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_600.output b/testdata/one_ra_with_counters_age_600.output
new file mode 100644
index 0000000..33c7d4a
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_600.output
@@ -0,0 +1,57 @@
+ R0 R1 PC Instruction
+-------------------------------------------------
+ 0 0 0: li r1, -4
+ 0 fffffffc 2: lddw r0, [r1+0]
+ 29 fffffffc 3: add r0, 1
+ 2a fffffffc 5: stdw r0, [r1+0]
+ 2a fffffffc 6: ldh r0, [12]
+ 86dd fffffffc 8: li r1, -104
+ 86dd ffffff98 10: jlt r0, 0x600, 503
+ 86dd ffffff98 15: li r1, -108
+ 86dd ffffff94 17: jeq r0, 0x88a2, 503
+ 86dd ffffff94 22: jeq r0, 0x88a4, 503
+ 86dd ffffff94 27: jeq r0, 0x88b8, 503
+ 86dd ffffff94 32: jeq r0, 0x88cd, 503
+ 86dd ffffff94 37: jeq r0, 0x88e3, 503
+ 86dd ffffff94 42: jne r0, 0x806, 115
+ 86dd ffffff94 115: jne r0, 0x800, 215
+ 86dd ffffff94 215: jeq r0, 0x86dd, 239
+ 86dd ffffff94 239: ldb r0, [20]
+ 3a ffffff94 241: jeq r0, 0x3a, 255
+ 3a ffffff94 255: ldb r0, [54]
+ 86 ffffff94 257: li r1, -84
+ 86 ffffffac 259: jeq r0, 0x85, 503
+ 86 ffffffac 262: jne r0, 0x88, 290
+ 86 ffffffac 290: ldm r0, m[14]
+ 96 ffffffac 292: jne r0, 0x96, 495
+ 96 ffffffac 295: ldm r0, m[15]
+ 258 ffffffac 297: jgt r0, 0x258, 495
+ 258 ffffffac 302: li r0, 0
+ 0 ffffffac 303: jnebs r0, 0xf, 495, 428e66343deb28a24b792e9086dd68
+ 0 ffffffac 321: li r0, 18
+ 12 ffffffac 323: jnebs r0, 0x26, 495, 00603afffe8000000000000002005efffe000265fe80000000000000408e66fffe343deb8600
+ 12 ffffffac 364: li r0, 58
+ 3a ffffffac 366: jnebs r0, 0x2, 495, 4000
+ 3a ffffffac 371: ldh r0, [60]
+ e10 ffffffac 373: jlt r0, 0x258, 495
+ e10 ffffffac 378: li r0, 62
+ 3e ffffffac 380: jnebs r0, 0x14, 495, 0000000000000000010100005e00026519050000
+ 3e ffffffac 403: ldw r0, [82]
+ e10 ffffffac 405: jlt r0, 0x258, 495
+ e10 ffffffac 410: li r0, 86
+ 56 ffffffac 412: jnebs r0, 0x24, 495, 2001486048600000000000000000884420014860486000000000000000008888030440c0
+ 56 ffffffac 451: ldw r0, [122]
+ 278d00 ffffffac 453: jlt r0, 0x258, 495
+ 278d00 ffffffac 458: ldw r0, [126]
+ 93a80 ffffffac 460: jlt r0, 0x258, 495
+ 93a80 ffffffac 465: li r0, 130
+ 82 ffffffac 468: jnebs r0, 0x14, 495, 000000002a0079e10abc0e000000000000000000
+ 82 ffffffac 491: li r1, -56
+ 82 ffffffc8 493: jmp 503
+ 82 ffffffc8 503: lddw r0, [r1+0]
+ 1b ffffffc8 504: add r0, 1
+ 1c ffffffc8 506: stdw r0, [r1+0]
+ 1c ffffffc8 507: jmp DROP
+ 1c ffffffc8 510: DROP
+Packet dropped
+Data: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a
diff --git a/testdata/one_ra_with_counters_age_600.packet b/testdata/one_ra_with_counters_age_600.packet
new file mode 120000
index 0000000..e32839c
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_600.packet
@@ -0,0 +1 @@
+one_ra_with_counters.packet \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_600.program b/testdata/one_ra_with_counters_age_600.program
new file mode 120000
index 0000000..2f0ad56
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_600.program
@@ -0,0 +1 @@
+one_ra_with_counters.program \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_601.age b/testdata/one_ra_with_counters_age_601.age
new file mode 100644
index 0000000..75a2e0d
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_601.age
@@ -0,0 +1 @@
+601
diff --git a/testdata/one_ra_with_counters_age_601.data b/testdata/one_ra_with_counters_age_601.data
new file mode 120000
index 0000000..368e625
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_601.data
@@ -0,0 +1 @@
+one_ra_with_counters.data \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_601.output b/testdata/one_ra_with_counters_age_601.output
new file mode 100644
index 0000000..4228eb5
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_601.output
@@ -0,0 +1,36 @@
+ R0 R1 PC Instruction
+-------------------------------------------------
+ 0 0 0: li r1, -4
+ 0 fffffffc 2: lddw r0, [r1+0]
+ 29 fffffffc 3: add r0, 1
+ 2a fffffffc 5: stdw r0, [r1+0]
+ 2a fffffffc 6: ldh r0, [12]
+ 86dd fffffffc 8: li r1, -104
+ 86dd ffffff98 10: jlt r0, 0x600, 503
+ 86dd ffffff98 15: li r1, -108
+ 86dd ffffff94 17: jeq r0, 0x88a2, 503
+ 86dd ffffff94 22: jeq r0, 0x88a4, 503
+ 86dd ffffff94 27: jeq r0, 0x88b8, 503
+ 86dd ffffff94 32: jeq r0, 0x88cd, 503
+ 86dd ffffff94 37: jeq r0, 0x88e3, 503
+ 86dd ffffff94 42: jne r0, 0x806, 115
+ 86dd ffffff94 115: jne r0, 0x800, 215
+ 86dd ffffff94 215: jeq r0, 0x86dd, 239
+ 86dd ffffff94 239: ldb r0, [20]
+ 3a ffffff94 241: jeq r0, 0x3a, 255
+ 3a ffffff94 255: ldb r0, [54]
+ 86 ffffff94 257: li r1, -84
+ 86 ffffffac 259: jeq r0, 0x85, 503
+ 86 ffffffac 262: jne r0, 0x88, 290
+ 86 ffffffac 290: ldm r0, m[14]
+ 96 ffffffac 292: jne r0, 0x96, 495
+ 96 ffffffac 295: ldm r0, m[15]
+ 259 ffffffac 297: jgt r0, 0x258, 495
+ 259 ffffffac 495: li r1, -28
+ 259 ffffffe4 497: lddw r0, [r1+0]
+ 0 ffffffe4 498: add r0, 1
+ 1 ffffffe4 500: stdw r0, [r1+0]
+ 1 ffffffe4 501: jmp PASS
+ 1 ffffffe4 509: PASS
+Packet passed
+Data: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b0000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000002a
diff --git a/testdata/one_ra_with_counters_age_601.packet b/testdata/one_ra_with_counters_age_601.packet
new file mode 120000
index 0000000..e32839c
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_601.packet
@@ -0,0 +1 @@
+one_ra_with_counters.packet \ No newline at end of file
diff --git a/testdata/one_ra_with_counters_age_601.program b/testdata/one_ra_with_counters_age_601.program
new file mode 120000
index 0000000..2f0ad56
--- /dev/null
+++ b/testdata/one_ra_with_counters_age_601.program
@@ -0,0 +1 @@
+one_ra_with_counters.program \ No newline at end of file