# HG changeset patch # User Pierre-Yves David # Date 1580544876 -3600 # Node ID 5f55b5c35630b9db3ddd8b95bda87c214a02ab18 # Parent ee0959e7d4350e37965dbaff03a529c85703b513 test: simplify test-amend.t to avoid race condition 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 and the test started failing again. This is a graft on stable of 141ceec06b55 which should have targeted for stable. Differential Revision: https://phab.mercurial-scm.org/D8103 diff -r ee0959e7d435 -r 5f55b5c35630 tests/test-amend.t --- a/tests/test-amend.t Sun Feb 09 01:34:37 2020 +0100 +++ b/tests/test-amend.t Sat Feb 01 09:14:36 2020 +0100 @@ -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 < $TESTTMP/touchy_editor.sh < 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