Alan-Jowett / bpf_conformance

Measures the conformance of a BPF runtime to the ISA.
Other
25 stars 14 forks source link

bpf_conformance_runner strips new-lines from error output #279

Open Alan-Jowett opened 2 months ago

Alan-Jowett commented 2 months ago

Output looks like this:

alanjo@alanjo-dev2:~/bpf_conformance$ cat test.data
# test: exit.data
# Test for EXIT instruction with no prior operations
-- asm
exit
-- result
0x0"
alanjo@alanjo-dev2:~/bpf_conformance$ sudo build/bin/bpf_conformance_runner --test_file_path ./test.data --debug true  --plugin_path build/bin/libbpf_plugin --plugin_options "--debug"
Test file: "./test.data"
Input memory:
Expected return value: 0
Expected error string:
Byte code: 95  00  00  00  00  00  00  00
Test:"./test.data"FAILPlugin returned error code 1 and output Failed to load program: 0: (85) call pc+4caller: R10=fp0callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp05: (95) exitreturning from callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0to caller at 1: R10=fp0from 5 to 1: R10=fp01: (18) r1 = 0xffff9546ef55a3103: (7b) *(u64 *)(r1 +0) = r0R0 !read_okprocessed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
Test "./test.data" error: Plugin returned error code 1 and output Failed to load program: 0: (85) call pc+4caller: R10=fp0callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp05: (95) exitreturning from callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0to caller at 1: R10=fp0from 5 to 1: R10=fp01: (18) r1 = 0xffff9546ef55a3103: (7b) *(u64 *)(r1 +0) = r0R0 !read_okprocessed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
Test results:
ERROR: "./test.data" Plugin returned error code 1 and output Failed to load program: 0: (85) call pc+4caller: R10=fp0callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp05: (95) exitreturning from callee: frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0to caller at 1: R10=fp0from 5 to 1: R10=fp01: (18) r1 = 0xffff9546ef55a3103: (7b) *(u64 *)(r1 +0) = r0R0 !read_okprocessed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
Passed 0 out of 1 tests.

When it should look like this:

alanjo@alanjo-dev2:~/bpf_conformance$ sudo build/bin/bpf_conformance_runner --test_file_path ./test.data --plugin_path build/bin/libbpf_plugin --plugin_options "--debug"
Test "./test.data" error: Plugin returned error code 1 and output Failed to load program: 0: (85) call pc+4
caller:
 R10=fp0
callee:
 frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0
5: (95) exit
returning from callee:
 frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0
to caller at 1:
 R10=fp0

from 5 to 1: R10=fp0
1: (18) r1 = 0xffff954402881510
3: (7b) *(u64 *)(r1 +0) = r0
R0 !read_ok
processed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

Test results:
ERROR: "./test.data" Plugin returned error code 1 and output Failed to load program: 0: (85) call pc+4
caller:
 R10=fp0
callee:
 frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0
5: (95) exit
returning from callee:
 frame1: R1=ctx(id=0,off=0,imm=0) R10=fp0
to caller at 1:
 R10=fp0

from 5 to 1: R10=fp0
1: (18) r1 = 0xffff954402881510
3: (7b) *(u64 *)(r1 +0) = r0
R0 !read_ok
processed 4 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

Passed 0 out of 1 tests.