Mercurial > hg
changeset 49201:c29e79d11b01 stable
test-dirstate: actually test the append code path in dirstate v2
Apparently it's not sufficient to modify a file to force the dirstate
write-out, so the append code path was untested.
By removing a file instead of changing we're forcing append to happen.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Tue, 17 May 2022 14:59:25 +0100 |
parents | 477b5145e1a0 |
children | 2d0e22171ef9 |
files | tests/test-dirstate.t |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-dirstate.t Tue May 17 00:09:51 2022 +0100 +++ b/tests/test-dirstate.t Tue May 17 14:59:25 2022 +0100 @@ -132,6 +132,10 @@ > hg debugstate --docket | grep uuid | sed 's/.*uuid: \(.*\)/\1/' > } + $ find_dirstate_data_size () { + > hg debugstate --docket | grep 'size of dirstate data' | sed 's/.*size of dirstate data: \(.*\)/\1/' + > } + $ dirstate_uuid_has_not_changed () { > # Non-Rust always rewrites the whole dirstate > if [ $# -eq 1 ] || ([ -n "$HGMODULEPOLICY" ] && [ -z "${HGMODULEPOLICY##*rust*}" ]) || [ -n "$RHG_INSTALLED_AS_HG" ]; then @@ -162,13 +166,19 @@ Trigger an append with a small change - $ echo "modified" > dir2/f + $ current_data_size=$(find_dirstate_data_size) + $ rm dir2/f $ hg st - M dir2/f + ! dir2/f $ dirstate_data_files | wc -l *1 (re) $ dirstate_uuid_has_not_changed not testing because using Python implementation (no-rust no-rhg !) + $ new_data_size=$(find_dirstate_data_size) + $ [ "$current_data_size" -eq "$new_data_size" ]; echo $? + 0 (no-rust no-rhg !) + 1 (rust !) + 1 (no-rust rhg !) Unused bytes counter is non-0 when appending $ touch file @@ -177,8 +187,8 @@ Trigger a rust/rhg run which updates the unused bytes value $ hg st - M dir2/f A file + ! dir2/f $ dirstate_data_files | wc -l *1 (re) $ dirstate_uuid_has_not_changed