commit: f9190a434c90371c075f9c297dd901fa67a97e4e
parent 4869d5dee59d4b44970c94e93409a22df27506b4
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 26 Aug 2024 10:16:53 +0200
check-libs.sh: replace Kyua
Diffstat:
4 files changed, 38 insertions(+), 20 deletions(-)
diff --git a/Kyuafile b/Kyuafile
@@ -5,4 +5,3 @@ syntax(2)
test_suite("utils-std")
include("test-cmd/Kyuafile")
-include("test-lib/Kyuafile")
diff --git a/Makefile b/Makefile
@@ -22,17 +22,21 @@ all: $(EXE) $(MAN1SO)
# selfcheck: Check without extra dependencies
.PHONY: selfcheck
-selfcheck: selfcheck-cmds
+selfcheck: selfcheck-cmds selfcheck-libs
.PHONY: selfcheck-cmds
selfcheck-cmds: $(EXE)
./check-cmds.sh
+.PHONY: selfcheck-libs
+TEST_LIBS = test-lib/mode test-lib/strtodur test-lib/symbolize_mode test-lib/truncation test-lib/sha1
+selfcheck-libs: $(TEST_LIBS)
+ ./check-libs.sh $(TEST_LIBS)
+
# Manpages with examples that cram/prysk can grok
MAN_EXAMPLES = cmd/readlink.1
-TEST_LIBS = test-lib/mode test-lib/strtodur test-lib/symbolize_mode test-lib/truncation test-lib/sha1
.PHONY: check
-check: all $(TEST_LIBS) check-man
+check: all check-man selfcheck-libs
LDSTATIC=$(LDSTATIC) kyua test || (kyua report --verbose --results-filter=broken,failed; false)
MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 LC_ALL=C.UTF-8 $(CRAM) test-cmd/*.t ${MAN_EXAMPLES}
@@ -44,10 +48,6 @@ check_status:
check-man:
err=0; for i in $(EXE); do if test ! '(' -f $$i.1 -o -f $$i.1.in ')'; then echo "$$i.1: missing manpage"; err=1; fi; done; exit $$err
-.PHONY: check-libs
-check-libs: $(TEST_LIBS)
- MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 LDSTATIC=$(LDSTATIC) kyua test test-lib/ || (kyua report --verbose --results-filter=broken,failed; false)
-
.PHONY: lint
lint: $(MAN1SO)
$(MANDOC) -Tlint -Wunsupp,error,warning $(MAN1)
diff --git a/check-libs.sh b/check-libs.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+# SPDX-License-Identifier: MPL-2.0
+
+set -o pipefail
+
+WD="$(realpath "$(dirname "$0")")/"
+log="${WD}/check-libs.log"
+err=0
+. "${WD}/check-funcs.sh"
+
+cd "$WD"
+
+rm "$log"
+
+if [ "$#" -gt 0 ]
+then
+ for runner
+ do
+ wrap_test "$runner"
+ done
+else
+ for src in test-lib/*.c
+ do
+ runner="${src%.c}"
+ wrap_test "$runner"
+ done
+fi
+
+[ $err = 0 ] && rm "$log"
+exit $err
diff --git a/test-lib/Kyuafile b/test-lib/Kyuafile
@@ -1,12 +0,0 @@
--- SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
--- SPDX-License-Identifier: MPL-2.0
-syntax(2)
-
-test_suite("utils-std libs")
-
--- 7,$|LC_ALL=C.UTF-8 sort
-tap_test_program{name="mode"}
-tap_test_program{name="sha1"}
-tap_test_program{name="strtodur"}
-tap_test_program{name="symbolize_mode"}
-tap_test_program{name="truncation"}