]> git.draconx.ca Git - cdecl99.git/commitdiff
Simplify and improve randomdecl sanity test.
authorNick Bowler <nbowler@draconx.ca>
Wed, 9 Feb 2022 04:34:17 +0000 (23:34 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 9 Feb 2022 08:17:41 +0000 (03:17 -0500)
We don't need to do any weird shell variable stuff here, we can just
directly compute the expected output and verify against that.  As a
bonus, when the test fails this gives a much better description of
which expected forms are missing in the testsuite log.

tests/stress.at

index 77c0d20a1250646aab6c121c100b5930c9126f3c..991ce992bfa026745bd03200bb2c4f62185a4e3c 100644 (file)
@@ -59,24 +59,14 @@ m4_define([sanity_tests], [dnl
 ])
 
 m4_define([sanity_sed], [/$1/i\
-AS_TR_SH([$2])=:])
-AT_DATA([sanity.sed], [#n
+FOUND $2])AT_DATA([sanity.sed], [#n
 m4_map_sep([sanity_sed], [m4_newline], [sanity_tests])
 ])
+sed -n '/^FOUND/p' sanity.sed | LC_ALL=C sort -u >expout
 
 printf 'Using seed %d\n' "$random_seed" >&AS_MESSAGE_LOG_FD
-AT_CHECK([randomdecl -En 10000 -s "$random_seed" >decls], [0], [ignore-nolog])
-AT_CHECK([sed -f sanity.sed decls], [0], [stdout-nolog])
-sort -u stdout >decls.chk
-
-exec 3<decls.chk
-while read var <&3; do
-  eval "$var"
-done
-exec 3<&-
-
-m4_define([sanity_check], [AT_CHECK([$AS_TR_SH([$2]) false])])
-m4_map([sanity_check], [sanity_tests])
+AT_CHECK([randomdecl -En 10000 -s "$random_seed" >decls], [0])
+AT_CHECK([sed -f sanity.sed decls | LC_ALL=C sort -u], [0], [expout])
 
 AT_CLEANUP