t0061: adjust to test-tool transition
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Oct 2018 02:41:09 +0000 (11:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Oct 2018 02:41:09 +0000 (11:41 +0900)
1  2 
run-command.c
t/t0061-run-command.sh

diff --cc run-command.c
@@@ -380,10 -378,10 +380,10 @@@ static void child_err_spew(struct child
        set_error_routine(old_errfn);
  }
  
- static void prepare_cmd(struct argv_array *out, const struct child_process *cmd)
+ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd)
  {
        if (!cmd->argv[0])
 -              die("BUG: command is empty");
 +              BUG("command is empty");
  
        /*
         * Add SHELL_PATH so in the event exec fails with ENOEXEC we can
@@@ -13,10 -13,14 +13,14 @@@ cat >hello-script <<-EO
  EOF
  >empty
  
- test_expect_success 'start_command reports ENOENT' '
+ test_expect_success 'start_command reports ENOENT (slash)' '
 -      test-run-command start-command-ENOENT ./does-not-exist
 +      test-tool run-command start-command-ENOENT ./does-not-exist
  '
  
 -      test-run-command start-command-ENOENT does-not-exist
+ test_expect_success 'start_command reports ENOENT (no slash)' '
++      test-tool run-command start-command-ENOENT does-not-exist
+ '
  test_expect_success 'run_command can run a command' '
        cat hello-script >hello.sh &&
        chmod +x hello.sh &&
        test_cmp empty err
  '
  
 -      test_must_fail test-run-command run-command should-not-run
+ test_expect_success 'run_command is restricted to PATH' '
+       write_script should-not-run <<-\EOF &&
+       echo yikes
+       EOF
++      test_must_fail test-tool run-command run-command should-not-run
+ '
  test_expect_success !MINGW 'run_command can run a script without a #! line' '
        cat >hello <<-\EOF &&
        cat hello-script