kselftest/vDSO: Make test name reporting for vdso_abi_test tooling friendly
authorMark Brown <broonie@kernel.org>
Thu, 23 Nov 2023 10:45:47 +0000 (10:45 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 30 Nov 2023 21:49:56 +0000 (14:49 -0700)
commit60e76e7ac088c5146d647cc5cc3f345b54489915
treecf8356e75206880cf55bc0ca601f3906e853539e
parent9686e7f59b142095ac6ad0763312ec68fc34c51a
kselftest/vDSO: Make test name reporting for vdso_abi_test tooling friendly

The test results from vdso_abi_test are all formatted using a series of
macros:

  #define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__
  #define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x
  #define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x

which don't play nicely with automated KTAP parsers since the actual KTAP
lines are in the form

   ok 1

with no test name and we get an additional log line such as

  vdso_test_gettimeofday(): PASS

with no preceeding # as KTAP requires. The lack of a test name means that
many automation systems will have a hard time distinguishing between the
different tests or correlating results between runs, the lack of # is less
severe but could potentially cause confusion.

Fix these issues by rewriting all the result reporting to include both the
vDSO function name being tested and (where there is one) the name of the
clock being tested in the main KTAP line. Since we have tests both with and
without a specific clock we abandon the helper macros and just put the
format strings used directly in the ksft_ API calls. When we fail to look
up the relevant vDSO symbol we add a separate print statement explaining
why the skip is being done. This gives output such as:

  ok 1 __vdso_gettimeofday
  # clock_id: CLOCK_REALTIME
  # The time is 1700673118.58091596
  ok 2 __vdso_clock_gettime CLOCK_REALTIME

which is much easier for test automation to work with.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/vDSO/vdso_test_abi.c