4 # Created by: ddzeko@srce.hr, 2005-03-20
6 # path to cp-update script
9 tests: test0 test1 test2 test3 test4 test5 test6
10 @echo "All tests completed successfully"
11 @cp test-file.start test-file
13 clean: test0 test-file.start
14 rm -f test[0-9] test[0-9][0-9] test-file.[0-9]*
16 # prepare everything for test sequence
17 test0: test-file.start
18 cmp test-file test-file.start >/dev/null 2>&1 || cp test-file.start test-file
21 # - should match only from the beginning of line
22 # not in the middle of it, so this text should
23 # be added to the end of the file, also adding
24 # newline to it (it's missing from the test-file)
26 echo Block inserted by $@ | $(CPUPDATE) -i update $@ test-file
33 # - insert something on top of the file
35 echo Block inserted by $@ | $(CPUPDATE) -t $@ test-file
42 # - insert something right in the middle using --insert-after
44 echo Block inserted by $@ | $(CPUPDATE) --insert-after '</apache>' $@ test-file
50 # insert something at the end using --insert-after, due to
51 # failed match -- implicit placement at the end is used
53 echo Block inserted by $@ | $(CPUPDATE) --insert-after 'abracadabra' $@ test-file
59 # insert bigger blocks we can
60 # - also, using regexp match
61 # - also, alternative comment character
62 # - won't work with old cp-update (no -R)
64 perl -e 'print "test line $$_ by $$ARGV[0]\n" for 1..5;' $@ \
65 | $(CPUPDATE) -R -c ';' --insert-after '[Jj]aneiro' $@ test-file
71 # now remove everything
72 test6: test1 test2 test3 test4 test5
73 for i in test[1-4]; do $(CPUPDATE) -r $$i test-file; done
74 $(CPUPDATE) -r -c ';' test5 test-file
75 cp test-file.start $@.ok
87 # more test on development roadmap:
88 # -- add file-locking - test concurrent updates
91 .PHONY: tests test0 clean