diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/t0061-run-command.sh | 23 | ||||
-rwxr-xr-x | t/t0081-line-buffer.sh | 106 | ||||
-rwxr-xr-x | t/t3503-cherry-pick-root.sh | 27 | ||||
-rwxr-xr-x | t/t4034-diff-words.sh | 26 | ||||
-rwxr-xr-x | t/t5532-fetch-proxy.sh | 43 | ||||
-rwxr-xr-x | t/t6017-rev-list-stdin.sh | 17 |
6 files changed, 136 insertions, 106 deletions
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh index 10b26e4d8e..8d4938f019 100755 --- a/t/t0061-run-command.sh +++ b/t/t0061-run-command.sh @@ -7,8 +7,31 @@ test_description='Test run command' . ./test-lib.sh +cat >hello-script <<-EOF + #!$SHELL_PATH + cat hello-script +EOF +>empty + test_expect_success 'start_command reports ENOENT' ' test-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-run-command run-command ./hello.sh >actual 2>err && + + test_cmp hello-script actual && + test_cmp empty err +' + +test_expect_success POSIXPERM 'run_command reports EACCES' ' + cat hello-script >hello.sh && + chmod -x hello.sh && + test_must_fail test-run-command run-command ./hello.sh 2>err && + + grep "fatal: cannot exec.*hello.sh" err +' + test_done diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh index 5067d1e15b..bd83ed371a 100755 --- a/t/t0081-line-buffer.sh +++ b/t/t0081-line-buffer.sh @@ -2,74 +2,14 @@ test_description="Test the svn importer's input handling routines. -These tests exercise the line_buffer library, but their real purpose -is to check the assumptions that library makes of the platform's input -routines. Processes engaged in bi-directional communication would -hang if fread or fgets is too greedy. +These tests provide some simple checks that the line_buffer API +behaves as advertised. While at it, check that input of newlines and null bytes are handled correctly. " . ./test-lib.sh -test -n "$GIT_REMOTE_SVN_TEST_BIG_FILES" && test_set_prereq EXPENSIVE - -generate_tens_of_lines () { - tens=$1 && - line=$2 && - - i=0 && - while test $i -lt "$tens" - do - for j in a b c d e f g h i j - do - echo "$line" - done && - : $((i = $i + 1)) || - return - done -} - -long_read_test () { - : each line is 10 bytes, including newline && - line=abcdefghi && - echo "$line" >expect && - - if ! test_declared_prereq PIPE - then - echo >&4 "long_read_test: need to declare PIPE prerequisite" - return 127 - fi && - tens_of_lines=$(($1 / 100 + 1)) && - lines=$(($tens_of_lines * 10)) && - readsize=$((($lines - 1) * 10 + 3)) && - copysize=7 && - rm -f input && - mkfifo input && - { - ( - generate_tens_of_lines $tens_of_lines "$line" && - exec sleep 100 - ) >input & - } && - test-line-buffer input <<-EOF >output && - binary $readsize - copy $copysize - EOF - kill $! && - test_line_count = $lines output && - tail -n 1 <output >actual && - test_cmp expect actual -} - -test_expect_success 'setup: have pipes?' ' - rm -f frob && - if mkfifo frob - then - test_set_prereq PIPE - fi -' - test_expect_success 'hello world' ' echo ">HELLO" >expect && test-line-buffer <<-\EOF >actual && @@ -79,21 +19,6 @@ test_expect_success 'hello world' ' test_cmp expect actual ' -test_expect_success PIPE '0-length read, no input available' ' - printf ">" >expect && - rm -f input && - mkfifo input && - { - sleep 100 >input & - } && - test-line-buffer input <<-\EOF >actual && - binary 0 - copy 0 - EOF - kill $! && - test_cmp expect actual -' - test_expect_success '0-length read, send along greeting' ' echo ">HELLO" >expect && test-line-buffer <<-\EOF >actual && @@ -104,33 +29,6 @@ test_expect_success '0-length read, send along greeting' ' test_cmp expect actual ' -test_expect_success PIPE '1-byte read, no input available' ' - printf ">%s" ab >expect && - rm -f input && - mkfifo input && - { - ( - printf "%s" a && - printf "%s" b && - exec sleep 100 - ) >input & - } && - test-line-buffer input <<-\EOF >actual && - binary 1 - copy 1 - EOF - kill $! && - test_cmp expect actual -' - -test_expect_success PIPE 'long read (around 8192 bytes)' ' - long_read_test 8192 -' - -test_expect_success PIPE,EXPENSIVE 'longer read (around 65536 bytes)' ' - long_read_test 65536 -' - test_expect_success 'read from file descriptor' ' rm -f input && echo hello >expect && diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh index b0faa29918..9aefe3a1be 100755 --- a/t/t3503-cherry-pick-root.sh +++ b/t/t3503-cherry-pick-root.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='test cherry-picking a root commit' +test_description='test cherry-picking (and reverting) a root commit' . ./test-lib.sh @@ -23,7 +23,30 @@ test_expect_success setup ' test_expect_success 'cherry-pick a root commit' ' git cherry-pick master && - test first = $(cat file1) + echo first >expect && + test_cmp expect file1 + +' + +test_expect_success 'revert a root commit' ' + + git revert master && + test_path_is_missing file1 + +' + +test_expect_success 'cherry-pick a root commit with an external strategy' ' + + git cherry-pick --strategy=resolve master && + echo first >expect && + test_cmp expect file1 + +' + +test_expect_success 'revert a root commit with an external strategy' ' + + git revert --strategy=resolve master && + test_path_is_missing file1 ' diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh index 37aeab0d5c..c374aa4c1c 100755 --- a/t/t4034-diff-words.sh +++ b/t/t4034-diff-words.sh @@ -307,4 +307,30 @@ test_language_driver python test_language_driver ruby test_language_driver tex +test_expect_success 'word-diff with diff.sbe' ' + cat >expect <<-\EOF && + diff --git a/pre b/post + index a1a53b5..bc8fe6d 100644 + --- a/pre + +++ b/post + @@ -1,3 +1,3 @@ + a + + [-b-]{+c+} + EOF + cat >pre <<-\EOF && + a + + b + EOF + cat >post <<-\EOF && + a + + c + EOF + test_when_finished "git config --unset diff.suppress-blank-empty" && + git config diff.suppress-blank-empty true && + word_diff --word-diff=plain +' + test_done diff --git a/t/t5532-fetch-proxy.sh b/t/t5532-fetch-proxy.sh new file mode 100755 index 0000000000..62f2460047 --- /dev/null +++ b/t/t5532-fetch-proxy.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +test_description='fetching via git:// using core.gitproxy' +. ./test-lib.sh + +test_expect_success 'setup remote repo' ' + git init remote && + (cd remote && + echo content >file && + git add file && + git commit -m one + ) +' + +cat >proxy <<'EOF' +#!/bin/sh +echo >&2 "proxying for $*" +cmd=`perl -e ' + read(STDIN, $buf, 4); + my $n = hex($buf) - 4; + read(STDIN, $buf, $n); + my ($cmd, $other) = split /\0/, $buf; + # drop absolute-path on repo name + $cmd =~ s{ /}{ }; + print $cmd; +'` +echo >&2 "Running '$cmd'" +exec $cmd +EOF +chmod +x proxy +test_expect_success 'setup local repo' ' + git remote add fake git://example.com/remote && + git config core.gitproxy ./proxy +' + +test_expect_success 'fetch through proxy works' ' + git fetch fake && + echo one >expect && + git log -1 --format=%s FETCH_HEAD >actual && + test_cmp expect actual +' + +test_done diff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh index f1c32dba42..667b37564e 100755 --- a/t/t6017-rev-list-stdin.sh +++ b/t/t6017-rev-list-stdin.sh @@ -58,4 +58,21 @@ check side-3 ^side-4 -- file-3 check side-3 ^side-2 check side-3 ^side-2 -- file-1 +test_expect_success 'not only --stdin' ' + cat >expect <<-EOF && + 7 + + file-1 + file-2 + EOF + cat >input <<-EOF && + ^master^ + -- + file-2 + EOF + git log --pretty=tformat:%s --name-only --stdin master -- file-1 \ + <input >actual && + test_cmp expect actual +' + test_done |