• 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  * Same as tst_assert_int() but for unsigned long.
26  */
27 void tst_assert_ulong(const char *file, const int lineno,
28                       const char *path, unsigned long val);
29 
30 #define TST_ASSERT_ULONG(path, val) \
31 	tst_assert_ulong(__FILE__, __LINE__, path, val)
32 
33 /*
34  * Asserts that integer value stored in the prefix field of file pointed by path
35  * equals to the value passed to this function. This is mostly useful for
36  * asserting correct field values in sysfs, procfs, etc.
37  */
38 
39 void tst_assert_file_int(const char *file, const int lineno,
40 			 const char *path, const char *prefix, int val);
41 
42 
43 #define TST_ASSERT_STR(path, val) \
44 	tst_assert_str(__FILE__, __LINE__, path, val)
45 
46 /*
47  * Asserts that a string value stored in file pointed by path equals to the
48  * value passed to this function. This is mostly useful for asserting correct
49  * values in sysfs, procfs, etc.
50  */
51 void tst_assert_str(const char *file, const int lineno,
52 		    const char *path, const char *val);
53 
54 #define TST_ASSERT_FILE_STR(path, prefix, val) \
55 	tst_assert_file_str(__FILE__, __LINE__, path, prefix, val)
56 
57 /*
58  * Asserts that a string value stored in the prefix field of file pointed by path
59  * equals to the value passed to this function. This is mostly useful for
60  * asserting correct field values in sysfs, procfs, etc.
61  */
62 void tst_assert_file_str(const char *file, const int lineno,
63 			 const char *path, const char *prefix, const char *val);
64 
65 #endif /* TST_ASSERT_H__ */
66