commit: 9dcb802048b737c335793e974770991e78a8c16c
parent 54402fec28cb24076b6e2f629affcce94b10ccb7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 13 Jun 2024 13:11:16 +0200
Makefile: Add selfcheck target
Diffstat:
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -20,6 +20,11 @@ all: $(EXE) $(MAN1SO)
$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
$(CC) -std=c99 $(CFLAGS) -c -o $@ $<
+# selfcheck: Check without extra dependencies
+.PHONY: selfcheck
+selfcheck: all
+ ./selfcheck.sh
+
# 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
diff --git a/selfcheck.sh b/selfcheck.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
+# SPDX-License-Identifier: MPL-2.0
+
+set -o pipefail
+
+printf '%s\n' test-cmd/*.sh | while read runner
+do
+ [ "$runner" = "test-cmd/tap.sh" ] && continue
+ echo "${PS4}${runner}"
+ if ! env MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 LC_ALL=C.UTF-8 $runner 2>&1
+ then
+ exit 1
+ fi
+done | tee selfcheck.out | grep -v '^ok'
+
+err=$?
+[ $err = 0 ] && rm selfcheck.out
+exit $err