t/Makefile: make "check-meson" work with Dash

The "check-meson" target uses process substitution to check whether
extracted contents from "meson.build" match expected contents. Process
substitution is unportable though and thus the target will fail when
using for example Dash.

Fix this by writing data into a temporary directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt 2024-12-27 14:59:39 +01:00 committed by Junio C Hamano
parent 7a3136e5c7
commit d8af27d309
2 changed files with 8 additions and 5 deletions

1
t/.gitignore vendored
View File

@ -2,4 +2,5 @@
/test-results /test-results
/.prove /.prove
/chainlinttmp /chainlinttmp
/mesontmp
/out/ /out/

View File

@ -103,6 +103,7 @@ clean-except-prove-cache: clean-chainlint


clean: clean-except-prove-cache clean: clean-except-prove-cache
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)' $(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
$(RM) -r mesontmp
$(RM) .prove $(RM) .prove


clean-chainlint: clean-chainlint:
@ -116,16 +117,17 @@ check-chainlint:


check-meson: check-meson:
@# awk acts up when trying to match single quotes, so we use \047 instead. @# awk acts up when trying to match single quotes, so we use \047 instead.
@printf "%s\n" \ @mkdir -p mesontmp && \
printf "%s\n" \
"integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \ "integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \
"unit_test_programs unit-tests/t-*.c" \ "unit_test_programs unit-tests/t-*.c" \
"clar_test_suites unit-tests/u-*.c" | \ "clar_test_suites unit-tests/u-*.c" | \
while read -r variable pattern; do \ while read -r variable pattern; do \
meson_tests=$$(awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build) && \ awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build >mesontmp/meson.txt && \
actual_tests=$$(ls $$pattern) && \ ls $$pattern >mesontmp/actual.txt && \
if test "$$meson_tests" != "$$actual_tests"; then \ if ! cmp mesontmp/meson.txt mesontmp/actual.txt; then \
echo "Meson tests differ from actual tests:"; \ echo "Meson tests differ from actual tests:"; \
diff -u <(echo "$$meson_tests") <(echo "$$actual_tests"); \ diff -u mesontmp/meson.txt mesontmp/actual.txt; \
exit 1; \ exit 1; \
fi; \ fi; \
done done