aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/failed-syscalls-by-pid.py
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2010-11-26 09:25:59 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2010-12-03 05:05:15 -0500
commitb99545cb59dc0a55507100a1335f4fd0ed521032 (patch)
treedffdb51354dd1ffdf156497bcec7ebee67bb6d8e /tools/perf/scripts/python/failed-syscalls-by-pid.py
parentd94ed1287e11f91e4f4096838179984b0206be5e (diff)
ARM: mx5: dynamically allocate imx2-wdt devices
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'tools/perf/scripts/python/failed-syscalls-by-pid.py')
0 files changed, 0 insertions, 0 deletions
sha1'>33efb47
f3d21c1

33efb47









f3d21c1

33efb47



3445e10

f3d21c1
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105




                                                 






                   





                                             

                                                                         




                                                                         



                                                                         



                                                         





                                                                 



                                 




                                                                         

                   




                                                  

                                                                         



                                                                         

                   


                                            

                                


            
                 

                                                                   

  


                                      
                  



                                                                                         

  









                                                                              

                                                                              



                                              

                                                                                        
      
/**
 * @file tests.h
 * Structs and macro's for use in unit test cases
 */

#ifndef TESTS_H
#define TESTS_H

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

/**
 * @private
 * Print a failure message and exit
 * @param fmt Error string
 * @param args... Parameters for error string
 */
#define fail(fmt, args...)						\
	do {								\
		fprintf(stderr, "\n!! TEST FAILURE " fmt		\
			"\n   at %s:%d (%s)"				\
			"\n   in task PID=%d\n",			\
			## args, __FILE__, __LINE__, __FUNCTION__,	\
			getpid());					\
		fflush(stderr);						\
		exit(200);						\
	} while (0)

/**
 * Assert given predicate, print error if it doesn't hold
 * @param predicate Predicate that must hold
 */
#define ASSERT(predicate)					\
	do {							\
		if (!(predicate))				\
			fail("%s", #predicate);			\
	} while (0)

/**
 * Do and trace a syscall
 * @param call Syscall to execute
 */
#define SYSCALL(call)							\
	do {								\
		int __test_ret = (call);				\
		if (__test_ret < 0)					\
			fail("%s -> %d, %m", #call, __test_ret);	\
	} while (0)

/**
 * Do and trace a syscall that is expected to fail
 * @param expected Expected error code
 * @param call Syscall to execute
 */
#define SYSCALL_FAILS(expected, call)					\
	do {								\
		int __test_ret = (call);				\
		if (__test_ret == 0 || errno != (expected))		\
			fail("%s -> %d, %m (expected: %s)",		\
			     #call, __test_ret, #expected);		\
	} while (0)

/**
 * Function prototype for a single test case
 */
typedef void (*testfun_t)(void);

/**
 * Test case
 */
struct testcase {
	testfun_t   function; /**< Function-pointer to test-case */
	const char* description; /**< Description of test-case */
};

/**
 * Suite containing several test cases
 */
struct testsuite {
	const char* plugin;	/**< Lock scheduling plugin to use */
	int* testcases; 	/**< Pointer to array of test-cases
							 @todo why not struct testcase?*/
	int  num_cases;		/**< Number of test cases in this suite */
};

/**
 * Function descriptor for test case
 * @param function Test name
 * @param plugins Set of lock scheduling plugins this test case is applicable
 * for, separated by |
 * @param description Textual description of the test case
 *
 * Testcases defined with this macro will get picked up by a python test suite
 * generator
 */
#define TESTCASE(function, plugins, description) void test_ ## function (void)

/**
 * Fork given function body as separate thread
 * @param code Function body
 */
#define FORK_TASK(code) ({int __pid = fork(); if (__pid == 0) {code; exit(0);}; __pid;})

#endif