Patchwork D8065: test: simplify test-amend.t to avoid race condition

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2020, 2:09 p.m.
Message ID <differential-rev-PHID-DREV-nnmklkpyvwurc5qhg634-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44864/
State Superseded
Headers show

Comments

phabricator - Feb. 1, 2020, 2:09 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Insted on relying on sleep, we could simply have the editor do the file change.
  This remove the reliance on "sleep" and avoid test failing on heavy load
  machine.
  
  To test this, I reverted the code change in 5558e3437872 <https://phab.mercurial-scm.org/rHG5558e3437872ea4bb2fa8368f62003fcd7753230> and the test started
  failing again.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D8065

AFFECTED FILES
  tests/test-amend.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -485,14 +485,14 @@ 
   $ echo r0 > foo; hg commit -qAm "r0"
   $ echo alpha > foo; hg commit -qm "alpha"
   $ echo beta >> foo
-  $ cat > $TESTTMP/sleepy_editor.sh <<EOF
+  $ cat > $TESTTMP/touchy_editor.sh <<EOF
+  > sleep 1
+  > echo delta >> $TESTTMP/modify-during-amend/foo
+  > sleep 1
   > echo hi > "\$1"
-  > sleep 3
+  > sleep 1
   > EOF
-  $ HGEDITOR="sh $TESTTMP/sleepy_editor.sh" hg commit --amend &
-  $ sleep 1
-  $ echo delta >> foo
-  $ sleep 3
+  $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend
   $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
   >   echo "OK."
   > else