Mercurial > hg
annotate tests/testlib/wait-on-file @ 48670:6d2ddea0721a stable
stream-clone: filter possible missing requirements using all supported one
The `supportedformat` requirements is missing some important requirements and it
seems better to filter out with all requirements we know, not just an
"arbitrary" subset.
The `supportedformat` set is lacking some important requirements (for example
`revlog-compression-zstd`). This is getting fixed on default (for Mercurial 6.1)
However, fixing that in 6.1 means the stream requirements sent over the wire
will contains more items. And if we don't apply this fix on older version, they
might end up complaining about lacking support for feature they actually support
for years.
This patch does not fix the deeper problem (advertised stream requirement
lacking some of them), but focus on the trivial part : Lets use the full set of
supported requirement for looking for unsupported ones.
This patch should be simple to backport to older version of Mercurial and
packager should be encouraged to do so.
This is a graft of d9017df70135 from default.
Differential Revision: https://phab.mercurial-scm.org/D12091
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 24 Jan 2022 11:49:06 +0100 |
parents | 9d7d53771e5f |
children | a68b37524d50 |
rev | line source |
---|---|
44780
f727939f3513
tests: use regular POSIX shell
Joerg Sonnenberger <joerg@bec.de>
parents:
44744
diff
changeset
|
1 #!/bin/sh |
44631
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 # |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 # wait up to TIMEOUT seconds until a WAIT_ON_FILE is created. |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
4 # |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
5 # In addition, this script can create CREATE_FILE once it is ready to wait. |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 if [ $# -lt 2 ] || [ $# -gt 3 ]; then |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 echo $# |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 echo "USAGE: $0 TIMEOUT WAIT_ON_FILE [CREATE_FILE]" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 fi |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 timer="$1" |
44632
82543879b48e
testlib: adjust wait-on-file timeout according to the global test timeout
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44631
diff
changeset
|
13 |
44818
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
14 # Scale the timeout to match the sleep steps below, i.e. 1/0.02. |
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
15 timer=$(( 50 * $timer )) |
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
16 # If the test timeout have been extended, also scale the timer relative |
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
17 # to the normal timing. |
44632
82543879b48e
testlib: adjust wait-on-file timeout according to the global test timeout
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44631
diff
changeset
|
18 if [ "$HGTEST_TIMEOUT_DEFAULT" -lt "$HGTEST_TIMEOUT" ]; then |
44818
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
19 timer=$(( ( $timer * $HGTEST_TIMEOUT) / $HGTEST_TIMEOUT_DEFAULT )) |
44632
82543879b48e
testlib: adjust wait-on-file timeout according to the global test timeout
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44631
diff
changeset
|
20 fi |
82543879b48e
testlib: adjust wait-on-file timeout according to the global test timeout
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44631
diff
changeset
|
21 |
44631
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 wait_on="$2" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 create="" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 if [ $# -eq 3 ]; then |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 create="$3" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
26 fi |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
27 |
44780
f727939f3513
tests: use regular POSIX shell
Joerg Sonnenberger <joerg@bec.de>
parents:
44744
diff
changeset
|
28 if [ -n "$create" ]; then |
44631
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 touch "$create" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 create="" |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 fi |
44780
f727939f3513
tests: use regular POSIX shell
Joerg Sonnenberger <joerg@bec.de>
parents:
44744
diff
changeset
|
32 while [ "$timer" -gt 0 ] && [ ! -f "$wait_on" ]; do |
44727
694d40416d62
wait-on-file: use proper variable in math
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
44726
diff
changeset
|
33 timer=$(( $timer - 1)) |
44818
9d7d53771e5f
tests: fix timer scaling in wait-on-file
Joerg Sonnenberger <joerg@bec.de>
parents:
44780
diff
changeset
|
34 sleep 0.02 |
44631
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 done |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
36 if [ "$timer" -le 0 ]; then |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
37 echo "file not created after $1 seconds: $wait_on" >&2 |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
38 exit 1 |
1ed6293fc31b
testlib: add a small scrip to help process to synchronise using file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
39 fi |