• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
4  * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
5  * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
6  */
7 #ifndef TST_ASSERT_H__
8 #define TST_ASSERT_H__
9 
10 #define TST_ASSERT_INT(path, val) \
11 	tst_assert_int(__FILE__, __LINE__, path, val)
12 
13 /*
14  * Asserts that integer value stored in file pointed by path equals to the
15  * value passed to this function. This is mostly useful for asserting correct
16  * values in sysfs, procfs, etc.
17  */
18 void tst_assert_int(const char *file, const int lineno,
19 		    const char *path, int val);
20 
21 #define TST_ASSERT_FILE_INT(path, prefix, val) \
22 	tst_assert_file_int(__FILE__, __LINE__, path, prefix, val)
23 
24 /*
25  * Asserts that integer value stored in the prefix field of file pointed by path
26  * equals to the value passed to this function. This is mostly useful for
27  * asserting correct field values in sysfs, procfs, etc.
28  */
29 
30 void tst_assert_file_int(const char *file, const int lineno,
31 			 const char *path, const char *prefix, int val);
32 
33 
34 #define TST_ASSERT_STR(path, val) \
35 	tst_assert_str(__FILE__, __LINE__, path, val)
36 
37 /*
38  * Asserts that a string value stored in file pointed by path equals to the
39  * value passed to this function. This is mostly useful for asserting correct
40  * values in sysfs, procfs, etc.
41  */
42 void tst_assert_str(const char *file, const int lineno,
43 		    const char *path, const char *val);
44 
45 #define TST_ASSERT_FILE_STR(path, prefix, val) \
46 	tst_assert_file_str(__FILE__, __LINE__, path, prefix, val)
47 
48 /*
49  * Asserts that a string value stored in the prefix field of file pointed by path
50  * equals to the value passed to this function. This is mostly useful for
51  * asserting correct field values in sysfs, procfs, etc.
52  */
53 void tst_assert_file_str(const char *file, const int lineno,
54 			 const char *path, const char *prefix, const char *val);
55 
56 #endif /* TST_ASSERT_H__ */
57