Skip to content

Commit

Permalink
selftests/powerpc: Allow the tm-syscall test to build with old headers
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mpe committed Oct 15, 2015
1 parent 65b6ba6 commit 20d0992
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/testing/selftests/powerpc/tm/tm-syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 20d0992

Please sign in to comment.