Skip to contentSkip to conversation

tests: cleanup binary images usage

PATCH In review Vitaliy Ivanov 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: cleanup binary images usage

Images are being shared between tests:

Tue Jul 19 19:45:14
[vitaliy.ivanov@vivanov git]$ grep -r test4012.png *

t/t4012-diff-binary.sh:  cat "$TEST_DIRECTORY"/test4012.png >b &&
t/t6023-merge-file.sh:          orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
t/t3307-notes-man.sh:   cp "$TEST_DIRECTORY"/test4012.png . &&
t/t3307-notes-man.sh:   blob=$(git hash-object -w test4012.png) &&
t/t3307-notes-man.sh:   test_cmp test4012.png actual
t/t6027-merge-binary.sh:        cat "$TEST_DIRECTORY"/test4012.png >m &&

So, this is incorrect to name images depending on specific test. This patch cleanups binary images that are used in tests.

The results of running tests before and after the changes:

fixed 0
success 7129

failed  0
broken  32
total   7262

---

Quoted 1 line

From bff3916939fcd226278a2e983ddc77bb711296e7 Mon Sep 17 00:00:00 2001

From: Vitaliy Ivanov <[email protected]>
Date: Tue, 19 Jul 2011 20:07:08 +0300
Subject: [PATCH] tests: cleanup binary images usage

Images are being shared between tests and this is OK. By this patch I name images independently of tests plus remove unneeded images.

---
 t/t3307-notes-man.sh           |    6 +++---
 t/t4012-diff-binary.sh         |    2 +-
 t/t6023-merge-file.sh          |    2 +-
 t/t6027-merge-binary.sh        |    2 +-
 t/t9200-git-cvsexportcommit.sh |   14 +++++++-------
 t/test-image1.png              |  Bin 0 -> 5660 bytes
 t/test-image2.png              |  Bin 0 -> 275 bytes
 t/test4012.png                 |  Bin 5660 -> 0 bytes
 t/test9200a.png                |  Bin 5660 -> 0 bytes
 t/test9200b.png                |  Bin 275 -> 0 bytes
 10 files changed, 13 insertions(+), 13 deletions(-)
 create mode 100644 t/test-image1.png
 create mode 100644 t/test-image2.png
 delete mode 100644 t/test4012.png
 delete mode 100644 t/test9200a.png
 delete mode 100644 t/test9200b.png
t/t3307-notes-man.sh +3 -3
index 2ea3be6..3c7fc1b 100755
@@ -26,13 +26,13 @@ test_expect_success 'example 1: notes to add an Acked-by line' '
 '
 
 test_expect_success 'example 2: binary notes' '
-	cp "$TEST_DIRECTORY"/test4012.png . &&
+	cp "$TEST_DIRECTORY"/test-image1.png . &&
 	git checkout B &&
-	blob=$(git hash-object -w test4012.png) &&
+	blob=$(git hash-object -w test-image1.png) &&
 	git notes --ref=logo add -C "$blob" &&
 	git notes --ref=logo copy B C &&
 	git notes --ref=logo show C >actual &&
-	test_cmp test4012.png actual
+	test_cmp test-image1.png actual
 '
 
 test_done
t/t4012-diff-binary.sh +1 -1
index 05ec062..037dbc1 100755
@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
 	'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
 	 git update-index --add a b c d &&
 	 echo git >a &&
-	 cat "$TEST_DIRECTORY"/test4012.png >b &&
+	 cat "$TEST_DIRECTORY"/test-image1.png >b &&
 	 echo git >c &&
 	 cat b b >d'
 
t/t6023-merge-file.sh +1 -1
index d9f3439..f165914 100755
@@ -154,7 +154,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out"
 
 test_expect_success 'binary files cannot be merged' '
 	test_must_fail git merge-file -p \
-		orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
+		orig.txt "$TEST_DIRECTORY"/test-image1.png new1.txt 2> merge.err &&
 	grep "Cannot merge binary files" merge.err
 '
 
t/t6027-merge-binary.sh +1 -1
index b519626..da4ae21 100755
@@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files'
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/test4012.png >m &&
+	cat "$TEST_DIRECTORY"/test-image1.png >m &&
 	git add m &&
 	git ls-files -s | sed -e "s/ 0	/ 1	/" >E1 &&
 	test_tick &&
t/t9200-git-cvsexportcommit.sh +7 -7
index e5da65b..25b0550 100755
@@ -50,8 +50,8 @@ test_expect_success \
     'mkdir A B C D E F &&
      echo hello1 >A/newfile1.txt &&
      echo hello2 >B/newfile2.txt &&
-     cp "$TEST_DIRECTORY"/test9200a.png C/newfile3.png &&
-     cp "$TEST_DIRECTORY"/test9200a.png D/newfile4.png &&
+     cp "$TEST_DIRECTORY"/test-image1.png C/newfile3.png &&
+     cp "$TEST_DIRECTORY"/test-image1.png D/newfile4.png &&
      git add A/newfile1.txt &&
      git add B/newfile2.txt &&
      git add C/newfile3.png &&
@@ -76,8 +76,8 @@ test_expect_success \
      rm -f B/newfile2.txt &&
      rm -f C/newfile3.png &&
      echo Hello5  >E/newfile5.txt &&
-     cp "$TEST_DIRECTORY"/test9200b.png D/newfile4.png &&
-     cp "$TEST_DIRECTORY"/test9200a.png F/newfile6.png &&
+     cp "$TEST_DIRECTORY"/test-image2.png D/newfile4.png &&
+     cp "$TEST_DIRECTORY"/test-image1.png F/newfile6.png &&
      git add E/newfile5.txt &&
      git add F/newfile6.png &&
      git commit -a -m "Test: Remove, add and update" &&
@@ -165,7 +165,7 @@ test_expect_success \
      'mkdir "G g" &&
       echo ok then >"G g/with spaces.txt" &&
       git add "G g/with spaces.txt" && \
-      cp "$TEST_DIRECTORY"/test9200a.png "G g/with spaces.png" && \
+      cp "$TEST_DIRECTORY"/test-image1.png "G g/with spaces.png" && \
       git add "G g/with spaces.png" &&
       git commit -a -m "With spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
@@ -177,7 +177,7 @@ test_expect_success \
 test_expect_success \
      'Update file with spaces in file name' \
      'echo Ok then >>"G g/with spaces.txt" &&
-      cat "$TEST_DIRECTORY"/test9200a.png >>"G g/with spaces.png" && \
+      cat "$TEST_DIRECTORY"/test-image1.png >>"G g/with spaces.png" && \
       git add "G g/with spaces.png" &&
       git commit -a -m "Update with spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
@@ -202,7 +202,7 @@ test_expect_success \
      'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
       echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
-      cp "$TEST_DIRECTORY"/test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+      cp "$TEST_DIRECTORY"/test-image1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
       git commit -a -m "Går det så går det" && \
       id=$(git rev-list --max-count=1 HEAD) &&
t/test-image1.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..7b181d15cebb4c86a6ad7fed3dbf30ce2223b4c5
GIT binary patch
t/test-image2.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..ac22ccbd3ee9f03a3b38249ac8efdbe96b5da2cd
GIT binary patch
t/test4012.png deleted binary +0 -0
deleted file mode 100644
index 7b181d15cebb4c86a6ad7fed3dbf30ce2223b4c5..0000000000000000000000000000000000000000
GIT binary patch
t/test9200a.png deleted binary +0 -0
deleted file mode 100644
index 7b181d15cebb4c86a6ad7fed3dbf30ce2223b4c5..0000000000000000000000000000000000000000
GIT binary patch
t/test9200b.png deleted binary +0 -0
deleted file mode 100644
index ac22ccbd3ee9f03a3b38249ac8efdbe96b5da2cd..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 5 lines · Vitaliy Ivanov

---

Quoted 1 line

From bff3916939fcd226278a2e983ddc77bb711296e7 Mon Sep 17 00:00:00 2001

From: Vitaliy Ivanov <[email protected]>
Date: Tue, 19 Jul 2011 20:07:08 +0300
Subject: [PATCH] tests: cleanup binary images usage

Thanks.

Drop the above five lines and replace them with a single "-- >8 --" line. The lone "---" line is especially harmful as it tells our tools to stop reading anything below when finding your commit log message.

Quoted 3 lines

Images are being shared between tests and this is OK. By this patch I name images independently of tests plus remove unneeded images.

The point of these test vector files are that they are binary and it is secondary that they happen to be images.

Perhaps like this.

Hi, list,

Extra and redundant explanation that you could have just let your proposed commit log message speak for itself comes here, if you really need one.

-- >8 --
tests: cleanup binary test vector files

The test4012.png test vector file that was originally used for t4012 to check operations on binary files was later reused in other tests, making it no longer consistent to name it after a specific test. Rename it to more generic "test-binary-1.png".

While at it, rename test9200b to "test-binary-2.png" (even though it is only used by t9200).

---
<<diffstat and patch here>>

Quoted 10 lines
---
 t/t3307-notes-man.sh           |    6 +++---
 t/t4012-diff-binary.sh         |    2 +-
 t/t6023-merge-file.sh          |    2 +-
 t/t6027-merge-binary.sh        |    2 +-
 t/t9200-git-cvsexportcommit.sh |   14 +++++++-------
 t/test-image1.png              |  Bin 0 -> 5660 bytes
 t/test-image2.png              |  Bin 0 -> 275 bytes
 t/test4012.png                 |  Bin 5660 -> 0 bytes
Quoted 8 lines
 t/test9200a.png                |  Bin 5660 -> 0 bytes
 t/test9200b.png                |  Bin 275 -> 0 bytes
 10 files changed, 13 insertions(+), 13 deletions(-)
 create mode 100644 t/test-image1.png
 create mode 100644 t/test-image2.png
 delete mode 100644 t/test4012.png
 delete mode 100644 t/test9200a.png
 delete mode 100644 t/test9200b.png

Also have you considered using "format-patch -M" to send this patch?

#2 lore raw
Quoted 63 lines · Junio C Hamano
Quoted 5 lines · Vitaliy Ivanov

---

Quoted 1 line

From bff3916939fcd226278a2e983ddc77bb711296e7 Mon Sep 17 00:00:00 2001

From: Vitaliy Ivanov <[email protected]>
Date: Tue, 19 Jul 2011 20:07:08 +0300
Subject: [PATCH] tests: cleanup binary images usage

Thanks.

Drop the above five lines and replace them with a single "-- >8 --" line. The lone "---" line is especially harmful as it tells our tools to stop reading anything below when finding your commit log message.

Quoted 3 lines

Images are being shared between tests and this is OK. By this patch I name images independently of tests plus remove unneeded images.

The point of these test vector files are that they are binary and it is secondary that they happen to be images.

Perhaps like this.

Hi, list,

Extra and redundant explanation that you could have just let your proposed commit log message speak for itself comes here, if you really need one.

-- >8 --
tests: cleanup binary test vector files

The test4012.png test vector file that was originally used for t4012 to check operations on binary files was later reused in other tests, making it no longer consistent to name it after a specific test. Rename it to more generic "test-binary-1.png".

While at it, rename test9200b to "test-binary-2.png" (even though it is only used by t9200).

---
<<diffstat and patch here>>

Quoted 10 lines
---
 t/t3307-notes-man.sh           |    6 +++---
 t/t4012-diff-binary.sh         |    2 +-
 t/t6023-merge-file.sh          |    2 +-
 t/t6027-merge-binary.sh        |    2 +-
 t/t9200-git-cvsexportcommit.sh |   14 +++++++-------
 t/test-image1.png              |  Bin 0 -> 5660 bytes
 t/test-image2.png              |  Bin 0 -> 275 bytes
 t/test4012.png                 |  Bin 5660 -> 0 bytes
Quoted 8 lines
 t/test9200a.png                |  Bin 5660 -> 0 bytes
 t/test9200b.png                |  Bin 275 -> 0 bytes
 10 files changed, 13 insertions(+), 13 deletions(-)
 create mode 100644 t/test-image1.png
 create mode 100644 t/test-image2.png
 delete mode 100644 t/test4012.png
 delete mode 100644 t/test9200a.png
 delete mode 100644 t/test9200b.png
Quoted 1 line

Also have you considered using "format-patch -M" to send this patch?

Thanks Junio for your comments. Sending updated version for this patch.

- Vitaliy

#3 lore raw

PATCH v2 1/1 tests: cleanup binary test vector files

The test4012.png test vector file that was originally used for t4012 to check operations on binary files was later reused in other tests, making it no longer consistent to name it after a specific test. Rename it to more generic "test-binary-1.png".

While at it, rename test9200b to "test-binary-2.png" (even though it is only used by t9200).

---
 t/t3307-notes-man.sh                   |    6 +++---
 t/t4012-diff-binary.sh                 |    2 +-
 t/t6023-merge-file.sh                  |    2 +-
 t/t6027-merge-binary.sh                |    2 +-
 t/t9200-git-cvsexportcommit.sh         |   14 +++++++-------
 t/{test4012.png => test-binary-1.png}  |  Bin 5660 -> 5660 bytes
 t/{test9200b.png => test-binary-2.png} |  Bin 275 -> 275 bytes
 t/test9200a.png                        |  Bin 5660 -> 0 bytes
 8 files changed, 13 insertions(+), 13 deletions(-)
 rename t/{test4012.png => test-binary-1.png} (100%)
 rename t/{test9200b.png => test-binary-2.png} (100%)
 delete mode 100644 t/test9200a.png
t/t3307-notes-man.sh +3 -3
index 2ea3be6..1aa366a 100755
@@ -26,13 +26,13 @@ test_expect_success 'example 1: notes to add an Acked-by line' '
 '
 
 test_expect_success 'example 2: binary notes' '
-	cp "$TEST_DIRECTORY"/test4012.png . &&
+	cp "$TEST_DIRECTORY"/test-binary-1.png . &&
 	git checkout B &&
-	blob=$(git hash-object -w test4012.png) &&
+	blob=$(git hash-object -w test-binary-1.png) &&
 	git notes --ref=logo add -C "$blob" &&
 	git notes --ref=logo copy B C &&
 	git notes --ref=logo show C >actual &&
-	test_cmp test4012.png actual
+	test_cmp test-binary-1.png actual
 '
 
 test_done
t/t4012-diff-binary.sh +1 -1
index 05ec062..2d9f9a0 100755
@@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \
 	'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d &&
 	 git update-index --add a b c d &&
 	 echo git >a &&
-	 cat "$TEST_DIRECTORY"/test4012.png >b &&
+	 cat "$TEST_DIRECTORY"/test-binary-1.png >b &&
 	 echo git >c &&
 	 cat b b >d'
 
t/t6023-merge-file.sh +1 -1
index d9f3439..432f086 100755
@@ -154,7 +154,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out"
 
 test_expect_success 'binary files cannot be merged' '
 	test_must_fail git merge-file -p \
-		orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
+		orig.txt "$TEST_DIRECTORY"/test-binary-1.png new1.txt 2> merge.err &&
 	grep "Cannot merge binary files" merge.err
 '
 
t/t6027-merge-binary.sh +1 -1
index b519626..0773541 100755
@@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files'
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/test4012.png >m &&
+	cat "$TEST_DIRECTORY"/test-binary-1.png >m &&
 	git add m &&
 	git ls-files -s | sed -e "s/ 0	/ 1	/" >E1 &&
 	test_tick &&
t/t9200-git-cvsexportcommit.sh +7 -7
index e5da65b..41db05c 100755
@@ -50,8 +50,8 @@ test_expect_success \
     'mkdir A B C D E F &&
      echo hello1 >A/newfile1.txt &&
      echo hello2 >B/newfile2.txt &&
-     cp "$TEST_DIRECTORY"/test9200a.png C/newfile3.png &&
-     cp "$TEST_DIRECTORY"/test9200a.png D/newfile4.png &&
+     cp "$TEST_DIRECTORY"/test-binary-1.png C/newfile3.png &&
+     cp "$TEST_DIRECTORY"/test-binary-1.png D/newfile4.png &&
      git add A/newfile1.txt &&
      git add B/newfile2.txt &&
      git add C/newfile3.png &&
@@ -76,8 +76,8 @@ test_expect_success \
      rm -f B/newfile2.txt &&
      rm -f C/newfile3.png &&
      echo Hello5  >E/newfile5.txt &&
-     cp "$TEST_DIRECTORY"/test9200b.png D/newfile4.png &&
-     cp "$TEST_DIRECTORY"/test9200a.png F/newfile6.png &&
+     cp "$TEST_DIRECTORY"/test-binary-2.png D/newfile4.png &&
+     cp "$TEST_DIRECTORY"/test-binary-1.png F/newfile6.png &&
      git add E/newfile5.txt &&
      git add F/newfile6.png &&
      git commit -a -m "Test: Remove, add and update" &&
@@ -165,7 +165,7 @@ test_expect_success \
      'mkdir "G g" &&
       echo ok then >"G g/with spaces.txt" &&
       git add "G g/with spaces.txt" && \
-      cp "$TEST_DIRECTORY"/test9200a.png "G g/with spaces.png" && \
+      cp "$TEST_DIRECTORY"/test-binary-1.png "G g/with spaces.png" && \
       git add "G g/with spaces.png" &&
       git commit -a -m "With spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
@@ -177,7 +177,7 @@ test_expect_success \
 test_expect_success \
      'Update file with spaces in file name' \
      'echo Ok then >>"G g/with spaces.txt" &&
-      cat "$TEST_DIRECTORY"/test9200a.png >>"G g/with spaces.png" && \
+      cat "$TEST_DIRECTORY"/test-binary-1.png >>"G g/with spaces.png" && \
       git add "G g/with spaces.png" &&
       git commit -a -m "Update with spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
@@ -202,7 +202,7 @@ test_expect_success \
      'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
       echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
-      cp "$TEST_DIRECTORY"/test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
+      cp "$TEST_DIRECTORY"/test-binary-1.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
       git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png &&
       git commit -a -m "Går det så går det" && \
       id=$(git rev-list --max-count=1 HEAD) &&
t/test-binary-1.png renamed from t/test4012.png +0 -0
similarity index 100%
rename from t/test4012.png
rename to t/test-binary-1.png
t/test-binary-2.png renamed from t/test9200b.png +0 -0
similarity index 100%
rename from t/test9200b.png
rename to t/test-binary-2.png
t/test9200a.png deleted binary +0 -0
deleted file mode 100644
index 7b181d15cebb4c86a6ad7fed3dbf30ce2223b4c5..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
1.7.4.1