msysGit-based Git for Windows 1.x was superseded by Git for Windows 2.x
[git/mingw/4msysgit.git] / t / t0061-run-command.sh
blob17e969df609f71b0b4562cff8fda112632d27442
1 #!/bin/sh
3 # Copyright (c) 2009 Ilari Liusvaara
6 test_description='Test run command'
8 . ./test-lib.sh
10 cat >hello-script <<-EOF
11 #!$SHELL_PATH
12 cat hello-script
13 EOF
14 >empty
16 test_expect_success 'start_command reports ENOENT' '
17 test-run-command start-command-ENOENT ./does-not-exist
20 test_expect_success 'run_command can run a command' '
21 cat hello-script >hello.sh &&
22 chmod +x hello.sh &&
23 test-run-command run-command ./hello.sh >actual 2>err &&
25 test_cmp hello-script actual &&
26 test_cmp empty err
29 test_expect_success POSIXPERM 'run_command reports EACCES' '
30 cat hello-script >hello.sh &&
31 chmod -x hello.sh &&
32 test_must_fail test-run-command run-command ./hello.sh 2>err &&
34 grep "fatal: cannot exec.*hello.sh" err
37 test_expect_success POSIXPERM 'unreadable directory in PATH' '
38 mkdir local-command &&
39 test_when_finished "chmod u+rwx local-command && rm -fr local-command" &&
40 git config alias.nitfol "!echo frotz" &&
41 chmod a-rx local-command &&
43 PATH=./local-command:$PATH &&
44 git nitfol >actual
45 ) &&
46 echo frotz >expect &&
47 test_cmp expect actual
50 test_done