1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2012 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
27 TST_SUCCESS
, /* Test succedded */
28 TST_SKIPPED
, /* Test skipped due to not enough memory, ENOSYS ... */
29 TST_UNTESTED
, /* Test not finished because of failure */
30 TST_INTERR
, /* Test framework error, do not use */
31 TST_SIGSEGV
, /* Test ended with SIGSEGV */
32 TST_TIMEOUT
, /* Test hasn't finished in time */
33 TST_ABORTED
, /* The abort() was called (possible double free) */
34 TST_FPE
, /* Floating point exception */
35 TST_MEMLEAK
, /* Memory leak was detected */
36 TST_FAILED
, /* Test failed */
37 TST_MAX
= TST_FAILED
+1,
42 * Create teporary directory and set it as CWD and
43 * clean it after the test is finised.
48 * Check malloc for memory leaks.
50 TST_CHECK_MALLOC
= 0x02,
53 * Enable malloc canaries. Executes test twice, allocating PROT_NONE
54 * page first before, then after the allocated buffer.
56 * Implies TST_CHECK_MALLOC.
58 TST_MALLOC_CANARIES
= 0x06,
65 * Resurce path, file or directory which is copied to
66 * test directory before test is executed.
70 * If not zero, the test is benchmark.
72 * The test_fn is executed bench_iter times and bench
75 unsigned int bench_iter
;
80 /* test private data pointer */
83 /* time limit in seconds 0 == unlimited */
90 const char *suite_name
;
92 struct tst_test tests
[];
98 void tst_run_suite(const struct tst_suite
*suite
, const char *tst_name
);
101 * Lists all suite tests.
103 void tst_list_suite(const struct tst_suite
*suite
);
106 * Printf-like reporting function.
108 enum tst_report_type
{
114 /* general report function - do not use */
115 int tst_report(int level
, const char *fmt
, ...)
116 __attribute__ ((format (printf
, 2, 3)));
118 /* informative message */
119 int tst_msg(const char *fmt
, ...)
120 __attribute__ ((format (printf
, 1, 2)));
123 * Warning and Error are used in test framework to distinguish the type of test
124 * internal problem. You shouldn't use this one unless the test exited with
127 int tst_warn(const char *fmt
, ...)
128 __attribute__ ((format (printf
, 1, 2)));
130 int tst_err(const char *fmt
, ...)
131 __attribute__ ((format (printf
, 1, 2)));
134 * Translates errno number into short string, i.e. EFOO
136 const char *tst_strerr(int err
);
138 #endif /* TST_TEST_H */