Follow upstream changes -- rest
[git-darcs-import.git] / tests / external.sh
blob2fb5fbc8d3179561a1601adf4f814c1910ffbd72
1 #!/usr/bin/env bash
2 set -ev
4 # Some tests for launching external commands
6 # I would use the builtin !, but that has the wrong semantics.
7 not () { "$@" && exit 1 || :; }
9 rm -rf temp1
11 touch_fakessh='./touch-fakessh'
12 if echo $OS | grep -i windows; then
13 touch_fakessh="touch_fakessh.bat"
15 export DARCS_SSH=$touch_fakessh
16 export DARCS_SCP=$touch_fakessh
17 export DARCS_SFTP=$touch_fakessh
18 rm -rf 'fakessh'
19 rm -rf 'touch-fakessh'
21 # make our ssh command one word only
22 echo 'echo hello > fakessh' > $touch_fakessh
23 chmod u+x $touch_fakessh
24 # first test the DARCS_SSH environment variable
25 not darcs get example.com:foo
26 grep hello fakessh
27 rm -f fakessh
29 # now make sure that we don't launch ssh for nothing
30 mkdir temp1
31 cd temp1
32 darcs init
33 cd ..
34 darcs get temp1 > log
35 not grep fakessh log
36 not darcs get http://example.com:foo
37 not grep fakessh log
38 cd ..
39 rm -rf temp1