2 # A test for issue 538 - that an executable test script will run successfully if
3 # it is recorded with --set-scripts-executable.
7 if echo $OS |
grep -i windows
; then
8 echo I
do not know how to run a
test program under windows
12 function make_repo_with_test
{
13 mkdir temp1
; cd temp1
; darcs init
14 echo "#!/bin/sh" > test.sh
15 echo "echo 'hello world'" >> test.sh
17 darcs record
--author=test@
test -am test
18 darcs setpref
test './test.sh'
21 # test record with --set-scripts-executable
26 if darcs record
--set-scripts-executable -A test@
test -am blaat
; then
29 echo "not ok 1 recording second patch failed (because test failed?)"
34 # test record without --set-scripts-executable
39 if darcs record
--dont-set-scripts-executable -A test@
test -am blaat
; then
40 echo "not ok 2 recording second patch succeeded though test script should not be executable"
47 # test amend-record with --set-scripts-executable
52 if echo y | darcs amend-record
--set-scripts-executable -A test@
test -a ; then
55 echo "not ok 3 amending patch failed (because test failed?)"
60 # test amend-record without --set-scripts-executable
65 if echo y | darcs amend-record
--dont-set-scripts-executable -A test@
test -a /dev
/null
; then
66 echo "not ok 4 amending patch succeeded even though --dont-set-scripts-executable specified"
73 # trackdown with --set-scripts-executable
76 if darcs trackdown
--set-scripts-executable |
grep 'Success!' ; then
79 echo "not ok 5 tracking down with --set-scripts-executable failed (because test failed?)"
84 # trackdown without --set-scripts-executable
87 if darcs trackdown
--dont-set-scripts-executable |
grep 'Noone passed the test!' ; then
90 echo "not ok 6 tracking down did not find failure even though --dont-set-scripts-executable was given"
95 # check trackdown with files that become scripts during trackdown
97 mkdir temp1
; cd temp1
; darcs init
98 echo "#!/bin/sh" > test.sh
99 echo "./helper.sh" >> test.sh
100 echo "#!/bin/sh" > helper.sh
101 echo "echo 'helper speaking'" >> helper.sh
104 darcs record
-am 'valid helper' -A test
105 echo 'this is definitely not a valid script' > helper.sh
106 darcs record
-am 'invalid helper' -A test
107 darcs setpref
test './test.sh'
108 darcs trackdown
--set-scripts-executable > trackdown-out
109 if grep 'Test failed!' trackdown-out
&& grep 'Success!' trackdown-out
; then
112 echo "not ok 7 either no failure or no success (both should occur)"