1# $NetBSD: Makefile,v 1.142 2024/06/08 09:09:20 rillig Exp $ 2 3NOMAN= # defined 4 5.include <bsd.own.mk> 6 7ARCHSUBDIR!= cd ${NETBSDSRCDIR}/usr.bin/xlint/lint1 && ${MAKE} -v ARCHSUBDIR 8 9TESTSDIR= ${TESTSBASE}/usr.bin/xlint/lint1 10 11TESTS_SH= t_integration t_usage 12TESTS_SH_SRC_t_integration= archsubdir.sh t_integration.sh 13CLEANFILES+= archsubdir.sh 14CLEANFILES+= *.exp 15 16archsubdir.sh: 17 @echo archsubdir=${ARCHSUBDIR} >${.TARGET} 18 19FILESDIR= ${TESTSDIR} 20FILES+= ${:!cd ${.CURDIR} && echo *.c *.exp-ln!} 21FILES+= check-expect.lua 22 23add-test: .PHONY 24 @set -eu; \ 25 test=${NAME:Q}; \ 26 [ "$$test" ] || { \ 27 echo "usage: ${MAKE} add-test NAME=<name>"; \ 28 exit; \ 29 }; \ 30 \ 31 if [ -f "$$test.c" ]; then \ 32 echo "error: test $$test already exists in $$PWD."; \ 33 exit 1; \ 34 fi; \ 35 \ 36 echo "=> Adding test $$test"; \ 37 printf '%s\n' \ 38 '/* $$''NetBSD$$ */' \ 39 "# 3 \"$$test.c\"" \ 40 '' \ 41 '/*' \ 42 ' * TODO: Explain the purpose of the test.' \ 43 ' */' \ 44 '' \ 45 '/* lint1-extra-flags: -Z */' \ 46 '/* lint1-flags: -Z */' \ 47 '/* lint1-only-if: schar uchar ilp32 lp64 int long ldbl64 ldbl96 ldbl128 */' \ 48 '' \ 49 '// TODO: Add some code that passes.' \ 50 '// TODO: Add some code that fails.' \ 51 > "$$test.c"; \ 52 cvs add "$$test.c"; \ 53 ${MAKE} sync-mi 54 55# Note: only works for adding tests. 56# To remove a test, the $$mi file must be edited manually. 57sync-mi: .PHONY 58 @set -eu; \ 59 cd "${MAKEFILE:tA:H}/../../../.."; \ 60 mi="distrib/sets/lists/tests/mi"; \ 61 cvs update "$$mi"; \ 62 fmt="./usr/tests/usr.bin/xlint/lint1/%s\ttests-usr.bin-tests\tcompattestfile,atf\n"; \ 63 cat "$$mi" > "$$mi.tmp"; \ 64 printf "$$fmt" ${FILES} >> "$$mi.tmp"; \ 65 distrib/sets/fmt-list "$$mi.tmp"; \ 66 mv "$$mi.tmp" "$$mi"; \ 67 cvs diff "$$mi" || true 68 69accept: .PHONY 70 @archsubdir=${ARCHSUBDIR:Q} sh ./accept.sh '' 71 72.include <bsd.test.mk> 73