From d16dfe7d8773f71641f272c588218d0c6cb940ee Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Tue, 18 Aug 2026 21:06:16 -0400 Subject: fw: build clean, and check that it stays that way Two warnings have stood in fw.c since the program was written: warning: fw.c:732 auto declared and not used: buf warning: fw.c:1286 set and not used: m Neither matters on its own -- an unused array in fsread, and an m = nil that the next line overwrites -- but a build that always prints two warnings is a build whose output nobody reads, which is how the next one that does matter goes unnoticed. Both are the sort of thing kencc tells you for free. So the suite now builds the source from clean and asks the compiler whether it had anything to say. Reintroducing the unused array makes it fail with the warning printed under the check, which is what a finding nobody had to look for should look like. It also checks that mk succeeded, since a build that does not run produces no warnings either. Skipped if the source is not on the machine being tested. 48 pass. Co-Authored-By: Claude Opus 5 --- fw/test/fwtest.rc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'fw/test') diff --git a/fw/test/fwtest.rc b/fw/test/fwtest.rc index a7ba4d2..ffbc6b6 100755 --- a/fw/test/fwtest.rc +++ b/fw/test/fwtest.rc @@ -25,6 +25,11 @@ if(! test -x $fw){ exit nofw } +# where the source is, for the build check; skipped if it is not here +src=$2 +if(~ $#src 0) + src=/sys/src/cmd/fw + tmp=/tmp/fwtest.$pid mkdir -p $tmp nA=$tmp/nA @@ -139,6 +144,23 @@ fn nfw { } fwbefore=`{nfw} +echo '== it builds without complaint' +# A warning is a finding nobody had to look for. Two stood in fw.c for +# as long as the program has existed, which is how long it has been +# since anyone read the output of mk. +if(test -d $src){ + if(@{ cd $src && mk clean && mk all } >$tmp/build >[2=1]) + r=ok + if not + r=failed + check 'the source still builds' ok $"r + grep warning $tmp/build > $tmp/why + r=`{grep -c warning $tmp/build} + check 'and the compiler has nothing to say about it' 0 $"r +} +if not + echo ' skip no '^$src^', not checking the build' + echo '== rules: parsing' cat > $tmp/bad.ndb <<'!' -- cgit v1.2.3