summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
blob: 2ac02706f8c84d230ddb45fd8e250951fa89083e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * Copyright 2015, Michael Ellerman, IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * This test simply tests that certain syscalls are implemented. It doesn't
 * actually exercise their logic in any way.
 */

#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>

#include "utils.h"


#define DO_TEST(_name, _num)	\
static int test_##_name(void)			\
{						\
	int rc;					\
	printf("Testing " #_name);		\
	errno = 0;				\
	rc = syscall(_num, -1, 0, 0, 0, 0, 0);	\
	printf("\treturned %d, errno %d\n", rc, errno); \
	return errno == ENOSYS;			\
}

#include "ipc.h"
#undef DO_TEST

static int ipc_unmuxed(void)
{
	int tests_done = 0;

#define DO_TEST(_name, _num)		\
	FAIL_IF(test_##_name());	\
	tests_done++;

#include "ipc.h"
#undef DO_TEST

	/*
	 * If we ran no tests then it means none of the syscall numbers were
	 * defined, possibly because we were built against old headers. But it
	 * means we didn't really test anything, so instead of passing mark it
	 * as a skip to give the user a clue.
	 */
	SKIP_IF(tests_done == 0);

	return 0;
}

int main(void)
{
	return test_harness(ipc_unmuxed, "ipc_unmuxed");
}