diff options
author | rillig <rillig@pkgsrc.org> | 2020-03-21 13:30:35 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-03-21 13:30:35 +0000 |
commit | b7fc8ee7993661b47b31ff3252e85c6a6449a7fe (patch) | |
tree | abd0ac091a6eec767682cf104eeac95335022dff /regress | |
parent | eca46fc85b409a5364189564c4863d72fbd41760 (diff) | |
download | pkgsrc-b7fc8ee7993661b47b31ff3252e85c6a6449a7fe.tar.gz |
mk/subst.mk: add global SUBST_SHOW_DIFF variable
This is useful in bulk builds or when trying to understand what happens
under the hood, since the SUBST code leaves no .orig files around.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/infra-unittests/subst.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/regress/infra-unittests/subst.sh b/regress/infra-unittests/subst.sh index 7fe2ed26e51..053d3835d8b 100644 --- a/regress/infra-unittests/subst.sh +++ b/regress/infra-unittests/subst.sh @@ -627,3 +627,44 @@ EOF test_case_end fi + + +if test_case_begin "global show diff"; then + + create_file_lines "file" "one" "two" "three" + + create_file "testcase.mk" <<EOF +SUBST_CLASSES+= two +SUBST_STAGE.two= pre-configure +SUBST_FILES.two= file +SUBST_SED.two= -e 's,two,II,' +SUBST_SHOW_DIFF= yes + +.include "prepare-subst.mk" +.include "mk/subst.mk" +EOF + + LC_ALL=C \ + test_file "testcase.mk" "pre-configure" \ + 1> "$tmpdir/stdout" \ + 2> "$tmpdir/stderr" \ + && exitcode=0 || exitcode=$? + + awk '{ if (/^... \.\/.*/) { print $1 " " $2 " (filtered timestamp)" } else { print $0 } }' \ + < "$tmpdir/stdout" > "$tmpdir/stdout-filtered" + + assert_that "file" --file-is-lines "one" "II" "three" + assert_that "stdout-filtered" --file-is-lines \ + "=> Substituting \"two\" in file" \ + "--- ./file (filtered timestamp)" \ + "+++ ./file.subst.sav (filtered timestamp)" \ + "@@ -1,3 +1,3 @@" \ + " one" \ + "-two" \ + "+II" \ + " three" + assert_that "stderr" --file-is-empty + assert_that "$exitcode" --equals 0 + + test_case_end +fi |