annotate tests/test-transaction-rollback-on-sigpipe.t @ 47588:eb611ecb435c

run-tests: rely on an actual executable in PATH instead of alias for `hg` The alias approach is poorly inherited by other process that the test might spawn. To solve this we use the same approach as for `python`/`python3` we write an executable file explicitly. Doing this fixes `which hg` invocation that now returns the same location as `hg`. Using chg server side has some minor effect on some stdout/stderr ordering when using `chg` as the server too. Differential Revision: https://phab.mercurial-scm.org/D11053
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 09 Jul 2021 22:37:24 +0200
parents ed81f2be5527
children a8d1adeeba87
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
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
5 $ hg clone -e "\"$PYTHON\" \"$RUNTESTDIR/dummyssh\"" -q ssh://user@dummy/`pwd`/remote local
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]
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
27 > pretxnchangegroup.00-break-things="$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"
45736
2c6b054e22d0 test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff changeset
29 > EOF
2c6b054e22d0 test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff changeset
30
47555
452795b0b69a test: clarify some output in `test-transaction-rollback-on-sigpipe`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47306
diff changeset
31 $ 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
32 000000000000
45736
2c6b054e22d0 test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff changeset
33 $ cd local
2c6b054e22d0 test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff changeset
34 $ echo foo > foo ; hg commit -qAm "commit"
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
35 $ hg push -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --remotecmd "$remotecmd"
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
36 pushing to ssh://user@dummy/$TESTTMP/remote
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
37 searching for changes
47588
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
38 remote: adding changesets (py3 !)
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
39 remote: adding manifests (py3 !)
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
40 remote: adding file changes (py3 !)
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
41 remote: adding changesets (no-py3 no-chg !)
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
42 remote: adding manifests (no-py3 no-chg !)
eb611ecb435c run-tests: rely on an actual executable in PATH instead of alias for `hg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47557
diff changeset
43 remote: adding file changes (no-py3 no-chg !)
45736
2c6b054e22d0 test: add test-transaction-rollback-on-sigpipe.t demonstrating py3 regression
Mitchell Plamann <mplamann@janestreet.com>
parents:
diff changeset
44 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
45 [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
46 $ 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
47 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
48 SIGPIPE-HELPER: Mercurial started
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: Redirection in place
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
50 SIGPIPE-HELPER: SYNCFILE1 detected
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
51 SIGPIPE-HELPER: pipes closed
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: 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
53 SIGPIPE-HELPER: Shutting down
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
54 SIGPIPE-HELPER: Server process terminated
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
55 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
56
47306
aa07bcc4f505 test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 47301
diff changeset
57 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
58 $ 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
59 000000000000
47306
aa07bcc4f505 test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 47301
diff changeset
60 $ hg --cwd ../remote recover
aa07bcc4f505 test: remove some unnecessary dependency on repo format
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 47301
diff changeset
61 no interrupted transaction available
45737
b3e8d8e4a40d hook: ignore EPIPE when flushing stdout/stderr
Mitchell Plamann <mplamann@janestreet.com>
parents: 45736
diff changeset
62 [1]