Skip to content

Commit d8af27d

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7a3136e commit d8af27d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

t/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/test-results
33
/.prove
44
/chainlinttmp
5+
/mesontmp
56
/out/

t/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ clean-except-prove-cache: clean-chainlint
103103

104104
clean: clean-except-prove-cache
105105
$(RM) -r '$(TEST_RESULTS_DIRECTORY_SQ)'
106+
$(RM) -r mesontmp
106107
$(RM) .prove
107108

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

117118
check-meson:
118119
@# 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" \
120122
"integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \
121123
"unit_test_programs unit-tests/t-*.c" \
122124
"clar_test_suites unit-tests/u-*.c" | \
123125
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 \
127129
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; \
129131
exit 1; \
130132
fi; \
131133
done

0 commit comments

Comments
 (0)