Mercurial > hg
annotate tests/test-transaction-rollback-on-sigpipe.t @ 51316:178e50edb4f8
changelog: stop useless enforcing split at the end of transaction
Changelogs are no longer created inline, and existing changelogs are
automatically split. Since we now enforce splitting at the start of any write,
we don't need to enforce splitting at the end of the transaction.
This has the nice side effect of killing the only user of "side_write".
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 11 Jan 2024 16:35:52 +0100 |
parents | 9c4204b7f3e4 |
children |
rev | line source |
---|---|
47306
aa07bcc4f505
test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47301
diff
changeset
|
1 Test that, when an hg push is interrupted and the remote side receives SIGPIPE, |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
2 the remote hg is able to successfully roll back the transaction. |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
3 |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
4 $ hg init -q remote |
47920
9c4204b7f3e4
tests: rely on dummyssh being the default
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47618
diff
changeset
|
5 $ hg clone -q ssh://user@dummy/`pwd`/remote local |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
6 $ SIGPIPE_REMOTE_DEBUG_FILE="$TESTTMP/DEBUGFILE" |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
7 $ SYNCFILE1="$TESTTMP/SYNCFILE1" |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
8 $ SYNCFILE2="$TESTTMP/SYNCFILE2" |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
9 $ export SIGPIPE_REMOTE_DEBUG_FILE |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
10 $ export SYNCFILE1 |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
11 $ export SYNCFILE2 |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
12 $ PYTHONUNBUFFERED=1 |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
13 $ export PYTHONUNBUFFERED |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
14 |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
15 On the remote end, run hg, piping stdout and stderr through processes that we |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
16 know the PIDs of. We will later kill these to simulate an ssh client |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
17 disconnecting. |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
18 |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
19 $ remotecmd="$RUNTESTDIR/testlib/sigpipe-remote.py" |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
20 |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
21 In the pretxnchangegroup hook, kill the PIDs recorded above to simulate ssh |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
22 disconnecting. Then exit nonzero, to force a transaction rollback. |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
23 |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
24 |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
25 $ cat >remote/.hg/hgrc <<EOF |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
26 > [hooks] |
47615
a8d1adeeba87
test-sigpipe: run the hook using `sh`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47588
diff
changeset
|
27 > pretxnchangegroup.00-break-things=sh "$RUNTESTDIR/testlib/wait-on-file" 10 "$SYNCFILE2" "$SYNCFILE1" |
47556
640fdb7fd67b
test: make sure we hit the SIGPIPE in test-transaction-rollback-on-sigpipe
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47555
diff
changeset
|
28 > pretxnchangegroup.01-output-things=echo "some remote output to be forward to the closed pipe" |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
29 > pretxnchangegroup.02-output-things=echo "some more remote output" |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
30 > EOF |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
31 |
47555
452795b0b69a
test: clarify some output in `test-transaction-rollback-on-sigpipe`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47306
diff
changeset
|
32 $ hg --cwd ./remote tip -T '{node|short}\n' |
452795b0b69a
test: clarify some output in `test-transaction-rollback-on-sigpipe`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47306
diff
changeset
|
33 000000000000 |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
34 $ cd local |
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
35 $ echo foo > foo ; hg commit -qAm "commit" |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
36 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
37 (use quiet to avoid flacky output from the server) |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
38 |
47920
9c4204b7f3e4
tests: rely on dummyssh being the default
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47618
diff
changeset
|
39 $ hg push --quiet --remotecmd "$remotecmd" |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
40 abort: stream ended unexpectedly (got 0 bytes, expected 4) |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
41 [255] |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
42 $ cat $SIGPIPE_REMOTE_DEBUG_FILE |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
43 SIGPIPE-HELPER: Starting |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
44 SIGPIPE-HELPER: Redirection in place |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
45 SIGPIPE-HELPER: pipes closed in main |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
46 SIGPIPE-HELPER: SYNCFILE1 detected |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
47 SIGPIPE-HELPER: worker killed |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
48 SIGPIPE-HELPER: creating SYNCFILE2 |
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
49 SIGPIPE-HELPER: Shutting down |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
50 SIGPIPE-HELPER: Server process terminated with status 255 (no-windows !) |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
51 SIGPIPE-HELPER: Server process terminated with status 1 (windows !) |
47557
ed81f2be5527
test: use a python script in `test-transaction-rollback-on-sigpipe.t`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47556
diff
changeset
|
52 SIGPIPE-HELPER: Shut down |
45736
2c6b054e22d0
test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff
changeset
|
53 |
47306
aa07bcc4f505
test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47301
diff
changeset
|
54 The remote should be left in a good state |
47555
452795b0b69a
test: clarify some output in `test-transaction-rollback-on-sigpipe`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47306
diff
changeset
|
55 $ hg --cwd ../remote tip -T '{node|short}\n' |
452795b0b69a
test: clarify some output in `test-transaction-rollback-on-sigpipe`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47306
diff
changeset
|
56 000000000000 |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
57 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
58 #if windows |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
59 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
60 XXX-Windows Broken behavior to be fixed |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
61 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
62 Behavior on Windows is broken and should be fixed. However this is a fairly |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
63 corner case situation and no data are being corrupted. This would affect |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
64 central repository being hosted on a Windows machine and accessed using ssh. |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
65 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
66 This was catch as we setup new CI for Windows. Making the test pass on Windows |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
67 was enough of a pain that fixing the behavior set aside for now. Dear and |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
68 honorable reader, feel free to fix it. |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
69 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
70 $ hg --cwd ../remote recover |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
71 rolling back interrupted transaction |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
72 (verify step skipped, run `hg verify` to check your repository content) |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
73 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
74 #else |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
75 |
47306
aa07bcc4f505
test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47301
diff
changeset
|
76 $ hg --cwd ../remote recover |
aa07bcc4f505
test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
47301
diff
changeset
|
77 no interrupted transaction available |
45737
b3e8d8e4a40d
hook: ignore EPIPE when flushing stdout/stderr
Mitchell Plamann <mplamann@janestreet.com>
parents:
45736
diff
changeset
|
78 [1] |
47618
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
79 |
27ff81547d35
sigpipe-remote: simply delegate pipe forwarding to subprocess we can kill
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47615
diff
changeset
|
80 #endif |