summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Yudaken <dylany@fb.com>2022-04-22 09:01:31 -0700
committerJens Axboe <axboe@kernel.dk>2022-04-22 11:18:08 -0600
commit6480f692d62afbebb088febc369b30a63dbc2ea7 (patch)
treea3eae0d875de8823317cb770b66f7ef972ab2472
parentfddf8e6fd0ec06ca84a1d6a769dbd891e7cdaf08 (diff)
downloadliburing-6480f692d62afbebb088febc369b30a63dbc2ea7.tar.gz
liburing-6480f692d62afbebb088febc369b30a63dbc2ea7.tar.bz2
test: add make targets for each test
Add a make target runtests-parallel which can run tests in parallel. This is very useful to quickly run all the tests locally with $ make -j runtests-parallel Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-7-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--Makefile2
-rw-r--r--test/Makefile10
-rwxr-xr-xtest/runtests-quiet.sh11
3 files changed, 22 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 28c0fd8..d54551e 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,8 @@ runtests: all
@$(MAKE) -C test runtests
runtests-loop:
@$(MAKE) -C test runtests-loop
+runtests-parallel:
+ @$(MAKE) -C test runtests-parallel
config-host.mak: configure
@if [ ! -e "$@" ]; then \
diff --git a/test/Makefile b/test/Makefile
index cb7e15e..fe35ff9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -185,6 +185,7 @@ all_targets += sq-full-cpp.t
test_targets := $(patsubst %.c,%,$(test_srcs))
test_targets := $(patsubst %.cc,%,$(test_targets))
+run_test_targets := $(patsubst %,%.run_test,$(test_targets))
test_targets := $(patsubst %,%.t,$(test_targets))
all_targets += $(test_targets)
@@ -229,4 +230,11 @@ runtests: all
runtests-loop: all
@./runtests-loop.sh $(test_targets)
-.PHONY: all install clean runtests runtests-loop
+%.run_test: %.t
+ @./runtests-quiet.sh $<
+
+runtests-parallel: $(run_test_targets)
+ @echo "All tests passed"
+
+.PHONY: all install clean runtests runtests-loop runtests-parallel
+.PHONY += $(run_test_targets)
diff --git a/test/runtests-quiet.sh b/test/runtests-quiet.sh
new file mode 100755
index 0000000..438a00a
--- /dev/null
+++ b/test/runtests-quiet.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+TESTS=("$@")
+RESULT_FILE=$(mktemp)
+./runtests.sh "${TESTS[@]}" 2>&1 > $RESULT_FILE
+RET="$?"
+if [ "${RET}" -ne 0 ]; then
+ cat $RESULT_FILE
+fi
+rm $RESULT_FILE
+exit $RET