From 548a225fb616ee66afb8411f282d44148f67898c Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Thu, 30 Mar 2023 13:55:48 +0200 Subject: test: moving shareable function in a separate file --- tests/unit/testutil.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/unit/testutil.h (limited to 'tests/unit/testutil.h') diff --git a/tests/unit/testutil.h b/tests/unit/testutil.h new file mode 100644 index 0000000..896d690 --- /dev/null +++ b/tests/unit/testutil.h @@ -0,0 +1,45 @@ +#ifndef TESTUTIL_H +#define TESTUTIL_H + +#include +#include +#include +#include + +#include + +#define STACK_SIZE (1024 * 1024 / 8) + +struct args_target { + long ret; + int err; + bool check_fd; + bool open_path; + int fd; + int nr; + void *args[6]; + int (*install_filter)(struct args_target *at); +}; + +extern struct seccomp_notif req; +extern int notifyfd; +extern struct args_target *at; +extern int pipefd[2]; +extern pid_t pid; +extern char path[100]; + +extern uint16_t tmp_data[TMP_DATA_SIZE]; + +int target(); +pid_t do_clone(int (*fn)(void *), void *arg); +int create_test_fd(); +int get_fd_notifier(pid_t pid); +void target_exit(); +void check_target_fd(int pid, int fd); +bool has_fd(int pid, int fd); +void check_target_result(long ret, int err, bool ignore_ret); +void setup(); +void teardown(); +int install_notification_filter(struct args_target *at); + +#endif /* TESTUTIL_H */ -- cgit v1.2.3