From 3075417ef81042f0bdf6b36140870789c00faf95 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 23 Nov 2022 21:32:10 +0100 Subject: [PATCH] Add a simple test runner to zig-out/bin/ --- build.zig | 1 + test/default/Makefile.am | 1 + test/default/run.sh | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100755 test/default/run.sh diff --git a/build.zig b/build.zig index a1e819fe..9c621c53 100644 --- a/build.zig +++ b/build.zig @@ -99,6 +99,7 @@ pub fn build(b: *std.build.Builder) !void { const test_dir = try fs.Dir.openIterableDir(fs.cwd(), test_path, .{ .no_follow = true }); fs.Dir.makePath(fs.cwd(), out_bin_path) catch {}; const out_bin_dir = try fs.Dir.openDir(fs.cwd(), out_bin_path, .{}); + try test_dir.dir.copyFile("run.sh", out_bin_dir, "run.sh", .{}); var allocator = heap.page_allocator; var walker = try test_dir.walk(allocator); while (try walker.next()) |entry| { diff --git a/test/default/Makefile.am b/test/default/Makefile.am index 12aa7eb4..d319160d 100644 --- a/test/default/Makefile.am +++ b/test/default/Makefile.am @@ -1,5 +1,6 @@ EXTRA_DIST = \ + run.sh \ cmptest.h \ wasi-test-wrapper.sh \ wintest.bat \ diff --git a/test/default/run.sh b/test/default/run.sh new file mode 100755 index 00000000..9e792b50 --- /dev/null +++ b/test/default/run.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +find . -type f -perm +100 -print | grep -v run.sh | sort | while read -r x; do + echo "[$x]" + if ! "$x"; then + echo "*** [$x] FAILED" >&2 + exit 1 + fi +done