diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2015-10-15 11:39:28 +1100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-10-15 20:32:04 +1100 |
commit | 20d09927e669b7e92795c804a3cf82d6c4f3c909 (patch) | |
tree | b68e6dc550b76a5b0b9a47042e0609c9d00da15a /tools | |
parent | 65b6ba6359eefe5560565af2a0e3b06ec6a0f30e (diff) | |
download | linux-stable-20d09927e669b7e92795c804a3cf82d6c4f3c909.tar.gz linux-stable-20d09927e669b7e92795c804a3cf82d6c4f3c909.tar.bz2 linux-stable-20d09927e669b7e92795c804a3cf82d6c4f3c909.zip |
selftests/powerpc: Allow the tm-syscall test to build with old headers
When building against older kernel headers, currently the tm-syscall
test fails to build because PPC_FEATURE2_HTM_NOSC is not defined.
Tweak the test so that if PPC_FEATURE2_HTM_NOSC is not defined it still
builds, but prints a warning at run time and marks the test as skipped.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/powerpc/tm/tm-syscall.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm-syscall.c b/tools/testing/selftests/powerpc/tm/tm-syscall.c index 1276e23da63b..e835bf7ec7ae 100644 --- a/tools/testing/selftests/powerpc/tm/tm-syscall.c +++ b/tools/testing/selftests/powerpc/tm/tm-syscall.c @@ -77,13 +77,23 @@ pid_t getppid_tm(bool suspend) exit(-1); } +static inline bool have_htm_nosc(void) +{ +#ifdef PPC_FEATURE2_HTM_NOSC + return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_HTM_NOSC); +#else + printf("PPC_FEATURE2_HTM_NOSC not defined, can't check AT_HWCAP2\n"); + return false; +#endif +} + int tm_syscall(void) { unsigned count = 0; struct timeval end, now; - SKIP_IF(!((long)get_auxv_entry(AT_HWCAP2) - & PPC_FEATURE2_HTM_NOSC)); + SKIP_IF(!have_htm_nosc()); + setbuf(stdout, NULL); printf("Testing transactional syscalls for %d seconds...\n", TEST_DURATION); |