Mercurial > hg
annotate tests/hghave @ 46531:d46885119f90
test-copies: don't use empty file for "same content" cases
For main case (using filelog or sidedata), this lead to the following hash
change.
Changesets:
- 01c2f5eabdc4ce2bdee42b5f86311955e6c8f573 → 319179230cc87769ab3a861ebffe7a534ebb3d85
- 01c2f5eabdc4 → 319179230cc8
- c72365ee036fca4fb27fd745459bfb6ea1ac6993 → 6cbc9c2b7b391dd738603173717c601648d3735f
- c72365ee036f → 6cbc9c2b7b39
File revision for `f`:
- 0dd616bc7ab1a111921d95d76f69cda5c2ac539c → cedeacc5bf5d9b9be4d7f8394d33a5349bb29c6e
- 0dd616bc7ab1 → cedeacc5bf5d
- eb806e34ef6be4c264effd5933d31004ad15a793 → ffb76cd765422a18759a335d8a81fa2bd455be6b
- eb806e34ef6b → ffb76cd76542
- 6da5a2eecb9c833f830b67a4972366d49a9a142c → 08d1ff5926fbd0285cdeb044cbe8ab651687e86a
- 6da5a2eecb9c → 08d1ff5926fb
File revision for `d`:
- 7bded9d9da1f7bf9bf7cbfb24fe1e6ccf68ec440 → ba177bbb45ea930ee48469a55d40224537bd57a9
For the "extra in changeset" case we get the following change for file `d`:
- 68d5bca9df0577b6bc2ea30ca724e13ead60da81 → b894de5c94aadcb4894ea7c358389819c27fbcce
- 68d5bca9df05 → b894de5c94aa
- b80de5d138758541c5f05265ad144ab9fa86d1db → 56647659eff080e06e45c18ea9e848836dadea71
- b80de5d13875 → 56647659eff0
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 22 Feb 2021 18:48:45 +0100 |
parents | c102b704edb5 |
children | 23f5ed6dbcb1 |
rev | line source |
---|---|
45830
c102b704edb5
global: use python3 in shebangs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43691
diff
changeset
|
1 #!/usr/bin/env python3 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 """Test the running system for features availability. Exit with zero |
5084
80309fa23cdb
hghave: feature absence can be checked by prefixing with 'no-'
Patrick Mezard <pmezard@gmail.com>
parents:
5081
diff
changeset
|
3 if all features are there, non-zero otherwise. If a feature name is |
80309fa23cdb
hghave: feature absence can be checked by prefixing with 'no-'
Patrick Mezard <pmezard@gmail.com>
parents:
5081
diff
changeset
|
4 prefixed with "no-", the absence of feature is tested. |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 """ |
28283
544444991c83
hghave: use print function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28047
diff
changeset
|
6 |
29161
f8b274df33dc
py3: make tests/hghave use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29141
diff
changeset
|
7 from __future__ import absolute_import, print_function |
28283
544444991c83
hghave: use print function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28047
diff
changeset
|
8 |
29161
f8b274df33dc
py3: make tests/hghave use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29141
diff
changeset
|
9 import hghave |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 import optparse |
29161
f8b274df33dc
py3: make tests/hghave use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29141
diff
changeset
|
11 import os |
f8b274df33dc
py3: make tests/hghave use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents:
29141
diff
changeset
|
12 import sys |
9446
57d682d7d2da
test-gendoc: test documentation generation
Martin Geisler <mg@lazybytes.net>
parents:
9395
diff
changeset
|
13 |
16966
23f621ca04b5
tests/hghave: extract hghave.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
16891
diff
changeset
|
14 checks = hghave.checks |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
16 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 def list_features(): |
29141
ba8999547f81
hghave: switch from iteritems to items
timeless <timeless@mozdev.org>
parents:
28283
diff
changeset
|
18 for name, feature in sorted(checks.items()): |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 desc = feature[1] |
28283
544444991c83
hghave: use print function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28047
diff
changeset
|
20 print(name + ':', desc) |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
22 |
8059
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
23 def test_features(): |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
24 failed = 0 |
29141
ba8999547f81
hghave: switch from iteritems to items
timeless <timeless@mozdev.org>
parents:
28283
diff
changeset
|
25 for name, feature in checks.items(): |
8059
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
26 check, _ = feature |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
27 try: |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
28 check() |
28047
863075fd4cd0
misc: use modern exception syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
26068
diff
changeset
|
29 except Exception as e: |
28283
544444991c83
hghave: use print function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
28047
diff
changeset
|
30 print("feature %s failed: %s" % (name, e)) |
8059
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
31 failed += 1 |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
32 return failed |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
33 |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
34 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 parser = optparse.OptionParser("%prog [options] [features]") |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
36 parser.add_option( |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
37 "--test-features", action="store_true", help="test available features" |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
38 ) |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
39 parser.add_option( |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
40 "--list-features", action="store_true", help="list available features" |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
41 ) |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
42 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 |
26068
05e7f57c74ac
hghave: remove quiet option
Gregory Szorc <gregory.szorc@gmail.com>
parents:
26067
diff
changeset
|
44 def _loadaddon(): |
25732
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
45 if 'TESTDIR' in os.environ: |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
46 # loading from '.' isn't needed, because `hghave` should be |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
47 # running at TESTTMP in this case |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
48 path = os.environ['TESTDIR'] |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
49 else: |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
50 path = '.' |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
51 |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
52 if not os.path.exists(os.path.join(path, 'hghaveaddon.py')): |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
53 return |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
54 |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
55 sys.path.insert(0, path) |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
56 try: |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
57 import hghaveaddon |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
58 |
29231
b1b35a9051c3
hghave: silence future pyflakes warning of unused import
Yuya Nishihara <yuya@tcha.org>
parents:
29161
diff
changeset
|
59 assert hghaveaddon # silence pyflakes |
28047
863075fd4cd0
misc: use modern exception syntax
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
26068
diff
changeset
|
60 except BaseException as inst: |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
61 sys.stderr.write( |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
62 'failed to import hghaveaddon.py from %r: %s\n' % (path, inst) |
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
63 ) |
25732
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
64 sys.exit(2) |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
65 sys.path.pop(0) |
b94df10cc3b5
hghave: allow adding customized features at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22762
diff
changeset
|
66 |
43691
47ef023d0165
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29231
diff
changeset
|
67 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
68 if __name__ == '__main__': |
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
69 options, args = parser.parse_args() |
26068
05e7f57c74ac
hghave: remove quiet option
Gregory Szorc <gregory.szorc@gmail.com>
parents:
26067
diff
changeset
|
70 _loadaddon() |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
71 if options.list_features: |
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
72 list_features() |
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
73 sys.exit(0) |
5081
ea7b982b6c08
Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5074
diff
changeset
|
74 |
8059
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
75 if options.test_features: |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
76 sys.exit(test_features()) |
41a2c5cbcb6a
hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7823
diff
changeset
|
77 |
26068
05e7f57c74ac
hghave: remove quiet option
Gregory Szorc <gregory.szorc@gmail.com>
parents:
26067
diff
changeset
|
78 hghave.require(args) |