tests/test-dirstate-read-race.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 26 Feb 2023 07:02:13 +0100
branchstable
changeset 50230 e5fea4f1b052
parent 50229 7169ff59a2f8
child 50231 0f483a2c29e7
permissions -rw-r--r--
dirstate: check dirstate race condition around commit Once in a while, rhg is the only one to behave right here.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50229
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     1
==============================================================================
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     2
Check potential race conditions between a dirstate's read and other operations
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     3
==============================================================================
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     4
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     5
Some commands, like `hg status`, do not need to take the wlock but need to
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     6
access dirstate data.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     7
Other commands might update the dirstate data while this happens.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     8
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
     9
This can create issues if repository data is read in the wrong order, or for
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    10
the dirstate-v2 format where the data is contained in multiple files.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    11
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    12
This test file is meant to test various cases where such parallel operations
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    13
happen and make sure the reading process behaves fine. We do so with a `hg
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    14
status` command since it is probably the most advanced of such read-only
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    15
command.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    16
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    17
It bears simililarity with `tests/test-dirstate-status-race.t ` but tests a
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    18
different type of race.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    19
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    20
Setup
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    21
=====
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    22
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    23
  $ directories="dir dir/nested dir2"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    24
  $ first_files="dir/nested/a dir/b dir/c dir/d dir2/e f"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    25
  $ second_files="g dir/nested/h dir/i dir/j dir2/k dir2/l dir/nested/m"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    26
  $ extra_files="dir/n dir/o p q"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    27
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    28
  $ hg init reference-repo
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    29
  $ cd reference-repo
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    30
  $ mkdir -p dir/nested dir2
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    31
  $ touch -t 200001010000 $first_files $directories
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    32
  $ hg commit -Aqm "recreate a bunch of files to facilitate dirstate-v2 append"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    33
  $ touch -t 200001010010 $second_files $directories
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    34
  $ hg commit -Aqm "more files to have two commit"
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    35
  $ hg log -G -v
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    36
  @  changeset:   1:9a86dcbfb938
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    37
  |  tag:         tip
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    38
  |  user:        test
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    39
  |  date:        Thu Jan 01 00:00:00 1970 +0000
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    40
  |  files:       dir/i dir/j dir/nested/h dir/nested/m dir2/k dir2/l g
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    41
  |  description:
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    42
  |  more files to have two commit
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    43
  |
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    44
  |
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    45
  o  changeset:   0:4f23db756b09
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    46
     user:        test
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    47
     date:        Thu Jan 01 00:00:00 1970 +0000
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    48
     files:       dir/b dir/c dir/d dir/nested/a dir2/e f
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    49
     description:
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    50
     recreate a bunch of files to facilitate dirstate-v2 append
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    51
  
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    52
  
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    53
  $ hg manifest
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    54
  dir/b
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    55
  dir/c
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    56
  dir/d
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    57
  dir/i
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    58
  dir/j
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    59
  dir/nested/a
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    60
  dir/nested/h
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    61
  dir/nested/m
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    62
  dir2/e
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    63
  dir2/k
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    64
  dir2/l
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    65
  f
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    66
  g
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    67
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    68
Add some unknown files and refresh the dirstate
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    69
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    70
  $ touch -t 200001010020 $extra_files
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    71
  $ hg add dir/o
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    72
  $ hg remove dir/nested/m
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    73
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    74
  $ hg st --config devel.dirstate.v2.data_update_mode=force-new
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    75
  A dir/o
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    76
  R dir/nested/m
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    77
  ? dir/n
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    78
  ? p
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    79
  ? q
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    80
  $ hg debugstate
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    81
  n 644          0 2000-01-01 00:00:00 dir/b
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    82
  n 644          0 2000-01-01 00:00:00 dir/c
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    83
  n 644          0 2000-01-01 00:00:00 dir/d
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    84
  n 644          0 2000-01-01 00:10:00 dir/i
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    85
  n 644          0 2000-01-01 00:10:00 dir/j
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    86
  n 644          0 2000-01-01 00:00:00 dir/nested/a
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    87
  n 644          0 2000-01-01 00:10:00 dir/nested/h
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    88
  r ?????????????????????????????????? dir/nested/m (glob)
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    89
  a ?????????????????????????????????? dir/o (glob)
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    90
  n 644          0 2000-01-01 00:00:00 dir2/e
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    91
  n 644          0 2000-01-01 00:10:00 dir2/k
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    92
  n 644          0 2000-01-01 00:10:00 dir2/l
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    93
  n 644          0 2000-01-01 00:00:00 f
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    94
  n 644          0 2000-01-01 00:10:00 g
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    95
  $ hg debugstate > ../reference
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    96
  $ cd ..
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    97
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    98
Actual Testing
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    99
==============
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   100
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   101
Race with a `hg add`
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   102
-------------------
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   103
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   104
  $ cp -a reference-repo race-with-add
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   105
  $ cd race-with-add
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   106
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   107
spin a `hg status` with some caches to update
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   108
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   109
  $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   110
  > --config rhg.on-unsupported=abort \
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   111
  > --config devel.sync.dirstate.pre-read-file=$TESTTMP/status-race-lock \
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   112
  > &
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   113
  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   114
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   115
Add a file
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   116
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   117
  $ hg add dir/n $d2args
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   118
  $ touch $TESTTMP/status-race-lock
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   119
  $ wait
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   120
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   121
The file should in a "added" state
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   122
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   123
  $ hg status
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   124
  A dir/n
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   125
  A dir/o
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   126
  R dir/nested/m
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   127
  ? p
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   128
  ? q
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   129
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   130
The status process should return a consistent result and not crash.
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   131
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   132
  $ cat $TESTTMP/status-race-lock.out
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   133
  A dir/n
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   134
  A dir/o
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   135
  R dir/nested/m
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   136
  ? p
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   137
  ? q
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   138
  $ cat $TESTTMP/status-race-lock.log
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   139
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   140
final cleanup
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   141
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   142
  $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting
7169ff59a2f8 dirstate: initial creation of a test file to check dirstate race read
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
   143
  $ cd ..
50230
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   144
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   145
Race with a `hg commit`
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   146
-----------------------
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   147
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   148
  $ cp -a reference-repo race-with-commit
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   149
  $ cd race-with-commit
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   150
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   151
spin a `hg status with some cache to update
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   152
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   153
  $ hg st >$TESTTMP/status-race-lock.out 2>$TESTTMP/status-race-lock.log \
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   154
  > --config rhg.on-unsupported=abort \
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   155
  > --config devel.sync.dirstate.pre-read-file=$TESTTMP/status-race-lock \
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   156
  > &
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   157
  $ $RUNTESTDIR/testlib/wait-on-file 5 $TESTTMP/status-race-lock.waiting
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   158
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   159
Add a do a commit
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   160
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   161
  $ hg status
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   162
  A dir/o
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   163
  R dir/nested/m
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   164
  ? dir/n
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   165
  ? p
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   166
  ? q
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   167
  $ hg commit -m 'racing commit'
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   168
  $ touch $TESTTMP/status-race-lock
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   169
  $ wait
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   170
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   171
commit was created, and status is now clean
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   172
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   173
  $ hg log -GT '{node|short} {desc}\n'
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   174
  @  02a67a77ee9b racing commit
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   175
  |
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   176
  o  9a86dcbfb938 more files to have two commit
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   177
  |
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   178
  o  4f23db756b09 recreate a bunch of files to facilitate dirstate-v2 append
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   179
  
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   180
  $ hg status
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   181
  ? dir/n
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   182
  ? p
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   183
  ? q
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   184
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   185
The status process should return a consistent result and not crash.
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   186
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   187
  $ cat $TESTTMP/status-race-lock.out
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   188
  M dir/o (known-bad-output no-rhg !)
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   189
  ? dir/n
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   190
  ? p
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   191
  ? q
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   192
  $ cat $TESTTMP/status-race-lock.log
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   193
  warning: ignoring unknown working parent 02a67a77ee9b! (known-bad-output no-rhg !)
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   194
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   195
final cleanup
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   196
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   197
  $ rm $TESTTMP/status-race-lock $TESTTMP/status-race-lock.waiting
e5fea4f1b052 dirstate: check dirstate race condition around commit
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 50229
diff changeset
   198
  $ cd ..