| @@ -213,27 +213,27 @@ SUBST_NOOP_OK.class= no | | | @@ -213,27 +213,27 @@ SUBST_NOOP_OK.class= no |
213 | .include "prepare-subst.mk" | | 213 | .include "prepare-subst.mk" |
214 | .include "mk/subst.mk" | | 214 | .include "mk/subst.mk" |
215 | | | 215 | |
216 | all: subst-class | | 216 | all: subst-class |
217 | EOF | | 217 | EOF |
218 | | | 218 | |
219 | create_file_lines "single" "already an example" | | 219 | create_file_lines "single" "already an example" |
220 | | | 220 | |
221 | run_bmake "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$? | | 221 | run_bmake "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$? |
222 | | | 222 | |
223 | create_file_lines "expected-output" \ | | 223 | create_file_lines "expected-output" \ |
224 | '=> Substituting "class" in single' \ | | 224 | '=> Substituting "class" in single' \ |
225 | 'warning: [subst.mk:class] Nothing changed in ./single.' \ | | 225 | 'warning: [subst.mk:class] Nothing changed in ./single.' \ |
226 | 'fail: [subst.mk:class] The pattern single has no effect.' \ | | 226 | 'fail: [subst.mk:class] The filename pattern "single" has no effect.' \ |
227 | '*** Error code 1' \ | | 227 | '*** Error code 1' \ |
228 | '' \ | | 228 | '' \ |
229 | 'Stop.' \ | | 229 | 'Stop.' \ |
230 | "$make: stopped in $PWD" | | 230 | "$make: stopped in $PWD" |
231 | assert_that "actual-output" --file-equals "expected-output" | | 231 | assert_that "actual-output" --file-equals "expected-output" |
232 | assert_that "single" --file-contains-exactly "already an example" | | 232 | assert_that "single" --file-contains-exactly "already an example" |
233 | assert_that "$exitcode" --equals "1" | | 233 | assert_that "$exitcode" --equals "1" |
234 | | | 234 | |
235 | test_case_end | | 235 | test_case_end |
236 | fi | | 236 | fi |
237 | | | 237 | |
238 | | | 238 | |
239 | if test_case_begin "single file nonexistent"; then | | 239 | if test_case_begin "single file nonexistent"; then |
| @@ -246,27 +246,27 @@ SUBST_SED.class= -e 's,file,example,' | | | @@ -246,27 +246,27 @@ SUBST_SED.class= -e 's,file,example,' |
246 | SUBST_NOOP_OK.class= no | | 246 | SUBST_NOOP_OK.class= no |
247 | | | 247 | |
248 | .include "prepare-subst.mk" | | 248 | .include "prepare-subst.mk" |
249 | .include "mk/subst.mk" | | 249 | .include "mk/subst.mk" |
250 | | | 250 | |
251 | all: subst-class | | 251 | all: subst-class |
252 | EOF | | 252 | EOF |
253 | | | 253 | |
254 | run_bmake "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$? | | 254 | run_bmake "testcase.mk" > "$tmpdir/actual-output" && exitcode=0 || exitcode=$? |
255 | | | 255 | |
256 | create_file_lines "expected-output" \ | | 256 | create_file_lines "expected-output" \ |
257 | '=> Substituting "class" in nonexistent' \ | | 257 | '=> Substituting "class" in nonexistent' \ |
258 | 'warning: [subst.mk:class] Ignoring non-existent file "./nonexistent".' \ | | 258 | 'warning: [subst.mk:class] Ignoring non-existent file "./nonexistent".' \ |
259 | 'fail: [subst.mk:class] The pattern nonexistent has no effect.' \ | | 259 | 'fail: [subst.mk:class] The filename pattern "nonexistent" has no effect.' \ |
260 | '*** Error code 1' \ | | 260 | '*** Error code 1' \ |
261 | '' \ | | 261 | '' \ |
262 | 'Stop.' \ | | 262 | 'Stop.' \ |
263 | "$make: stopped in $PWD" | | 263 | "$make: stopped in $PWD" |
264 | assert_that "actual-output" --file-equals "expected-output" | | 264 | assert_that "actual-output" --file-equals "expected-output" |
265 | assert_that "$exitcode" --equals "1" | | 265 | assert_that "$exitcode" --equals "1" |
266 | | | 266 | |
267 | test_case_end | | 267 | test_case_end |
268 | fi | | 268 | fi |
269 | | | 269 | |
270 | | | 270 | |
271 | if test_case_begin "single file nonexistent ok"; then | | 271 | if test_case_begin "single file nonexistent ok"; then |
272 | | | 272 | |
| @@ -874,55 +874,51 @@ if test_case_begin "pattern matches dire | | | @@ -874,55 +874,51 @@ if test_case_begin "pattern matches dire |
874 | assert_that "stdout" --file-is-lines \ | | 874 | assert_that "stdout" --file-is-lines \ |
875 | "=> Substituting \"dir\" in sub*" | | 875 | "=> Substituting \"dir\" in sub*" |
876 | assert_that "stderr" --file-is-empty | | 876 | assert_that "stderr" --file-is-empty |
877 | assert_that "$exitcode" --equals 0 | | 877 | assert_that "$exitcode" --equals 0 |
878 | | | 878 | |
879 | test_case_end | | 879 | test_case_end |
880 | fi | | 880 | fi |
881 | | | 881 | |
882 | | | 882 | |
883 | if test_case_begin "pattern matches only directory"; then | | 883 | if test_case_begin "pattern matches only directory"; then |
884 | | | 884 | |
885 | # When a pattern matches a directory, that directory is silently | | 885 | # When a pattern matches a directory, that directory is silently |
886 | # skipped. | | 886 | # skipped. |
887 | # | | | |
888 | # In this test case, the pattern also matches a regular file that | | | |
889 | # is actually modified. Therefore the pattern has an effect, and | | | |
890 | # there is no error message. | | | |
891 | | | 887 | |
892 | create_file_lines "testcase.mk" \ | | 888 | create_file_lines "testcase.mk" \ |
893 | 'SUBST_CLASSES+= dir' \ | | 889 | 'SUBST_CLASSES+= dir' \ |
894 | 'SUBST_STAGE.dir= pre-configure' \ | | 890 | 'SUBST_STAGE.dir= pre-configure' \ |
895 | 'SUBST_FILES.dir= sub*' \ | | 891 | 'SUBST_FILES.dir= sub*' \ |
896 | 'SUBST_VARS.dir= VAR' \ | | 892 | 'SUBST_VARS.dir= VAR' \ |
897 | 'SUBST_NOOP_OK.dir= no' \ | | 893 | 'SUBST_NOOP_OK.dir= no' \ |
898 | '' \ | | 894 | '' \ |
899 | 'VAR= value' \ | | 895 | 'VAR= value' \ |
900 | '' \ | | 896 | '' \ |
901 | '.include "prepare-subst.mk"' \ | | 897 | '.include "prepare-subst.mk"' \ |
902 | '.include "mk/subst.mk"' | | 898 | '.include "mk/subst.mk"' |
903 | mkdir "$tmpdir/subdir" | | 899 | mkdir "$tmpdir/subdir" |
904 | create_file_lines "subdir/subfile" \ | | 900 | create_file_lines "subdir/subfile" \ |
905 | "@VAR@" | | 901 | "@VAR@" |
906 | | | 902 | |
907 | run_bmake "testcase.mk" "pre-configure" \ | | 903 | run_bmake "testcase.mk" "pre-configure" \ |
908 | 1> "$tmpdir/stdout" \ | | 904 | 1> "$tmpdir/stdout" \ |
909 | 2> "$tmpdir/stderr" \ | | 905 | 2> "$tmpdir/stderr" \ |
910 | && exitcode=0 || exitcode=$? | | 906 | && exitcode=0 || exitcode=$? |
911 | | | 907 | |
912 | assert_that "subdir/subfile" --file-is-lines "@VAR@" # unchanged | | 908 | assert_that "subdir/subfile" --file-is-lines "@VAR@" # unchanged |
913 | assert_that "stdout" --file-is-lines \ | | 909 | assert_that "stdout" --file-is-lines \ |
914 | "=> Substituting \"dir\" in sub*" \ | | 910 | "=> Substituting \"dir\" in sub*" \ |
915 | "fail: [subst.mk:dir] The pattern sub* has no effect." \ | | 911 | 'fail: [subst.mk:dir] The filename pattern "sub*" has no effect.' \ |
916 | "*** Error code 1" \ | | 912 | "*** Error code 1" \ |
917 | "" \ | | 913 | "" \ |
918 | "Stop." \ | | 914 | "Stop." \ |
919 | "$make: stopped in $PWD" | | 915 | "$make: stopped in $PWD" |
920 | assert_that "stderr" --file-is-empty | | 916 | assert_that "stderr" --file-is-empty |
921 | assert_that "$exitcode" --equals 1 | | 917 | assert_that "$exitcode" --equals 1 |
922 | | | 918 | |
923 | test_case_end | | 919 | test_case_end |
924 | fi | | 920 | fi |
925 | | | 921 | |
926 | | | 922 | |
927 | if test_case_begin "first filename pattern has no effect"; then | | 923 | if test_case_begin "first filename pattern has no effect"; then |
928 | | | 924 | |
| @@ -939,21 +935,21 @@ if test_case_begin "first filename patte | | | @@ -939,21 +935,21 @@ if test_case_begin "first filename patte |
939 | 'B= b-value' \ | | 935 | 'B= b-value' \ |
940 | '' \ | | 936 | '' \ |
941 | '.include "prepare-subst.mk"' \ | | 937 | '.include "prepare-subst.mk"' \ |
942 | '.include "mk/subst.mk"' | | 938 | '.include "mk/subst.mk"' |
943 | create_file_lines "file1" "nothing to replace" | | 939 | create_file_lines "file1" "nothing to replace" |
944 | create_file_lines "file2" "nothing to replace" | | 940 | create_file_lines "file2" "nothing to replace" |
945 | | | 941 | |
946 | run_bmake "testcase.mk" "pre-configure" 1> "$tmpdir/out" 2>&1 \ | | 942 | run_bmake "testcase.mk" "pre-configure" 1> "$tmpdir/out" 2>&1 \ |
947 | && exitcode=0 || exitcode=$? | | 943 | && exitcode=0 || exitcode=$? |
948 | | | 944 | |
949 | assert_that "out" --file-is-lines \ | | 945 | assert_that "out" --file-is-lines \ |
950 | '=> Substituting "id" in file1 file2' \ | | 946 | '=> Substituting "id" in file1 file2' \ |
951 | 'warning: [subst.mk:id] Nothing changed in ./file1.' \ | | 947 | 'warning: [subst.mk:id] Nothing changed in ./file1.' \ |
952 | 'fail: [subst.mk:id] The pattern file1 has no effect.' \ | | 948 | 'fail: [subst.mk:id] The filename pattern "file1" has no effect.' \ |
953 | '*** Error code 1' \ | | 949 | '*** Error code 1' \ |
954 | '' \ | | 950 | '' \ |
955 | 'Stop.' \ | | 951 | 'Stop.' \ |
956 | "$make: stopped in $PWD" | | 952 | "$make: stopped in $PWD" |
957 | | | 953 | |
958 | test_case_end | | 954 | test_case_end |
959 | fi | | 955 | fi |