selftests/powerpc: Add a helper for checking if we're on ppc64le
Some of our selftests have only been tested on ppc64le and crash or behave weirdly on ppc64/ppc32. So add a helper for checking the UTS machine. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
@@ -11,8 +11,10 @@
|
||||
#include <link.h>
|
||||
#include <sched.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils.h"
|
||||
@@ -104,3 +106,18 @@ int pick_online_cpu(void)
|
||||
printf("No cpus in affinity mask?!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool is_ppc64le(void)
|
||||
{
|
||||
struct utsname uts;
|
||||
int rc;
|
||||
|
||||
errno = 0;
|
||||
rc = uname(&uts);
|
||||
if (rc) {
|
||||
perror("uname");
|
||||
return false;
|
||||
}
|
||||
|
||||
return strcmp(uts.machine, "ppc64le") == 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user