xref: /aosp_15_r20/external/flashrom/tests/include/test.h (revision 0d6140be3aa665ecc836e8907834fcd3e3b018fc)
1 /*
2  * This file is part of the flashrom project.
3  *
4  * Copyright 2020 Google LLC
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15 
16 #ifndef _TESTS_TEST_H
17 #define _TESTS_TEST_H
18 
19 /*
20  * Standard test header that should be included in all tests. For now it just encapsulates the
21  * include dependencies for Cmocka. Test-specific APIs that are so generic we would want them
22  * available everywhere could also be added here.
23  */
24 
25 #include <stdarg.h>
26 #include <stddef.h>
27 #include <setjmp.h>
28 #include <cmocka.h>
29 
30 #define NON_ZERO (0xf000baaa)
31 
32 #define MOCK_FD (0x10ec)
33 
34 #define SKIP_TEST(name) \
35 	void name (void **state) { skip(); }
36 
37 #define LOCK_FILE "/run/lock/firmware_utility_lock"
38 #define SUSPEND_ANNOUNCED_FILE "/run/power_manager/power/suspend_announced"
39 
40 /*
41  * Having this as function allows to set a breakpoint on the address,
42  * as it has a named symbol associated with the address number.
43  */
44 void *not_null(void);
45 
46 #define LOG_ME printf("%s is called\n", __func__)
47 
48 #endif /* _TESTS_TEST_H */
49