diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 9 | ||||
| -rw-r--r-- | tests/Makefile.am | 7 | ||||
| -rwxr-xr-x | tests/run-disasm-bpf.sh | 63 | ||||
| -rw-r--r-- | tests/testfile-bpf-dis1.expect.bz2 | bin | 0 -> 1497 bytes | |||
| -rw-r--r-- | tests/testfile-bpf-dis1.o.bz2 | bin | 0 -> 737 bytes |
5 files changed, 78 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index bcc296f1..1504d487 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2016-06-28 Richard Henderson <[email protected]> + + * Makefile.am (TESTS): Add run-disasm-bpf.sh, conditionally. + (EXTRA_DIST): Add run-disasm-bpf.sh, testfile-bpf-dis1.expect.bz2, + testfile-bpf-dis1.o.bz2 + (run-disasm-bpf.sh): New file. + (testfile-bpf-dis1.expect.bz2): New file. + (testfile-bpf-dis1.o.bz2): New file. + 2016-02-09 Mark Wielaard <[email protected]> * testfile-s390x-hash-both.bz2: New testfile. diff --git a/tests/Makefile.am b/tests/Makefile.am index fedcb39d..274356fb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -148,6 +148,9 @@ endif if HAVE_LIBASM check_PROGRAMS += $(asm_TESTS) TESTS += $(asm_TESTS) +if HAVE_LINUX_BPF_H +TESTS += run-disasm-bpf.sh +endif endif EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ @@ -322,7 +325,9 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile-zgabi32.bz2 testfile-zgabi64.bz2 \ testfile-zgabi32be.bz2 testfile-zgabi64be.bz2 \ run-elfgetchdr.sh run-elfgetzdata.sh run-elfputzdata.sh \ - run-zstrptr.sh run-compress-test.sh + run-zstrptr.sh run-compress-test.sh \ + run-disasm-bpf.sh \ + testfile-bpf-dis1.expect.bz2 testfile-bpf-dis1.o.bz2 if USE_VALGRIND valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1' diff --git a/tests/run-disasm-bpf.sh b/tests/run-disasm-bpf.sh new file mode 100755 index 00000000..8ca89d53 --- /dev/null +++ b/tests/run-disasm-bpf.sh @@ -0,0 +1,63 @@ +#! /bin/sh +# Copyright (C) 2016 Red Hat, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +# This test file is created with +# +# #include <linux/bpf.h> +# #include <stdio.h> +# +# int main() +# { +# int i; +# +# printf("\t.text\n"); +# +# for (i = 0; i < 256; ++i) +# if (i == (BPF_LD | BPF_IMM | BPF_DW)) +# printf("\t.byte\t%d, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0\n", i); +# else +# { +# int regs = 0; +# switch (BPF_CLASS(i)) +# { +# case BPF_ALU: +# case BPF_ALU64: +# if (BPF_SRC(i) == BPF_X +# && BPF_OP(i) != BPF_NEG +# && BPF_OP(i) != BPF_END) +# regs = 0x21; +# break; +# case BPF_LDX: +# case BPF_STX: +# regs = 0x21; +# break; +# } +# printf("\t.byte\t%d, %d, 0, 0, 0, 0, 0, 0\n", i, regs); +# } +# +# return 0; +# } +# +# $ ./a.out | as -o z1.o +# $ objcopy -j .text z1.o z2.o +# +# Then emacs hexl edit e_machine to 0xf7. + +testfiles testfile-bpf-dis1.o testfile-bpf-dis1.expect +testrun_compare ${abs_top_builddir}/src/objdump -d testfile-bpf-dis1.o < testfile-bpf-dis1.expect diff --git a/tests/testfile-bpf-dis1.expect.bz2 b/tests/testfile-bpf-dis1.expect.bz2 Binary files differnew file mode 100644 index 00000000..b4a778e0 --- /dev/null +++ b/tests/testfile-bpf-dis1.expect.bz2 diff --git a/tests/testfile-bpf-dis1.o.bz2 b/tests/testfile-bpf-dis1.o.bz2 Binary files differnew file mode 100644 index 00000000..94bb612b --- /dev/null +++ b/tests/testfile-bpf-dis1.o.bz2 |
