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>
Patrick Steinhardt committed
Dec 27, 2024 at 14:59 UTC
d8af27d309c3637d05bd6b4957b3667c04dc861e
2 files changed
+8
-5
t/.gitignore
+1
@@ -2,4 +2,5 @@
2
/test-results
3
/.prove
4
/chainlinttmp
5
+/mesontmp
6
/out/
t/Makefile
+7
-5
@@ -103,6 +103,7 @@ clean-except-prove-cache: clean-chainlint
103
104
clean: clean-except-prove-cache
105
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
106
+ $(RM) -r mesontmp
107
$(RM) .prove
108
109
clean-chainlint:
@@ -116,16 +117,17 @@ check-chainlint:
117
118
check-meson:
119
@# awk acts up when trying to match single quotes, so we use \047 instead.
119
- @printf "%s\n" \
120
+ @mkdir -p mesontmp && \
121
+ printf "%s\n" \
122
"integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \
123
"unit_test_programs unit-tests/t-*.c" \
124
"clar_test_suites unit-tests/u-*.c" | \
125
while read -r variable pattern; do \
124
- meson_tests=$$(awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build) && \
125
- actual_tests=$$(ls $$pattern) && \
126
- if test "$$meson_tests" != "$$actual_tests"; then \
126
+ awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build >mesontmp/meson.txt && \
127
+ ls $$pattern >mesontmp/actual.txt && \
128
+ if ! cmp mesontmp/meson.txt mesontmp/actual.txt; then \
129
echo "Meson tests differ from actual tests:"; \
128
- diff -u <(echo "$$meson_tests") <(echo "$$actual_tests"); \
130
+ diff -u mesontmp/meson.txt mesontmp/actual.txt; \
131
exit 1; \
132
fi; \
133
done