Mercurial > public > mercurial-scm > hg
changeset 52358:11484a19cd77
stream: rename all test hook point one number up
This leave room for a new hook point earlier to detect some race condition with
caches.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 04 Dec 2024 17:13:39 +0100 |
parents | a260d326458f |
children | 3f0cf7bb3086 |
files | mercurial/streamclone.py tests/test-clone-stream-revlog-split.t tests/test-clone-stream.t tests/test-persistent-nodemap-stream-clone.t tests/testlib/ext-stream-clone-steps.py |
diffstat | 5 files changed, 50 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/streamclone.py Mon Dec 02 17:00:12 2024 +0100 +++ b/mercurial/streamclone.py Wed Dec 04 17:13:39 2024 +0100 @@ -277,8 +277,8 @@ if file_size: entries.append((f.unencoded_path, file_size)) total_bytes += file_size - _test_sync_point_walk_1(repo) - _test_sync_point_walk_2(repo) + _test_sync_point_walk_3(repo) + _test_sync_point_walk_4(repo) repo.ui.debug( b'%d files, %d bytes to transfer\n' % (len(entries), total_bytes) @@ -813,11 +813,11 @@ progress.increment() -def _test_sync_point_walk_1(repo): +def _test_sync_point_walk_3(repo): """a function for synchronisation during tests""" -def _test_sync_point_walk_2(repo): +def _test_sync_point_walk_4(repo): """a function for synchronisation during tests""" @@ -883,8 +883,8 @@ chunks = _emit2(repo, entries) first = next(chunks) file_count, total_file_size = first - _test_sync_point_walk_1(repo) - _test_sync_point_walk_2(repo) + _test_sync_point_walk_3(repo) + _test_sync_point_walk_4(repo) return file_count, total_file_size, chunks @@ -929,8 +929,8 @@ chunks = _emit3(repo, list(entries)) first = next(chunks) assert first is None - _test_sync_point_walk_1(repo) - _test_sync_point_walk_2(repo) + _test_sync_point_walk_3(repo) + _test_sync_point_walk_4(repo) return chunks
--- a/tests/test-clone-stream-revlog-split.t Mon Dec 02 17:00:12 2024 +0100 +++ b/tests/test-clone-stream-revlog-split.t Wed Dec 04 17:13:39 2024 +0100 @@ -44,12 +44,12 @@ setup synchronisation file - $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1" - $ export HG_TEST_STREAM_WALKED_FILE_1 - $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2" - $ export HG_TEST_STREAM_WALKED_FILE_2 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3" $ export HG_TEST_STREAM_WALKED_FILE_3 + $ HG_TEST_STREAM_WALKED_FILE_4="$TESTTMP/sync_file_walked_4" + $ export HG_TEST_STREAM_WALKED_FILE_4 + $ HG_TEST_STREAM_WALKED_FILE_5="$TESTTMP/sync_file_walked_5" + $ export HG_TEST_STREAM_WALKED_FILE_5 Test stream-clone raced by a revlog-split @@ -69,12 +69,12 @@ $ ( \ > hg clone --debug --stream -U http://localhost:$HGPORT1 \ > clone-while-split --config worker.backgroundclose=0 > client.log 2>&1; \ - > touch "$HG_TEST_STREAM_WALKED_FILE_3" \ + > touch "$HG_TEST_STREAM_WALKED_FILE_5" \ > ) & Wait for the server to be done collecting data - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 trigger a split @@ -83,11 +83,11 @@ unlock the stream generation - $ touch $HG_TEST_STREAM_WALKED_FILE_2 + $ touch $HG_TEST_STREAM_WALKED_FILE_4 wait for the client to be done cloning. - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_5 Check everything is fine
--- a/tests/test-clone-stream.t Mon Dec 02 17:00:12 2024 +0100 +++ b/tests/test-clone-stream.t Wed Dec 04 17:13:39 2024 +0100 @@ -383,12 +383,12 @@ $ touch repo/f1 $ $TESTDIR/seq.py 50000 > repo/f2 $ hg -R repo ci -Aqm "0" - $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1" - $ export HG_TEST_STREAM_WALKED_FILE_1 - $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2" - $ export HG_TEST_STREAM_WALKED_FILE_2 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3" $ export HG_TEST_STREAM_WALKED_FILE_3 + $ HG_TEST_STREAM_WALKED_FILE_4="$TESTTMP/sync_file_walked_4" + $ export HG_TEST_STREAM_WALKED_FILE_4 + $ HG_TEST_STREAM_WALKED_FILE_5="$TESTTMP/sync_file_walked_5" + $ export HG_TEST_STREAM_WALKED_FILE_5 # $ cat << EOF >> $HGRCPATH # > [hooks] # > pre-clone=rm -f "$TESTTMP/sync_file_walked_*" @@ -399,13 +399,13 @@ clone while modifying the repo between stating file with write lock and actually serving file content - $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_3") & - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 + $ (hg clone -q --stream -U http://localhost:$HGPORT1 clone; touch "$HG_TEST_STREAM_WALKED_FILE_5") & + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 $ echo >> repo/f1 $ echo >> repo/f2 $ hg -R repo ci -m "1" --config ui.timeout.warn=-1 - $ touch $HG_TEST_STREAM_WALKED_FILE_2 - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 + $ touch $HG_TEST_STREAM_WALKED_FILE_4 + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_5 $ hg -R clone id 000000000000 $ hg -R clone verify --quiet
--- a/tests/test-persistent-nodemap-stream-clone.t Mon Dec 02 17:00:12 2024 +0100 +++ b/tests/test-persistent-nodemap-stream-clone.t Wed Dec 04 17:13:39 2024 +0100 @@ -79,12 +79,12 @@ setup the step-by-step stream cloning - $ HG_TEST_STREAM_WALKED_FILE_1="$TESTTMP/sync_file_walked_1" - $ export HG_TEST_STREAM_WALKED_FILE_1 - $ HG_TEST_STREAM_WALKED_FILE_2="$TESTTMP/sync_file_walked_2" - $ export HG_TEST_STREAM_WALKED_FILE_2 $ HG_TEST_STREAM_WALKED_FILE_3="$TESTTMP/sync_file_walked_3" $ export HG_TEST_STREAM_WALKED_FILE_3 + $ HG_TEST_STREAM_WALKED_FILE_4="$TESTTMP/sync_file_walked_4" + $ export HG_TEST_STREAM_WALKED_FILE_4 + $ HG_TEST_STREAM_WALKED_FILE_5="$TESTTMP/sync_file_walked_5" + $ export HG_TEST_STREAM_WALKED_FILE_5 $ cat << EOF >> test-repo/.hg/hgrc > [extensions] > steps=$RUNTESTDIR/testlib/ext-stream-clone-steps.py @@ -112,12 +112,12 @@ Do a mix of clone and commit at the same time so that the file listed on disk differ at actual transfer time. - $ (hg clone -U --stream ssh://user@dummy/test-repo stream-clone-race-1 --debug 2>> clone-output | grep -E '00(changelog|manifest)' >> clone-output; touch $HG_TEST_STREAM_WALKED_FILE_3) & - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 + $ (hg clone -U --stream ssh://user@dummy/test-repo stream-clone-race-1 --debug 2>> clone-output | grep -E '00(changelog|manifest)' >> clone-output; touch $HG_TEST_STREAM_WALKED_FILE_5) & + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 $ hg -R test-repo/ commit -m foo created new head - $ touch $HG_TEST_STREAM_WALKED_FILE_2 - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 + $ touch $HG_TEST_STREAM_WALKED_FILE_4 + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_5 $ cat clone-output adding [s] 00manifest.n (62 bytes) adding [s] 00manifest-*.nd (118 KB) (glob) @@ -174,9 +174,9 @@ Clean up after the test. - $ rm -f "$HG_TEST_STREAM_WALKED_FILE_1" - $ rm -f "$HG_TEST_STREAM_WALKED_FILE_2" $ rm -f "$HG_TEST_STREAM_WALKED_FILE_3" + $ rm -f "$HG_TEST_STREAM_WALKED_FILE_4" + $ rm -f "$HG_TEST_STREAM_WALKED_FILE_5" full regeneration ----------------- @@ -211,13 +211,13 @@ Performe the mix of clone and full refresh of the nodemap, so that the files (and filenames) are different between listing time and actual transfer time. - $ (hg clone -U --stream ssh://user@dummy/test-repo stream-clone-race-2 --debug 2>> clone-output-2 | grep -E '00(changelog|manifest)' >> clone-output-2; touch $HG_TEST_STREAM_WALKED_FILE_3) & - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_1 + $ (hg clone -U --stream ssh://user@dummy/test-repo stream-clone-race-2 --debug 2>> clone-output-2 | grep -E '00(changelog|manifest)' >> clone-output-2; touch $HG_TEST_STREAM_WALKED_FILE_5) & + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 $ rm test-repo/.hg/store/00changelog.n $ rm test-repo/.hg/store/00changelog-*.nd $ hg -R test-repo/ debugupdatecache - $ touch $HG_TEST_STREAM_WALKED_FILE_2 - $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_3 + $ touch $HG_TEST_STREAM_WALKED_FILE_4 + $ $RUNTESTDIR/testlib/wait-on-file 10 $HG_TEST_STREAM_WALKED_FILE_5 (note: the stream clone code wronly pick the `undo.` files) @@ -282,7 +282,7 @@ Clean up after the test - $ rm -f $HG_TEST_STREAM_WALKED_FILE_1 - $ rm -f $HG_TEST_STREAM_WALKED_FILE_2 $ rm -f $HG_TEST_STREAM_WALKED_FILE_3 + $ rm -f $HG_TEST_STREAM_WALKED_FILE_4 + $ rm -f $HG_TEST_STREAM_WALKED_FILE_5
--- a/tests/testlib/ext-stream-clone-steps.py Mon Dec 02 17:00:12 2024 +0100 +++ b/tests/testlib/ext-stream-clone-steps.py Wed Dec 04 17:13:39 2024 +0100 @@ -2,13 +2,13 @@ # # This extension is used through two environment variable # -# HG_TEST_STREAM_WALKED_FILE_1 +# HG_TEST_STREAM_WALKED_FILE_3 # # path of a file created by the process generating the streaming clone when # it is done gathering data and is ready to unlock the repository and move # to the streaming of content. # -# HG_TEST_STREAM_WALKED_FILE_2 +# HG_TEST_STREAM_WALKED_FILE_4 # # path of a file to be manually created to let the process generating the # streaming clone proceed to streaming file content. @@ -21,24 +21,24 @@ ) -WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1'] -WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2'] +WALKED_FILE_3 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_3'] +WALKED_FILE_4 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_4'] -def _test_sync_point_walk_1(orig, repo): - testing.write_file(WALKED_FILE_1) +def _test_sync_point_walk_3(orig, repo): + testing.write_file(WALKED_FILE_3) -def _test_sync_point_walk_2(orig, repo): +def _test_sync_point_walk_4(orig, repo): assert repo._currentlock(repo._lockref) is None - testing.wait_file(WALKED_FILE_2) + testing.wait_file(WALKED_FILE_4) def uisetup(ui): extensions.wrapfunction( - streamclone, '_test_sync_point_walk_1', _test_sync_point_walk_1 + streamclone, '_test_sync_point_walk_3', _test_sync_point_walk_3 ) extensions.wrapfunction( - streamclone, '_test_sync_point_walk_2', _test_sync_point_walk_2 + streamclone, '_test_sync_point_walk_4', _test_sync_point_walk_4 )