1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later 2*49cdfc7eSAndroid Build Coastguard Worker /* 3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. 4*49cdfc7eSAndroid Build Coastguard Worker * Author: Yang Xu <[email protected]> 5*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2020 Cyril Hrubis <[email protected]> 6*49cdfc7eSAndroid Build Coastguard Worker */ 7*49cdfc7eSAndroid Build Coastguard Worker #ifndef TST_ASSERT_H__ 8*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_H__ 9*49cdfc7eSAndroid Build Coastguard Worker 10*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_INT(path, val) \ 11*49cdfc7eSAndroid Build Coastguard Worker tst_assert_int(__FILE__, __LINE__, path, val) 12*49cdfc7eSAndroid Build Coastguard Worker 13*49cdfc7eSAndroid Build Coastguard Worker /* 14*49cdfc7eSAndroid Build Coastguard Worker * Asserts that integer value stored in file pointed by path equals to the 15*49cdfc7eSAndroid Build Coastguard Worker * value passed to this function. This is mostly useful for asserting correct 16*49cdfc7eSAndroid Build Coastguard Worker * values in sysfs, procfs, etc. 17*49cdfc7eSAndroid Build Coastguard Worker */ 18*49cdfc7eSAndroid Build Coastguard Worker void tst_assert_int(const char *file, const int lineno, 19*49cdfc7eSAndroid Build Coastguard Worker const char *path, int val); 20*49cdfc7eSAndroid Build Coastguard Worker 21*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_FILE_INT(path, prefix, val) \ 22*49cdfc7eSAndroid Build Coastguard Worker tst_assert_file_int(__FILE__, __LINE__, path, prefix, val) 23*49cdfc7eSAndroid Build Coastguard Worker 24*49cdfc7eSAndroid Build Coastguard Worker /* 25*49cdfc7eSAndroid Build Coastguard Worker * Same as tst_assert_int() but for unsigned long. 26*49cdfc7eSAndroid Build Coastguard Worker */ 27*49cdfc7eSAndroid Build Coastguard Worker void tst_assert_ulong(const char *file, const int lineno, 28*49cdfc7eSAndroid Build Coastguard Worker const char *path, unsigned long val); 29*49cdfc7eSAndroid Build Coastguard Worker 30*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_ULONG(path, val) \ 31*49cdfc7eSAndroid Build Coastguard Worker tst_assert_ulong(__FILE__, __LINE__, path, val) 32*49cdfc7eSAndroid Build Coastguard Worker 33*49cdfc7eSAndroid Build Coastguard Worker /* 34*49cdfc7eSAndroid Build Coastguard Worker * Asserts that integer value stored in the prefix field of file pointed by path 35*49cdfc7eSAndroid Build Coastguard Worker * equals to the value passed to this function. This is mostly useful for 36*49cdfc7eSAndroid Build Coastguard Worker * asserting correct field values in sysfs, procfs, etc. 37*49cdfc7eSAndroid Build Coastguard Worker */ 38*49cdfc7eSAndroid Build Coastguard Worker 39*49cdfc7eSAndroid Build Coastguard Worker void tst_assert_file_int(const char *file, const int lineno, 40*49cdfc7eSAndroid Build Coastguard Worker const char *path, const char *prefix, int val); 41*49cdfc7eSAndroid Build Coastguard Worker 42*49cdfc7eSAndroid Build Coastguard Worker 43*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_STR(path, val) \ 44*49cdfc7eSAndroid Build Coastguard Worker tst_assert_str(__FILE__, __LINE__, path, val) 45*49cdfc7eSAndroid Build Coastguard Worker 46*49cdfc7eSAndroid Build Coastguard Worker /* 47*49cdfc7eSAndroid Build Coastguard Worker * Asserts that a string value stored in file pointed by path equals to the 48*49cdfc7eSAndroid Build Coastguard Worker * value passed to this function. This is mostly useful for asserting correct 49*49cdfc7eSAndroid Build Coastguard Worker * values in sysfs, procfs, etc. 50*49cdfc7eSAndroid Build Coastguard Worker */ 51*49cdfc7eSAndroid Build Coastguard Worker void tst_assert_str(const char *file, const int lineno, 52*49cdfc7eSAndroid Build Coastguard Worker const char *path, const char *val); 53*49cdfc7eSAndroid Build Coastguard Worker 54*49cdfc7eSAndroid Build Coastguard Worker #define TST_ASSERT_FILE_STR(path, prefix, val) \ 55*49cdfc7eSAndroid Build Coastguard Worker tst_assert_file_str(__FILE__, __LINE__, path, prefix, val) 56*49cdfc7eSAndroid Build Coastguard Worker 57*49cdfc7eSAndroid Build Coastguard Worker /* 58*49cdfc7eSAndroid Build Coastguard Worker * Asserts that a string value stored in the prefix field of file pointed by path 59*49cdfc7eSAndroid Build Coastguard Worker * equals to the value passed to this function. This is mostly useful for 60*49cdfc7eSAndroid Build Coastguard Worker * asserting correct field values in sysfs, procfs, etc. 61*49cdfc7eSAndroid Build Coastguard Worker */ 62*49cdfc7eSAndroid Build Coastguard Worker void tst_assert_file_str(const char *file, const int lineno, 63*49cdfc7eSAndroid Build Coastguard Worker const char *path, const char *prefix, const char *val); 64*49cdfc7eSAndroid Build Coastguard Worker 65*49cdfc7eSAndroid Build Coastguard Worker #endif /* TST_ASSERT_H__ */ 66