From 220d53a4d872e4965a46a6dc90f71e40f6ded3d8 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 22 Apr 2024 23:48:07 +0200 Subject: Add tests --- tests/a.out | Bin 0 -> 15872 bytes tests/log | 0 tests/openat.c | 26 ++++++++++++++++++++++++++ tests/testfile | 4 ++++ 4 files changed, 30 insertions(+) create mode 100755 tests/a.out create mode 100644 tests/log create mode 100644 tests/openat.c create mode 100644 tests/testfile diff --git a/tests/a.out b/tests/a.out new file mode 100755 index 0000000..f601367 Binary files /dev/null and b/tests/a.out differ diff --git a/tests/log b/tests/log new file mode 100644 index 0000000..e69de29 diff --git a/tests/openat.c b/tests/openat.c new file mode 100644 index 0000000..62628cc --- /dev/null +++ b/tests/openat.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) { + printf("PID: %d\n", getpid()); + + int ret = syscall(SYS_openat, -100, "testfile", O_RDWR); + printf("Openat ret: %d\n", ret); + + if (ret == -1) { + printf("Opneat error: %s\n", strerror(errno)); + } + + ret = syscall(SYS_write, ret, "writing this :)", 14); + printf("Write ret: %d\n", ret); + + if (ret == -1) { + printf("Write error: %s\n", strerror(errno)); + } + + return 0; +} diff --git a/tests/testfile b/tests/testfile new file mode 100644 index 0000000..f4ce76f --- /dev/null +++ b/tests/testfile @@ -0,0 +1,4 @@ +writing this :t file + + +I have multiple lines :) -- cgit 1.4.1