@@ -39,10 +39,12 @@ static inline int clone3(struct clone_args *args, size_t size)
static inline void clone3_supported_by_kernel(void)
{
+ long ret;
+
if ((tst_kvercmp(5, 3, 0)) < 0) {
/* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_clone3, NULL, 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
+ ret = syscall(__NR_clone3, NULL, 0);
+ if (ret == -1 && errno == ENOSYS)
tst_brk(TCONF, "Test not supported on kernel version < v5.3");
}
}
@@ -133,12 +133,14 @@ enum fsconfig_command {
static inline void fsopen_supported_by_kernel(void)
{
+ long ret;
+
if ((tst_kvercmp(5, 2, 0)) < 0) {
/* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_fsopen, NULL, 0));
- if (TST_RET != -1)
- SAFE_CLOSE(TST_RET);
- else if (TST_ERR == ENOSYS)
+ ret = syscall(__NR_fsopen, NULL, 0);
+ if (ret != -1)
+ SAFE_CLOSE(ret);
+ else if (errno == ENOSYS)
tst_brk(TCONF, "Test not supported on kernel version < v5.2");
}
}
@@ -24,10 +24,12 @@ static inline int finit_module(int fd, const char *param_values, int flags)
static inline void finit_module_supported_by_kernel(void)
{
+ long ret;
+
if ((tst_kvercmp(3, 8, 0)) < 0) {
/* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_finit_module, 0, "", 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
+ ret = syscall(__NR_finit_module, 0, "", 0);
+ if (ret == -1 && errno == ENOSYS)
tst_brk(TCONF, "Test not supported on kernel version < v3.8");
}
}
@@ -296,11 +296,12 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
static inline void io_uring_setup_supported_by_kernel(void)
{
+ long ret;
if ((tst_kvercmp(5, 1, 0)) < 0) {
- TEST(syscall(__NR_io_uring_setup, NULL, 0));
- if (TST_RET != -1)
- SAFE_CLOSE(TST_RET);
- else if (TST_ERR == ENOSYS)
+ ret = syscall(__NR_io_uring_setup, NULL, 0);
+ if (ret != -1)
+ SAFE_CLOSE(ret);
+ else if (errno == ENOSYS)
tst_brk(TCONF,
"Test not supported on kernel version < v5.1");
}
@@ -34,6 +34,7 @@ static inline int open_by_handle_at(int mount_fd, struct file_handle *handle,
static inline struct file_handle *
allocate_file_handle(int dfd, const char *pathname)
{
+ long ret;
struct file_handle fh = {}, *fhp;
int mount_id;
@@ -41,9 +42,9 @@ allocate_file_handle(int dfd, const char *pathname)
* Make an initial call to name_to_handle_at() to discover the size
* required for the file handle.
*/
- TEST(name_to_handle_at(dfd, pathname, &fh, &mount_id, 0));
- if (TST_RET != -1 || TST_ERR != EOVERFLOW) {
- tst_res(TFAIL | TTERRNO,
+ ret = name_to_handle_at(dfd, pathname, &fh, &mount_id, 0);
+ if (ret != -1 || errno != EOVERFLOW) {
+ tst_res(TFAIL | TERRNO,
"name_to_handle_at() should fail with EOVERFLOW");
return NULL;
}
@@ -62,10 +62,12 @@ struct open_how_pad {
static inline void openat2_supported_by_kernel(void)
{
+ long ret;
+
if ((tst_kvercmp(5, 6, 0)) < 0) {
/* Check if the syscall is backported on an older kernel */
- TEST(syscall(__NR_openat2, -1, NULL, NULL, 0));
- if (TST_RET == -1 && TST_ERR == ENOSYS)
+ ret = syscall(__NR_openat2, -1, NULL, NULL, 0);
+ if (ret == -1 && errno == ENOSYS)
tst_brk(TCONF, "Test not supported on kernel version < v5.6");
}
}
Technically the headers are part of the test translation unit. However we think of them as being part of the API. So we should also remove TEST from here. Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com> Suggested-by: Li Wang <liwang@redhat.com> --- include/lapi/clone.h | 6 ++++-- include/lapi/fsmount.h | 10 ++++++---- include/lapi/init_module.h | 6 ++++-- include/lapi/io_uring.h | 9 +++++---- include/lapi/name_to_handle_at.h | 7 ++++--- include/lapi/openat2.h | 6 ++++-- 6 files changed, 27 insertions(+), 17 deletions(-)