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"
12 clean: test0 test-file.start
13 rm -f test[0-9] test[0-9][0-9] test-file.[0-9]*
15 # prepare everything for test sequence
16 test0: test-file.start
17 cmp test-file test-file.start >/dev/null 2>&1 || cp test-file.start test-file
20 # - should match only from the beginning of line
21 # not in the middle of it, so this text should
22 # be added to the end of the file, also adding
23 # newline to it (it's missing from the test-file)
25 echo Block inserted by $@ | $(CPUPDATE) -i update $@ test-file
32 # - insert something on top of the file
34 echo Block inserted by $@ | $(CPUPDATE) -t $@ test-file
41 # - insert something right in the middle using --insert-after
43 echo Block inserted by $@ | $(CPUPDATE) --insert-after '</apache>' $@ test-file
49 # insert something at the end using --insert-after, due to
50 # failed match -- implicit placement at the end is used
52 echo Block inserted by $@ | $(CPUPDATE) --insert-after 'abracadabra' $@ test-file
58 # insert bigger blocks we can
59 # - also, using regexp match
60 # - also, alternative comment character
61 # - won't work with old cp-update (no -R)
63 perl -e 'print "test line $$_ by $$ARGV[0]\n" for 1..5;' $@ \
64 | $(CPUPDATE) -R -c ';' --insert-after '[Jj]aneiro' $@ test-file
70 # now remove everything
71 test6: test1 test2 test3 test4 test5
72 for i in test[1-4]; do $(CPUPDATE) -r $$i test-file; done
73 $(CPUPDATE) -r -c ';' test5 test-file
74 cp test-file.start $@.ok
86 # more test on development roadmap:
87 # -- add file-locking - test concurrent updates
90 .PHONY: tests test0 clean