Mercurial > hg
annotate tests/hghave.py @ 18274:254b708fd37d
performance: speedup computation of mutable revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository. The "mutable" filter is used
during branch cache loading operation. We need to make it fast.
This change drops revset calls in favor of direct testing of the
phase of a changeset.
Performance test on my Mercurial checkout
- 19857 total changesets,
- 1646 mutable revision
Before:
! mutable
! wall 0.032405
After:
! mutable
! wall 0.001469
Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 mutable changeset,
Before:
! mutable
! wall 0.188636
After:
! mutable
! wall 0.000022
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 07 Jan 2013 15:50:25 +0100 |
parents | 35674bd95200 |
children | 9589227657bc |
rev | line source |
---|---|
16970
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
1 import os, stat, socket |
5252
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
2 import re |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 import sys |
5072
7e2385a31933
hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents:
5070
diff
changeset
|
4 import tempfile |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
5090
bf60e4bd6672
hghave: prefix temporary files with "hg-hghave-"
Patrick Mezard <pmezard@gmail.com>
parents:
5084
diff
changeset
|
6 tempprefix = 'hg-hghave-' |
bf60e4bd6672
hghave: prefix temporary files with "hg-hghave-"
Patrick Mezard <pmezard@gmail.com>
parents:
5084
diff
changeset
|
7 |
5302
961876838de0
hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
8 def matchoutput(cmd, regexp, ignorestatus=False): |
5252
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
9 """Return True if cmd executes successfully and its output |
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
10 is matched by the supplied regular expression. |
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
11 """ |
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
12 r = re.compile(regexp) |
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
13 fh = os.popen(cmd) |
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
14 s = fh.read() |
8213
ac9c4049fd29
hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents:
8127
diff
changeset
|
15 try: |
ac9c4049fd29
hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents:
8127
diff
changeset
|
16 ret = fh.close() |
ac9c4049fd29
hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents:
8127
diff
changeset
|
17 except IOError: |
ac9c4049fd29
hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents:
8127
diff
changeset
|
18 # Happen in Windows test environment |
ac9c4049fd29
hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents:
8127
diff
changeset
|
19 ret = 1 |
5302
961876838de0
hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
20 return (ignorestatus or ret is None) and r.search(s) |
5252
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
21 |
6078
ebc23d34102f
convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6063
diff
changeset
|
22 def has_baz(): |
ebc23d34102f
convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6063
diff
changeset
|
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version') |
ebc23d34102f
convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6063
diff
changeset
|
24 |
7053
209ef5f3534c
convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
6998
diff
changeset
|
25 def has_bzr(): |
7061
8b874f8cd29f
tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7053
diff
changeset
|
26 try: |
8b874f8cd29f
tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7053
diff
changeset
|
27 import bzrlib |
16684
e617876fe82d
cleanup: "x != None" -> "x is not None"
Brodie Rao <brodie@sf.io>
parents:
16683
diff
changeset
|
28 return bzrlib.__doc__ is not None |
7061
8b874f8cd29f
tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7053
diff
changeset
|
29 except ImportError: |
8b874f8cd29f
tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7053
diff
changeset
|
30 return False |
7053
209ef5f3534c
convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
6998
diff
changeset
|
31 |
8126
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
32 def has_bzr114(): |
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
33 try: |
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
34 import bzrlib |
16684
e617876fe82d
cleanup: "x != None" -> "x is not None"
Brodie Rao <brodie@sf.io>
parents:
16683
diff
changeset
|
35 return (bzrlib.__doc__ is not None |
9244
3f52a70959ce
tests/hghave: bzr114 checks for bzr >= 1.14
Mads Kiilerich <mads@kiilerich.com>
parents:
8809
diff
changeset
|
36 and bzrlib.version_info[:2] >= (1, 14)) |
8126
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
37 except ImportError: |
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
38 return False |
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
39 |
5302
961876838de0
hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
40 def has_cvs(): |
6626
59f7b804352f
tests: don't run test-convert-cvs if there's no cvs server
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6384
diff
changeset
|
41 re = r'Concurrent Versions System.*?server' |
15568
08635f4e44be
tests: skip cvs tests with msys on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15567
diff
changeset
|
42 return matchoutput('cvs --version 2>&1', re) and not has_msys() |
5302
961876838de0
hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
43 |
5410
2daecf3d2582
hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents:
5409
diff
changeset
|
44 def has_darcs(): |
9326
b236f34ec1e9
Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents:
9244
diff
changeset
|
45 return matchoutput('darcs --version', r'2\.[2-9]', True) |
5410
2daecf3d2582
hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents:
5409
diff
changeset
|
46 |
6372
8f79820443a4
Add a test for monotone conversion
Patrick Mezard <pmezard@gmail.com>
parents:
6355
diff
changeset
|
47 def has_mtn(): |
6384
8bc876e03143
Skip older monotone versions for tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6372
diff
changeset
|
48 return matchoutput('mtn --version', r'monotone', True) and not matchoutput( |
14550
2425a3536396
tests: fix updated monotone version requirement
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14432
diff
changeset
|
49 'mtn --version', r'monotone 0\.', True) |
6372
8f79820443a4
Add a test for monotone conversion
Patrick Mezard <pmezard@gmail.com>
parents:
6355
diff
changeset
|
50 |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
51 def has_eol_in_paths(): |
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
52 try: |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
53 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r') |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
54 os.close(fd) |
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
55 os.remove(path) |
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
56 return True |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
16685
diff
changeset
|
57 except (IOError, OSError): |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
58 return False |
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
59 |
5072
7e2385a31933
hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents:
5070
diff
changeset
|
60 def has_executablebit(): |
7e2385a31933
hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents:
5070
diff
changeset
|
61 try: |
16320
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
62 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
63 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) |
16320
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
64 try: |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
65 os.close(fh) |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
66 m = os.stat(fn).st_mode & 0777 |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
67 new_file_has_exec = m & EXECFLAGS |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
68 os.chmod(fn, m ^ EXECFLAGS) |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
69 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m) |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
70 finally: |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
71 os.unlink(fn) |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
72 except (IOError, OSError): |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
73 # we don't care, the user probably won't be able to commit anyway |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
74 return False |
e11ab387e89c
tests: make hghave handle exec bit on Linux with vfat
Matt Mackall <mpm@selenic.com>
parents:
16319
diff
changeset
|
75 return not (new_file_has_exec or exec_flags_cannot_flip) |
5072
7e2385a31933
hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents:
5070
diff
changeset
|
76 |
6806
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
77 def has_icasefs(): |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
78 # Stolen from mercurial.util |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
79 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) |
6806
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
80 os.close(fd) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
81 try: |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
82 s1 = os.stat(path) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
83 d, b = os.path.split(path) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
84 p2 = os.path.join(d, b.upper()) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
85 if path == p2: |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
86 p2 = os.path.join(d, b.lower()) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
87 try: |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
88 s2 = os.stat(p2) |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
89 return s2 == s1 |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
16685
diff
changeset
|
90 except OSError: |
6806
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
91 return False |
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
92 finally: |
6998 | 93 os.remove(path) |
94 | |
6996
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
95 def has_inotify(): |
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
96 try: |
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
97 import hgext.inotify.linux.watcher |
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
98 except ImportError: |
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
99 return False |
16970
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
100 name = tempfile.mktemp(dir='.', prefix=tempprefix) |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
101 sock = socket.socket(socket.AF_UNIX) |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
102 try: |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
103 sock.bind(name) |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
104 except socket.error, err: |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
105 return False |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
106 sock.close() |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
107 os.unlink(name) |
8be2a28cc782
tests/hghave: test that the inotify unix socket actually can be created
Mads Kiilerich <mads@kiilerich.com>
parents:
16969
diff
changeset
|
108 return True |
6996
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
109 |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
110 def has_fifo(): |
16969
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
111 if getattr(os, "mkfifo", None) is None: |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
112 return False |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
113 name = tempfile.mktemp(dir='.', prefix=tempprefix) |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
114 try: |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
115 os.mkfifo(name) |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
116 os.unlink(name) |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
117 return True |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
118 except OSError: |
6d1673107143
tests/hghave: test that a fifo actually can be created on the filesystem
Mads Kiilerich <mads@kiilerich.com>
parents:
16968
diff
changeset
|
119 return False |
5074
e86788af599a
hghave: detect support for EOL in paths.
Patrick Mezard <pmezard@gmail.com>
parents:
5072
diff
changeset
|
120 |
17467
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17016
diff
changeset
|
121 def has_killdaemons(): |
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17016
diff
changeset
|
122 return True |
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17016
diff
changeset
|
123 |
14927
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
124 def has_cacheable_fs(): |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
125 from mercurial import util |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
126 |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
127 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) |
14927
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
128 os.close(fd) |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
129 try: |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
130 return util.cachestat(path).cacheable() |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
131 finally: |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
132 os.remove(path) |
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
133 |
5099
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
134 def has_lsprof(): |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
135 try: |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
136 import _lsprof |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
137 return True |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
138 except ImportError: |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
139 return False |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
140 |
13442
bb107a31820e
test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents:
13418
diff
changeset
|
141 def has_gettext(): |
bb107a31820e
test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents:
13418
diff
changeset
|
142 return matchoutput('msgfmt --version', 'GNU gettext-tools') |
bb107a31820e
test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents:
13418
diff
changeset
|
143 |
5218
4fa0f2dff643
hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents:
5103
diff
changeset
|
144 def has_git(): |
5252
c0281c6b40b0
hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents:
5218
diff
changeset
|
145 return matchoutput('git --version 2>&1', r'^git version') |
5218
4fa0f2dff643
hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents:
5103
diff
changeset
|
146 |
10971
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
147 def has_docutils(): |
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
148 try: |
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
149 from docutils.core import publish_cmdline |
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
150 return True |
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
151 except ImportError: |
cbe400a8e217
doc: add generic frontend to rst2man and rst2html
Martin Geisler <mg@aragost.com>
parents:
9819
diff
changeset
|
152 return False |
9446
57d682d7d2da
test-gendoc: test documentation generation
Martin Geisler <mg@lazybytes.net>
parents:
9395
diff
changeset
|
153 |
14050
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
154 def getsvnversion(): |
17707
35674bd95200
subrepo, hghave: use "svn --version --quiet" to determine version number
Thomas Arendsen Hein <thomas@intevation.de>
parents:
17467
diff
changeset
|
155 m = matchoutput('svn --version --quiet 2>&1', r'^(\d+)\.(\d+)') |
14050
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
156 if not m: |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
157 return (0, 0) |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
158 return (int(m.group(1)), int(m.group(2))) |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
159 |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
160 def has_svn15(): |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
161 return getsvnversion() >= (1, 5) |
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
162 |
15346
53f37b24f26a
tests: check for svn >= 1.3 and >= 1.5 in tests that require those versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14927
diff
changeset
|
163 def has_svn13(): |
53f37b24f26a
tests: check for svn >= 1.3 and >= 1.5 in tests that require those versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14927
diff
changeset
|
164 return getsvnversion() >= (1, 3) |
53f37b24f26a
tests: check for svn >= 1.3 and >= 1.5 in tests that require those versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14927
diff
changeset
|
165 |
5253
d82ebcdf20e1
hghave: detect subversion client and admin tools availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
166 def has_svn(): |
9819
dec177286deb
convert: reenable SVN support after license issue solved
Patrick Mezard <pmezard@gmail.com>
parents:
9817
diff
changeset
|
167 return matchoutput('svn --version 2>&1', r'^svn, version') and \ |
dec177286deb
convert: reenable SVN support after license issue solved
Patrick Mezard <pmezard@gmail.com>
parents:
9817
diff
changeset
|
168 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version') |
5253
d82ebcdf20e1
hghave: detect subversion client and admin tools availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
169 |
5254
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
170 def has_svn_bindings(): |
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
171 try: |
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
172 import svn.core |
7315
408cf9eb9e5d
tests: run svn tests only with svn bindings >1.3
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7061
diff
changeset
|
173 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR |
408cf9eb9e5d
tests: run svn tests only with svn bindings >1.3
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7061
diff
changeset
|
174 if version < (1, 4): |
408cf9eb9e5d
tests: run svn tests only with svn bindings >1.3
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7061
diff
changeset
|
175 return False |
5254
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
176 return True |
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
177 except ImportError: |
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
178 return False |
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
179 |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7773
diff
changeset
|
180 def has_p4(): |
16683 | 181 return (matchoutput('p4 -V', r'Rev\. P4/') and |
182 matchoutput('p4d -V', r'Rev\. P4D/')) | |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7773
diff
changeset
|
183 |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
184 def has_symlink(): |
16685
43d55088415a
cleanup: replace hasattr() usage with getattr() in hghave
Brodie Rao <brodie@sf.io>
parents:
16684
diff
changeset
|
185 if getattr(os, "symlink", None) is None: |
16319
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
186 return False |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
187 name = tempfile.mktemp(dir='.', prefix=tempprefix) |
16319
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
188 try: |
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
189 os.symlink(".", name) |
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
190 os.unlink(name) |
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
191 return True |
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
192 except (OSError, AttributeError): |
ac0da5caebec
tests: teach hghave to actually test for symlink support
Matt Mackall <mpm@selenic.com>
parents:
15568
diff
changeset
|
193 return False |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
194 |
16971
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
195 def has_hardlink(): |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
196 from mercurial import util |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
197 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
198 os.close(fh) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
199 name = tempfile.mktemp(dir='.', prefix=tempprefix) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
200 try: |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
201 try: |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
202 util.oslink(fn, name) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
203 os.unlink(name) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
204 return True |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
205 except OSError: |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
206 return False |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
207 finally: |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
208 os.unlink(fn) |
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
209 |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
210 def has_tla(): |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
211 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision') |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
212 |
8809 | 213 def has_gpg(): |
214 return matchoutput('gpg --version 2>&1', r'GnuPG') | |
215 | |
6063
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
216 def has_unix_permissions(): |
16968
456f457e376d
tests/hghave: consistently use dir='.', prefix=tempprefix for tempfiles
Mads Kiilerich <mads@kiilerich.com>
parents:
16966
diff
changeset
|
217 d = tempfile.mkdtemp(dir='.', prefix=tempprefix) |
6063
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
218 try: |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
219 fname = os.path.join(d, 'foo') |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
220 for umask in (077, 007, 022): |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
221 os.umask(umask) |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
222 f = open(fname, 'w') |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
223 f.close() |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
224 mode = os.stat(fname).st_mode |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
225 os.unlink(fname) |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
226 if mode & 0777 != ~umask & 0666: |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
227 return False |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
228 return True |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
229 finally: |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
230 os.rmdir(d) |
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
231 |
14140
82f0412ef7de
tests: add pyflakes checking for unused imports
timeless <timeless@mozdev.org>
parents:
14050
diff
changeset
|
232 def has_pyflakes(): |
16872
40d930848fd0
hghave: wrap command in 'sh -c "..."' for has_pyflakes()
Adrian Buehlmann <adrian@cadifra.com>
parents:
16688
diff
changeset
|
233 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"", |
14140
82f0412ef7de
tests: add pyflakes checking for unused imports
timeless <timeless@mozdev.org>
parents:
14050
diff
changeset
|
234 r"<stdin>:1: 're' imported but unused", |
82f0412ef7de
tests: add pyflakes checking for unused imports
timeless <timeless@mozdev.org>
parents:
14050
diff
changeset
|
235 True) |
82f0412ef7de
tests: add pyflakes checking for unused imports
timeless <timeless@mozdev.org>
parents:
14050
diff
changeset
|
236 |
6355
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
237 def has_pygments(): |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
238 try: |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
239 import pygments |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
240 return True |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
241 except ImportError: |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
242 return False |
3b841c189ab7
tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6079
diff
changeset
|
243 |
7429
dbc40381620e
tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents:
7315
diff
changeset
|
244 def has_outer_repo(): |
17016
468a950aebc3
tests: hghave outer-repo should be true even if a bad repo is found
Mads Kiilerich <mads@kiilerich.com>
parents:
16971
diff
changeset
|
245 # failing for other reasons than 'no repo' imply that there is a repo |
468a950aebc3
tests: hghave outer-repo should be true even if a bad repo is found
Mads Kiilerich <mads@kiilerich.com>
parents:
16971
diff
changeset
|
246 return not matchoutput('hg root 2>&1', |
468a950aebc3
tests: hghave outer-repo should be true even if a bad repo is found
Mads Kiilerich <mads@kiilerich.com>
parents:
16971
diff
changeset
|
247 r'abort: no repository found', True) |
7429
dbc40381620e
tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents:
7315
diff
changeset
|
248 |
12740
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
249 def has_ssl(): |
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
250 try: |
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
251 import ssl |
13418
28555e294104
tests: update ssl requirement for test-https.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13289
diff
changeset
|
252 import OpenSSL |
28555e294104
tests: update ssl requirement for test-https.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13289
diff
changeset
|
253 OpenSSL.SSL.Context |
12740
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
254 return True |
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
255 except ImportError: |
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
256 return False |
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
257 |
15444
e1f05d7a8c7b
tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
258 def has_windows(): |
e1f05d7a8c7b
tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
259 return os.name == 'nt' |
e1f05d7a8c7b
tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
260 |
15445
7cbb81c47025
tests: use 'hghave system-sh' to guard tests that requires sh in system()
Mads Kiilerich <mads@kiilerich.com>
parents:
15444
diff
changeset
|
261 def has_system_sh(): |
7cbb81c47025
tests: use 'hghave system-sh' to guard tests that requires sh in system()
Mads Kiilerich <mads@kiilerich.com>
parents:
15444
diff
changeset
|
262 return os.name != 'nt' |
7cbb81c47025
tests: use 'hghave system-sh' to guard tests that requires sh in system()
Mads Kiilerich <mads@kiilerich.com>
parents:
15444
diff
changeset
|
263 |
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
15445
diff
changeset
|
264 def has_serve(): |
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
15445
diff
changeset
|
265 return os.name != 'nt' # gross approximation |
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
15445
diff
changeset
|
266 |
15539
d09ea5bbc9a4
tests: skip color test on platforms without tic
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
267 def has_tic(): |
d09ea5bbc9a4
tests: skip color test on platforms without tic
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
268 return matchoutput('test -x "`which tic`"', '') |
d09ea5bbc9a4
tests: skip color test on platforms without tic
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
269 |
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
15539
diff
changeset
|
270 def has_msys(): |
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
15539
diff
changeset
|
271 return os.getenv('MSYSTEM') |
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
15539
diff
changeset
|
272 |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
273 checks = { |
16891
b0e8afdfa970
tests/hghave: implement #if true / #if false
Adrian Buehlmann <adrian@cadifra.com>
parents:
16872
diff
changeset
|
274 "true": (lambda: True, "yak shaving"), |
b0e8afdfa970
tests/hghave: implement #if true / #if false
Adrian Buehlmann <adrian@cadifra.com>
parents:
16872
diff
changeset
|
275 "false": (lambda: False, "nail clipper"), |
6078
ebc23d34102f
convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6063
diff
changeset
|
276 "baz": (has_baz, "GNU Arch baz client"), |
7053
209ef5f3534c
convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
6998
diff
changeset
|
277 "bzr": (has_bzr, "Canonical's Bazaar client"), |
8126
13b36eb14324
convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
278 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"), |
14927
2aa3e07b2f07
posix, windows: introduce cachestat
Idan Kamara <idankk86@gmail.com>
parents:
14550
diff
changeset
|
279 "cacheable": (has_cacheable_fs, "cacheable filesystem"), |
6626
59f7b804352f
tests: don't run test-convert-cvs if there's no cvs server
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6384
diff
changeset
|
280 "cvs": (has_cvs, "cvs client/server"), |
5410
2daecf3d2582
hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents:
5409
diff
changeset
|
281 "darcs": (has_darcs, "darcs client"), |
12740
b86c6954ec4c
serve: fix https mode and add test
Mads Kiilerich <mads@kiilerich.com>
parents:
10971
diff
changeset
|
282 "docutils": (has_docutils, "Docutils text processing library"), |
5099
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
283 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
284 "execbit": (has_executablebit, "executable bit"), |
5409
190c234c8fa0
hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents:
5308
diff
changeset
|
285 "fifo": (has_fifo, "named pipes"), |
13442
bb107a31820e
test-i18n: make test conditional on msgfmt availability
Martin Geisler <mg@lazybytes.net>
parents:
13418
diff
changeset
|
286 "gettext": (has_gettext, "GNU Gettext (msgfmt)"), |
5218
4fa0f2dff643
hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents:
5103
diff
changeset
|
287 "git": (has_git, "git command line client"), |
8809 | 288 "gpg": (has_gpg, "gpg client"), |
16971
8aeb2f1ae94c
tests: introduce hghave hardlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
16970
diff
changeset
|
289 "hardlink": (has_hardlink, "hardlinks"), |
6806
2134d6c09432
Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents:
6626
diff
changeset
|
290 "icasefs": (has_icasefs, "case insensitive file system"), |
6996
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
291 "inotify": (has_inotify, "inotify extension support"), |
17467
448d0c452140
test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17016
diff
changeset
|
292 "killdaemons": (has_killdaemons, 'killdaemons.py support'), |
5099
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
293 "lsprof": (has_lsprof, "python lsprof module"), |
14432
0969d91fad5c
tests: update monotone version requirement
Sune Foldager <cryo@cyanite.org>
parents:
14140
diff
changeset
|
294 "mtn": (has_mtn, "monotone client (>= 1.0)"), |
7429
dbc40381620e
tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents:
7315
diff
changeset
|
295 "outer-repo": (has_outer_repo, "outer repo"), |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7773
diff
changeset
|
296 "p4": (has_p4, "Perforce server and client"), |
14140
82f0412ef7de
tests: add pyflakes checking for unused imports
timeless <timeless@mozdev.org>
parents:
14050
diff
changeset
|
297 "pyflakes": (has_pyflakes, "Pyflakes python linter"), |
6996
fecf060f32a1
inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6626
diff
changeset
|
298 "pygments": (has_pygments, "Pygments source highlighting library"), |
15446
c5c9ca3719f9
tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents:
15445
diff
changeset
|
299 "serve": (has_serve, "platform and python can manage 'hg serve -d'"), |
13543
c17e4d881722
tests: improve hghave error reporting for missing Py OpenSSL
timeless <timeless@gmail.com>
parents:
13442
diff
changeset
|
300 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"), |
5253
d82ebcdf20e1
hghave: detect subversion client and admin tools availability
Patrick Mezard <pmezard@gmail.com>
parents:
5252
diff
changeset
|
301 "svn": (has_svn, "subversion client and admin tools"), |
15346
53f37b24f26a
tests: check for svn >= 1.3 and >= 1.5 in tests that require those versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14927
diff
changeset
|
302 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"), |
14050
9e8a9d45945c
subrepo: handle svn tracked/unknown directory collisions
Patrick Mezard <pmezard@gmail.com>
parents:
13543
diff
changeset
|
303 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"), |
5254
d61e98a82cee
hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents:
5253
diff
changeset
|
304 "svn-bindings": (has_svn_bindings, "subversion python bindings"), |
5099
105d4cf7ec24
Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
5092
diff
changeset
|
305 "symlink": (has_symlink, "symbolic links"), |
15445
7cbb81c47025
tests: use 'hghave system-sh' to guard tests that requires sh in system()
Mads Kiilerich <mads@kiilerich.com>
parents:
15444
diff
changeset
|
306 "system-sh": (has_system_sh, "system() uses sh"), |
15539
d09ea5bbc9a4
tests: skip color test on platforms without tic
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
307 "tic": (has_tic, "terminfo compiler"), |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
308 "tla": (has_tla, "GNU Arch tla client"), |
6063
b74a0c4bfb30
hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5685
diff
changeset
|
309 "unix-permissions": (has_unix_permissions, "unix-style permissions"), |
15444
e1f05d7a8c7b
tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
310 "windows": (has_windows, "Windows"), |
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
15539
diff
changeset
|
311 "msys": (has_msys, "Windows with MSYS"), |
4881
c51c9bc4579d
Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
312 } |