diff options
author | Manuel Bentele | 2020-10-23 15:18:01 +0200 |
---|---|---|
committer | Manuel Bentele | 2020-10-23 15:18:01 +0200 |
commit | dbb41ce2b7f309d394054a6bd1e33afd578798a5 (patch) | |
tree | 6a31092063d9f2fb5ac5720ec6759040e793c3d5 /src/kernel/tests/include/tst_assert.h | |
parent | Set Linux kernel version to unknown if it is not detectable (diff) | |
download | xloop-dbb41ce2b7f309d394054a6bd1e33afd578798a5.tar.gz xloop-dbb41ce2b7f309d394054a6bd1e33afd578798a5.tar.xz xloop-dbb41ce2b7f309d394054a6bd1e33afd578798a5.zip |
Move the source code of all xloop components to the common 'src' directory
Diffstat (limited to 'src/kernel/tests/include/tst_assert.h')
-rw-r--r-- | src/kernel/tests/include/tst_assert.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/kernel/tests/include/tst_assert.h b/src/kernel/tests/include/tst_assert.h new file mode 100644 index 0000000..dcb62df --- /dev/null +++ b/src/kernel/tests/include/tst_assert.h @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. + * Author: Yang Xu <xuyang2018.jy@cn.fujitsu.com> + * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz> + */ +#ifndef TST_ASSERT_H__ +#define TST_ASSERT_H__ + +#define TST_ASSERT_INT(path, val) \ + tst_assert_int(__FILE__, __LINE__, path, val) + +/* + * Asserts that integer value stored in file pointed by path equals to the + * value passed to this function. This is mostly useful for asserting correct + * values in sysfs, procfs, etc. + */ +void tst_assert_int(const char *file, const int lineno, + const char *path, int val); + +#define TST_ASSERT_FILE_INT(path, prefix, val) \ + tst_assert_file_int(__FILE__, __LINE__, path, prefix, val) + +/* + * Same as tst_assert_int() but for unsigned long. + */ +void tst_assert_ulong(const char *file, const int lineno, + const char *path, unsigned long val); + +#define TST_ASSERT_ULONG(path, val) \ + tst_assert_ulong(__FILE__, __LINE__, path, val) + +/* + * Asserts that integer value stored in the prefix field of file pointed by path + * equals to the value passed to this function. This is mostly useful for + * asserting correct field values in sysfs, procfs, etc. + */ + +void tst_assert_file_int(const char *file, const int lineno, + const char *path, const char *prefix, int val); + + +#define TST_ASSERT_STR(path, val) \ + tst_assert_str(__FILE__, __LINE__, path, val) + +/* + * Asserts that a string value stored in file pointed by path equals to the + * value passed to this function. This is mostly useful for asserting correct + * values in sysfs, procfs, etc. + */ +void tst_assert_str(const char *file, const int lineno, + const char *path, const char *val); + +#define TST_ASSERT_FILE_STR(path, prefix, val) \ + tst_assert_file_str(__FILE__, __LINE__, path, prefix, val) + +/* + * Asserts that a string value stored in the prefix field of file pointed by path + * equals to the value passed to this function. This is mostly useful for + * asserting correct field values in sysfs, procfs, etc. + */ +void tst_assert_file_str(const char *file, const int lineno, + const char *path, const char *prefix, const char *val); + +#endif /* TST_ASSERT_H__ */ |