linux/tools/testing
Eduard Zingerman 19a8e06f5f selftests/bpf: Tests execution support for test_loader.c
Extends test_loader.c:test_loader__run_subtests() by allowing to
execute BPF_PROG_TEST_RUN bpf command for selected programs.
This is similar to functionality provided by test_verifier.

Adds the following new attributes controlling test_loader behavior:

  __retval(...)
  __retval_unpriv(...)

* If any of these attributes is present, the annotated program would
  be executed using libbpf's bpf_prog_test_run_opts() function.
* If __retval is present, the test run would be done for program
  loaded in privileged mode.
* If __retval_unpriv is present, the test run would be done for
  program loaded in unprivileged mode.
* To mimic test_verifier behavior, the actual run is initiated in
  privileged mode.
* The value returned by a test run is compared against retval
  parameter.

The retval attribute takes one of the following parameters:
- a decimal number
- a hexadecimal number (must start from '0x')
- any of a three special literals (provided for compatibility with
  test_verifier):
  - INT_MIN
  - POINTER_VALUE
  - TEST_DATA_LEN

An example of the attribute usage:

  SEC("socket")
  __description("return 42")
  __success __success_unpriv __retval(42)
  __naked void the_42_test(void)
  {
          asm volatile ("                                 \
          r0 = 42;                                        \
          exit;                                           \
  "       ::: __clobber_all);
  }

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20230325025524.144043-5-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-03-25 17:02:02 -07:00
..
crypto/chacha20-s390 tools/testing/crypto: Use vzalloc instead of vmalloc+memset 2022-07-05 14:46:36 +02:00
cxl Merge branch 'for-6.3/cxl-rr-emu' into cxl/next 2023-02-14 16:06:10 -08:00
fault-injection
ktest ktest: Restore stty setting at first in dodie 2023-02-20 11:52:27 -05:00
kunit kunit: kunit.py extract handlers 2023-02-08 14:25:30 -07:00
memblock Revert "mm: Always release pages to the buddy allocator in memblock_free_late()." 2023-02-07 13:07:37 +02:00
nvdimm libnvdimm: Introduce CONFIG_NVDIMM_SECURITY_TEST flag 2022-12-01 12:42:35 -08:00
radix-tree maple_tree: remove the parameter entry of mas_preallocate 2023-02-02 22:32:52 -08:00
scatterlist
selftests selftests/bpf: Tests execution support for test_loader.c 2023-03-25 17:02:02 -07:00
vsock test/vsock: vsock_perf utility 2023-01-12 12:53:54 +01:00