source: mainline/uspace/app/tester/tester.h@ e8747bd8

Last change on this file since e8747bd8 was b22b0a94, checked in by Matthieu Riolo <matthieu.riolo@…>, 6 years ago

task: Inoperative API for passing kernel task events to uspace

  • Based on user-provided callback function.
  • Includes slight refactoring of tester application code.

Conflicts:

uspace/lib/c/include/task.h

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*
2 * Copyright (c) 2007 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup tester
30 * @{
31 */
32/** @file
33 */
34
35#ifndef TESTER_H_
36#define TESTER_H_
37
38#include <stdbool.h>
39#include <stacktrace.h>
40#include <stdio.h>
41
42#define IPC_TEST_SERVICE 10240
43#define IPC_TEST_METHOD 2000
44
45extern bool test_quiet;
46extern int test_argc;
47extern char **test_argv;
48
49/**
50 * sizeof_array
51 * @array array to determine the size of
52 *
53 * Returns the size of @array in array elements.
54 */
55#define sizeof_array(array) \
56 (sizeof(array) / sizeof((array)[0]))
57
58#define TPRINTF(format, ...) \
59 do { \
60 if (!test_quiet) { \
61 fprintf(stdout, (format), ##__VA_ARGS__); \
62 } \
63 } while (0)
64
65#define TSTACKTRACE() \
66 do { \
67 if (!test_quiet) { \
68 stacktrace_print(); \
69 } \
70 } while (0)
71
72#define S(x) #x
73#define S_(x) S(x)
74#define S__LINE__ S_(__LINE__)
75
76#define TASSERT(expr) \
77 do { \
78 if (!(expr)) \
79 return "Failed " #expr " " __FILE__ ":" S__LINE__ ; \
80 } while (0)
81
82
83typedef const char *(*test_entry_t)(void);
84
85typedef struct {
86 const char *name;
87 const char *desc;
88 test_entry_t entry;
89 bool safe;
90} test_t;
91
92extern const char *test_thread1(void);
93extern const char *test_setjmp1(void);
94extern const char *test_print1(void);
95extern const char *test_print2(void);
96extern const char *test_print3(void);
97extern const char *test_print4(void);
98extern const char *test_print5(void);
99extern const char *test_print6(void);
100extern const char *test_console1(void);
101extern const char *test_stdio1(void);
102extern const char *test_stdio2(void);
103extern const char *test_logger1(void);
104extern const char *test_logger2(void);
105extern const char *test_fault1(void);
106extern const char *test_fault2(void);
107extern const char *test_fault3(void);
108extern const char *test_float1(void);
109extern const char *test_float2(void);
110extern const char *test_vfs1(void);
111extern const char *test_ping_pong(void);
112extern const char *test_sharein(void);
113extern const char *test_starve_ipc(void);
114extern const char *test_loop1(void);
115extern const char *test_malloc1(void);
116extern const char *test_malloc2(void);
117extern const char *test_malloc3(void);
118extern const char *test_mapping1(void);
119extern const char *test_pager1(void);
120extern const char *test_serial1(void);
121extern const char *test_devman1(void);
122extern const char *test_devman2(void);
123extern const char *test_chardev1(void);
124extern const char *test_proc_dummy_task(void);
125extern const char *test_proc_task_anywait(void);
126extern const char *test_proc_task_wait(void);
127
128extern test_t tests[];
129
130#endif
131
132/** @}
133 */
Note: See TracBrowser for help on using the repository browser.