Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc: Add tests of unmuxed IPC calls

This is just a simple test which confirms that the individual IPC
syscalls are all available.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

+122 -1
+1 -1
tools/testing/selftests/powerpc/Makefile
··· 12 12 13 13 export CFLAGS 14 14 15 - SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr benchmarks 15 + SUB_DIRS = pmu copyloops mm tm primitives stringloops vphn switch_endian dscr benchmarks syscalls 16 16 17 17 endif 18 18
+1
tools/testing/selftests/powerpc/syscalls/.gitignore
··· 1 + ipc_unmuxed
+12
tools/testing/selftests/powerpc/syscalls/Makefile
··· 1 + TEST_PROGS := ipc_unmuxed 2 + 3 + CFLAGS += -I../../../../../usr/include 4 + 5 + all: $(TEST_PROGS) 6 + 7 + $(TEST_PROGS): ../harness.c 8 + 9 + include ../../lib.mk 10 + 11 + clean: 12 + rm -f $(TEST_PROGS) *.o
+47
tools/testing/selftests/powerpc/syscalls/ipc.h
··· 1 + #ifdef __NR_semop 2 + DO_TEST(semop, __NR_semop) 3 + #endif 4 + 5 + #ifdef __NR_semget 6 + DO_TEST(semget, __NR_semget) 7 + #endif 8 + 9 + #ifdef __NR_semctl 10 + DO_TEST(semctl, __NR_semctl) 11 + #endif 12 + 13 + #ifdef __NR_semtimedop 14 + DO_TEST(semtimedop, __NR_semtimedop) 15 + #endif 16 + 17 + #ifdef __NR_msgsnd 18 + DO_TEST(msgsnd, __NR_msgsnd) 19 + #endif 20 + 21 + #ifdef __NR_msgrcv 22 + DO_TEST(msgrcv, __NR_msgrcv) 23 + #endif 24 + 25 + #ifdef __NR_msgget 26 + DO_TEST(msgget, __NR_msgget) 27 + #endif 28 + 29 + #ifdef __NR_msgctl 30 + DO_TEST(msgctl, __NR_msgctl) 31 + #endif 32 + 33 + #ifdef __NR_shmat 34 + DO_TEST(shmat, __NR_shmat) 35 + #endif 36 + 37 + #ifdef __NR_shmdt 38 + DO_TEST(shmdt, __NR_shmdt) 39 + #endif 40 + 41 + #ifdef __NR_shmget 42 + DO_TEST(shmget, __NR_shmget) 43 + #endif 44 + 45 + #ifdef __NR_shmctl 46 + DO_TEST(shmctl, __NR_shmctl) 47 + #endif
+61
tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
··· 1 + /* 2 + * Copyright 2015, Michael Ellerman, IBM Corp. 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License 6 + * as published by the Free Software Foundation; either version 7 + * 2 of the License, or (at your option) any later version. 8 + * 9 + * This test simply tests that certain syscalls are implemented. It doesn't 10 + * actually exercise their logic in any way. 11 + */ 12 + 13 + #define _GNU_SOURCE 14 + #include <errno.h> 15 + #include <stdio.h> 16 + #include <unistd.h> 17 + #include <sys/syscall.h> 18 + 19 + #include "utils.h" 20 + 21 + 22 + #define DO_TEST(_name, _num) \ 23 + static int test_##_name(void) \ 24 + { \ 25 + int rc; \ 26 + printf("Testing " #_name); \ 27 + errno = 0; \ 28 + rc = syscall(_num, -1, 0, 0, 0, 0, 0); \ 29 + printf("\treturned %d, errno %d\n", rc, errno); \ 30 + return errno == ENOSYS; \ 31 + } 32 + 33 + #include "ipc.h" 34 + #undef DO_TEST 35 + 36 + static int ipc_unmuxed(void) 37 + { 38 + int tests_done = 0; 39 + 40 + #define DO_TEST(_name, _num) \ 41 + FAIL_IF(test_##_name()); \ 42 + tests_done++; 43 + 44 + #include "ipc.h" 45 + #undef DO_TEST 46 + 47 + /* 48 + * If we ran no tests then it means none of the syscall numbers were 49 + * defined, possibly because we were built against old headers. But it 50 + * means we didn't really test anything, so instead of passing mark it 51 + * as a skip to give the user a clue. 52 + */ 53 + SKIP_IF(tests_done == 0); 54 + 55 + return 0; 56 + } 57 + 58 + int main(void) 59 + { 60 + return test_harness(ipc_unmuxed, "ipc_unmuxed"); 61 + }