git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add a 1-second sleep to git-cvsexportcommit test

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 23, 2007, 04:32 UTC
Message-ID
<7vd4yjoi2w.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<11851631511468-git-send-email-jasonsewall@gmail.com>
Jason Sewall <jasonsewall@gmail.com> writes:
Show 18 quoted lines
> Test #7 of t9200 isn't likely to succeed because tests are executed too fast for cvs; add a delay to give it a chance to succeed.
> ---
>  I think I didn't send this through the proper server, so here it is finally.
>  t/t9200-git-cvsexportcommit.sh |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
> index 4efa0c9..2096e59 100755
> --- a/t/t9200-git-cvsexportcommit.sh
> +++ b/t/t9200-git-cvsexportcommit.sh
> @@ -164,6 +164,7 @@ test_expect_success \
>        git add "G g/with spaces.png" &&
>        git commit -a -m "Update with spaces" &&
>        id=$(git rev-list --max-count=1 HEAD) &&
> +      sleep 1 &&
>        (cd "$CVSWORK" &&
>        git-cvsexportcommit -c $id
>        test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/"
Thanks.

But this makes one wonder why only this test and nothing else is affected. Maybe our machines are not fast enough for other tests to execute inside a second, but in 6 months others start to become problem and we would need a similar fix again?

I am tempted to do this instead, although it would make it much slower.

It may be that we may want to fix this inside cvsexportcommit itself, instead of working it around in the tests. If somebody tries to push more than one commit from git using two cvsexportcommit in a row, he would need to make sure that the second run happens one or more seconds after the first run, otherwise he will see the exact corruption in real life.

Anybody else have better ideas?  
---
 t/t9200-git-cvsexportcommit.sh |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 4efa0c9..28c7dfa 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -28,6 +28,13 @@ git add empty &&
 git commit -q -a -m "Initial" 2>/dev/null ||
 exit 1
 
+git_cvsexportcommit () {
+	# CVS does not even look at files whose timestamps
+	# match the ones recorded in CVS/Entries
+	sleep 2 &&
+	git cvsexportcommit "$@"
+}
+
 test_expect_success \
     'New file' \
     'mkdir A B C D E F &&
@@ -42,7 +49,7 @@ test_expect_success \
      git commit -a -m "Test: New file" &&
      id=$(git rev-list --max-count=1 HEAD) &&
      (cd "$CVSWORK" &&
-     git cvsexportcommit -c $id &&
+     git_cvsexportcommit -c $id &&
      test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.1/" &&
      test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "newfile2.txt/1.1/" &&
      test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "newfile3.png/1.1/-kb" &&
@@ -66,7 +73,7 @@ test_expect_success \
      git commit -a -m "Test: Remove, add and update" &&
      id=$(git rev-list --max-count=1 HEAD) &&
      (cd "$CVSWORK" &&
-     git cvsexportcommit -c $id &&
+     git_cvsexportcommit -c $id &&
      test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.2/" &&
      test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
      test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
@@ -88,7 +95,7 @@ test_expect_success \
      git commit -a -m "generation 2" &&
      id=$(git rev-list --max-count=1 HEAD) &&
      (cd "$CVSWORK" &&
-     ! git cvsexportcommit -c $id
+     ! git_cvsexportcommit -c $id
      )'
 
 #test_expect_success \
@@ -100,7 +107,7 @@ test_expect_success \
 #     git commit -a -m "generation 3" &&
 #     id=$(git rev-list --max-count=1 HEAD) &&
 #     (cd "$CVSWORK" &&
-#     ! git cvsexportcommit -c $id
+#     ! git_cvsexportcommit -c $id
 #     )'
 
 # We reuse the state from two tests back here
@@ -114,7 +121,7 @@ test_expect_success \
      git commit -a -m "test: remove only a binary file" &&
      id=$(git rev-list --max-count=1 HEAD) &&
      (cd "$CVSWORK" &&
-     git cvsexportcommit -c $id &&
+     git_cvsexportcommit -c $id &&
      test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.2/" &&
      test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
      test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
@@ -132,7 +139,7 @@ test_expect_success \
      git commit -a -m "test: remove only a binary file" &&
      id=$(git rev-list --max-count=1 HEAD) &&
      (cd "$CVSWORK" &&
-     git cvsexportcommit -c $id &&
+     git_cvsexportcommit -c $id &&
      test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
      test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
      test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" &&
@@ -153,7 +160,7 @@ test_expect_success \
       git commit -a -m "With spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
       (cd "$CVSWORK" &&
-      git-cvsexportcommit -c $id &&
+      git_cvsexportcommit -c $id &&
       test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.1/-kb with spaces.txt/1.1/"
       )'
 
@@ -165,7 +172,7 @@ test_expect_success \
       git commit -a -m "Update with spaces" &&
       id=$(git rev-list --max-count=1 HEAD) &&
       (cd "$CVSWORK" &&
-      git-cvsexportcommit -c $id
+      git_cvsexportcommit -c $id
       test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/"
       )'
 
@@ -190,7 +197,7 @@ test_expect_success \
       git commit -a -m "Går det så går det" && \
       id=$(git rev-list --max-count=1 HEAD) &&
       (cd "$CVSWORK" &&
-      git-cvsexportcommit -v -c $id &&
+      git_cvsexportcommit -v -c $id &&
       test "$(echo $(sort Å/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/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/"
       )'
 
@@ -208,7 +215,7 @@ test_expect_success \
       git commit -a -m "Update two" &&
       id=$(git rev-list --max-count=1 HEAD) &&
       (cd "$CVSWORK" &&
-      ! git-cvsexportcommit -c $id
+      ! git_cvsexportcommit -c $id
       )'
 
 case "$(git repo-config --bool core.filemode)" in
@@ -225,7 +232,7 @@ test_expect_success \
       git add G/off &&
       git commit -a -m "Execute test" &&
       (cd "$CVSWORK" &&
-      git-cvsexportcommit -c HEAD
+      git_cvsexportcommit -c HEAD
       test -x G/on &&
       ! test -x G/off
       )'
Previous: Jason SewallNext: Simon 'corecode' Schubert
Message 7 of 21 in “Test #7 in t9200-git-cvsexportcommit fails”
  1. Jason SewallJul 22, 2007
  2. Alex RiesenJul 22, 2007
  3. Jason SewallJul 22, 2007
  4. Alex RiesenJul 22, 2007
  5. Junio C HamanoJul 22, 2007
  6. Add a 1-second sleep to git-cvsexportcommit testJason Sewall, Jul 23, 2007
  7. Junio C HamanoJul 23, 2007
  8. Simon 'corecode' SchubertJul 23, 2007
  9. Robin RosenbergJul 24, 2007
  10. Simon 'corecode' SchubertJul 24, 2007
  11. Robin RosenbergJul 24, 2007
  12. Simon 'corecode' SchubertJul 24, 2007
  13. Robin RosenbergJul 24, 2007
  14. Junio C HamanoJul 24, 2007
  15. Robin RosenbergJul 24, 2007
  16. Jason SewallJul 24, 2007
  17. Linus TorvaldsJul 24, 2007
  18. Robin RosenbergJul 24, 2007
  19. Linus TorvaldsJul 24, 2007
  20. Andy ParkinsJul 25, 2007
  21. Marius Storm-OlsenJul 25, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.