[PATCH 03/24] t9300 (fast-import): guard "export large marks" test setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the setup for the large marks test involves more complex code
than just a "cat", "echo", or assignment, make it part of the
test_expect_success assertion.  This way, the test script will report
a failure if the setup breaks from a coding mistake, unusual shell, or
other unforseen circumstance.

While at it, make some other small simplifications (grouping commands
that write to the same file with { }; using ">file" instead of ": >file"
to empty a file).

Cc: Shawn O. Pearce <spearce@xxxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t9300-fast-import.sh |  106 +++++++++++++++++++++++++-----------------------
 1 files changed, 55 insertions(+), 51 deletions(-)

diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index ed37a4e..735ac83 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -184,58 +184,62 @@ test_expect_success \
 	 test `git rev-parse --verify master:file2` \
 	    = `git rev-parse --verify verify--import-marks:copy-of-file2`'
 
-test_tick
-mt=$(git hash-object --stdin < /dev/null)
-: >input.blob
-: >marks.exp
-: >tree.exp
-
-cat >input.commit <<EOF
-commit refs/heads/verify--dump-marks
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
-data <<COMMIT
-test the sparse array dumping routines with exponentially growing marks
-COMMIT
-EOF
-
-i=0
-l=4
-m=6
-n=7
-while test "$i" -lt 27; do
-    cat >>input.blob <<EOF
-blob
-mark :$l
-data 0
-blob
-mark :$m
-data 0
-blob
-mark :$n
-data 0
-EOF
-    echo "M 100644 :$l l$i" >>input.commit
-    echo "M 100644 :$m m$i" >>input.commit
-    echo "M 100644 :$n n$i" >>input.commit
-
-    echo ":$l $mt" >>marks.exp
-    echo ":$m $mt" >>marks.exp
-    echo ":$n $mt" >>marks.exp
-
-    printf "100644 blob $mt\tl$i\n" >>tree.exp
-    printf "100644 blob $mt\tm$i\n" >>tree.exp
-    printf "100644 blob $mt\tn$i\n" >>tree.exp
-
-    l=$(($l + $l))
-    m=$(($m + $m))
-    n=$(($l + $n))
-
-    i=$((1 + $i))
-done
-
-sort tree.exp > tree.exp_s
-
 test_expect_success 'A: export marks with large values' '
+	test_tick &&
+	mt=$(git hash-object --stdin </dev/null) &&
+	>input.blob &&
+	>marks.exp &&
+	>tree.exp &&
+
+	cat >input.commit <<-EOF &&
+	commit refs/heads/verify--dump-marks
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data <<COMMIT
+	test the sparse array dumping routines with exponentially growing marks
+	COMMIT
+	EOF
+
+	(
+		i=0 &&
+		l=4 &&
+		m=6 &&
+		n=7 &&
+		while test "$i" -lt 27
+		do
+			cat >>input.blob <<-EOF &&
+			blob
+			mark :$l
+			data 0
+			blob
+			mark :$m
+			data 0
+			blob
+			mark :$n
+			data 0
+			EOF
+			{
+				echo "M 100644 :$l l$i" &&
+				echo "M 100644 :$m m$i" &&
+				echo "M 100644 :$n n$i"
+			} >>input.commit &&
+			{
+				echo ":$l $mt" &&
+				echo ":$m $mt" &&
+				echo ":$n $mt"
+			} >>marks.exp &&
+			{
+				printf "100644 blob $mt\tl$i\n" &&
+				printf "100644 blob $mt\tm$i\n" &&
+				printf "100644 blob $mt\tn$i\n"
+			} >>tree.exp &&
+			l=$(($l + $l)) &&
+			m=$(($m + $m)) &&
+			n=$(($l + $n)) &&
+			i=$((1 + $i)) ||
+			exit
+		done
+	) &&
+	sort tree.exp >tree.exp_s &&
 	cat input.blob input.commit | git fast-import --export-marks=marks.large &&
 	git ls-tree refs/heads/verify--dump-marks >tree.out &&
 	test_cmp tree.exp_s tree.out &&
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]