aboutsummaryrefslogtreecommitdiff
path: root/tests/core/sys/kqueue/structs.odin
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-16 13:25:03 +0000
committerGitHub <noreply@github.com>2026-01-16 13:25:03 +0000
commitd46c547264c2be4ff46887d96354e653dbd6069d (patch)
tree245f7cc22efcb64061069321a3671453cbcb78aa /tests/core/sys/kqueue/structs.odin
parenta2fa32a518357aefa11edd0978f48625be7dc9e5 (diff)
parent57d02cb14850e7b241f5ec519ff5e44c6129a5fe (diff)
Merge pull request #6124 from laytan/nbio
Add `core:nbio`
Diffstat (limited to 'tests/core/sys/kqueue/structs.odin')
-rw-r--r--tests/core/sys/kqueue/structs.odin56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/core/sys/kqueue/structs.odin b/tests/core/sys/kqueue/structs.odin
new file mode 100644
index 000000000..edf1fdd1e
--- /dev/null
+++ b/tests/core/sys/kqueue/structs.odin
@@ -0,0 +1,56 @@
+#+build darwin, freebsd, openbsd, netbsd
+package tests_core_sys_kqueue
+
+import "core:strings"
+import "core:testing"
+import os "core:os/os2"
+
+@(test)
+structs :: proc(t: ^testing.T) {
+ {
+ c_compiler := os.get_env("CC", context.temp_allocator)
+ if c_compiler == "" {
+ c_compiler = "clang"
+ }
+
+ c_compilation, c_start_err := os.process_start({
+ command = {c_compiler, #directory + "/structs/structs.c", "-o", #directory + "/structs/c_structs"},
+ stdout = os.stdout,
+ stderr = os.stderr,
+ })
+ testing.expect_value(t, c_start_err, nil)
+
+ o_compilation, o_start_err := os.process_start({
+ command = {ODIN_ROOT + "/odin", "build", #directory + "/structs", "-out:" + #directory + "/structs/odin_structs"},
+ stdout = os.stdout,
+ stderr = os.stderr,
+ })
+ testing.expect_value(t, o_start_err, nil)
+
+ c_status, c_err := os.process_wait(c_compilation)
+ testing.expect_value(t, c_err, nil)
+ testing.expect_value(t, c_status.exit_code, 0)
+
+ o_status, o_err := os.process_wait(o_compilation)
+ testing.expect_value(t, o_err, nil)
+ testing.expect_value(t, o_status.exit_code, 0)
+ }
+
+ c_status, c_stdout, c_stderr, c_err := os.process_exec({command={#directory + "/structs/c_structs"}}, context.temp_allocator)
+ testing.expect_value(t, c_err, nil)
+ testing.expect_value(t, c_status.exit_code, 0)
+ testing.expect_value(t, string(c_stderr), "")
+
+ o_status, o_stdout, o_stderr, o_err := os.process_exec({command={#directory + "/structs/odin_structs"}}, context.temp_allocator)
+ testing.expect_value(t, o_err, nil)
+ testing.expect_value(t, o_status.exit_code, 0)
+ testing.expect_value(t, string(o_stderr), "")
+
+ testing.expect(t, strings.trim_space(string(c_stdout)) != "")
+
+ testing.expect_value(
+ t,
+ strings.trim_space(string(o_stdout)),
+ strings.trim_space(string(c_stdout)),
+ )
+}