summaryrefslogtreecommitdiff
path: root/t/t0000-basic.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-xt/t0000-basic.sh73
1 files changed, 46 insertions, 27 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 705d62c..5c342de 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -69,6 +69,23 @@ test_expect_success 'success is reported like this' '
_run_sub_test_lib_test_common () {
neg="$1" name="$2" descr="$3" # stdin is the body of the test code
shift 3
+
+ # intercept pseudo-options at the front of the argument list that we
+ # will not pass to child script
+ skip=
+ while test $# -gt 0
+ do
+ case "$1" in
+ --skip=*)
+ skip=${1#--*=}
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
mkdir "$name" &&
(
# Pretend we're not running under a test harness, whether we
@@ -84,17 +101,18 @@ _run_sub_test_lib_test_common () {
passing metrics
'
- # Tell the framework that we are self-testing to make sure
- # it yields a stable result.
- GIT_TEST_FRAMEWORK_SELFTEST=t &&
-
# Point to the t/test-lib.sh, which isn't in ../ as usual
. "\$TEST_DIRECTORY"/test-lib.sh
EOF
cat >>"$name.sh" &&
export TEST_DIRECTORY &&
- TEST_OUTPUT_DIRECTORY=$(pwd) &&
- export TEST_OUTPUT_DIRECTORY &&
+ # The child test re-sources GIT-BUILD-OPTIONS and may thus
+ # override the test output directory. We thus pass it as an
+ # explicit override to the child.
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$(pwd) &&
+ export TEST_OUTPUT_DIRECTORY_OVERRIDE &&
+ GIT_SKIP_TESTS=$skip &&
+ export GIT_SKIP_TESTS &&
sane_unset GIT_TEST_FAIL_PREREQS &&
if test -z "$neg"
then
@@ -323,9 +341,9 @@ test_expect_success 'test --verbose-only' '
test_expect_success 'GIT_SKIP_TESTS' '
(
- GIT_SKIP_TESTS="git.2" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-basic \
- "GIT_SKIP_TESTS" <<-\EOF &&
+ "GIT_SKIP_TESTS" \
+ --skip="git.2" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"
@@ -344,9 +362,9 @@ test_expect_success 'GIT_SKIP_TESTS' '
test_expect_success 'GIT_SKIP_TESTS several tests' '
(
- GIT_SKIP_TESTS="git.2 git.5" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-several \
- "GIT_SKIP_TESTS several tests" <<-\EOF &&
+ "GIT_SKIP_TESTS several tests" \
+ --skip="git.2 git.5" <<-\EOF &&
for i in 1 2 3 4 5 6
do
test_expect_success "passing test #$i" "true"
@@ -368,9 +386,9 @@ test_expect_success 'GIT_SKIP_TESTS several tests' '
test_expect_success 'GIT_SKIP_TESTS sh pattern' '
(
- GIT_SKIP_TESTS="git.[2-5]" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-sh-pattern \
- "GIT_SKIP_TESTS sh pattern" <<-\EOF &&
+ "GIT_SKIP_TESTS sh pattern" \
+ --skip="git.[2-5]" <<-\EOF &&
for i in 1 2 3 4 5 6
do
test_expect_success "passing test #$i" "true"
@@ -392,9 +410,9 @@ test_expect_success 'GIT_SKIP_TESTS sh pattern' '
test_expect_success 'GIT_SKIP_TESTS entire suite' '
(
- GIT_SKIP_TESTS="git" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-entire-suite \
- "GIT_SKIP_TESTS entire suite" <<-\EOF &&
+ "GIT_SKIP_TESTS entire suite" \
+ --skip="git" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"
@@ -409,9 +427,9 @@ test_expect_success 'GIT_SKIP_TESTS entire suite' '
test_expect_success 'GIT_SKIP_TESTS does not skip unmatched suite' '
(
- GIT_SKIP_TESTS="notgit" && export GIT_SKIP_TESTS &&
run_sub_test_lib_test git-skip-tests-unmatched-suite \
- "GIT_SKIP_TESTS does not skip unmatched suite" <<-\EOF &&
+ "GIT_SKIP_TESTS does not skip unmatched suite" \
+ --skip="notgit" <<-\EOF &&
for i in 1 2 3
do
test_expect_success "passing test #$i" "true"
@@ -1253,28 +1271,29 @@ P=$(test_oid root)
test_expect_success 'git commit-tree records the correct tree in a commit' '
commit0=$(echo NO | git commit-tree $P) &&
- tree=$(git show --pretty=raw $commit0 |
- sed -n -e "s/^tree //p" -e "/^author /q") &&
+ git show --pretty=raw $commit0 >out &&
+ tree=$(sed -n -e "s/^tree //p" -e "/^author /q" out) &&
test "z$tree" = "z$P"
'
test_expect_success 'git commit-tree records the correct parent in a commit' '
commit1=$(echo NO | git commit-tree $P -p $commit0) &&
- parent=$(git show --pretty=raw $commit1 |
- sed -n -e "s/^parent //p" -e "/^author /q") &&
+ git show --pretty=raw $commit1 >out &&
+ parent=$(sed -n -e "s/^parent //p" -e "/^author /q" out) &&
test "z$commit0" = "z$parent"
'
test_expect_success 'git commit-tree omits duplicated parent in a commit' '
commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
- parent=$(git show --pretty=raw $commit2 |
- sed -n -e "s/^parent //p" -e "/^author /q" |
- sort -u) &&
+ git show --pretty=raw $commit2 >out &&
+ cat >match.sed <<-\EOF &&
+ s/^parent //p
+ /^author /q
+ EOF
+ parent=$(sed -n -f match.sed out | sort -u) &&
test "z$commit0" = "z$parent" &&
- numparent=$(git show --pretty=raw $commit2 |
- sed -n -e "s/^parent //p" -e "/^author /q" |
- wc -l) &&
- test $numparent = 1
+ git show --pretty=raw $commit2 >out &&
+ test_stdout_line_count = 1 sed -n -f match.sed out
'
test_expect_success 'update-index D/F conflict' '