OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TEST_RUNNER_H__ | 5 #ifndef TEST_RUNNER_H__ |
6 #define TEST_RUNNER_H__ | 6 #define TEST_RUNNER_H__ |
7 | 7 |
| 8 #include <errno.h> |
| 9 #include <stdio.h> |
| 10 |
8 | 11 |
9 void intend_exit_status(int val, bool is_signal); | 12 void intend_exit_status(int val, bool is_signal); |
10 void add_test_case(const char *test_name, void (*test_func)()); | 13 void add_test_case(const char *test_name, void (*test_func)()); |
11 | 14 |
12 | 15 |
13 #define TEST(name) \ | 16 #define TEST(name) \ |
14 void name(); \ | 17 void name(); \ |
15 static void __attribute__((constructor)) add_##name() { \ | 18 static void __attribute__((constructor)) add_##name() { \ |
16 add_test_case(#name, name); \ | 19 add_test_case(#name, name); \ |
17 } \ | 20 } \ |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr, \ | 86 __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr, \ |
84 strerror_r(exp_errno, errmsg1, sizeof(errmsg1)), \ | 87 strerror_r(exp_errno, errmsg1, sizeof(errmsg1)), \ |
85 strerror_r(errno, errmsg2, sizeof(errmsg2))); \ | 88 strerror_r(errno, errmsg2, sizeof(errmsg2))); \ |
86 _exit(1); \ | 89 _exit(1); \ |
87 } \ | 90 } \ |
88 check_res; \ | 91 check_res; \ |
89 }) | 92 }) |
90 | 93 |
91 | 94 |
92 #endif | 95 #endif |
OLD | NEW |