tests/hghave
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Fri, 11 Dec 2009 15:58:09 +0900
changeset 10090 a3ad96ead8f0
parent 9819 dec177286deb
child 10971 cbe400a8e217
permissions -rwxr-xr-x
inotify: do not rely on stat(.hg/dirstate) to invalidate our dirstate stat() is not reliable when several events happen quickly. Which means that if two hg actions occur in the same second, stat() result will not reflect the second change. And only _one_ invalidate() call was done. Also ignore the events that occur when wlock is held, since wlock release will trigger a full rescan anyway. Fixes 17 run-tests.py --inotify tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
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
"""
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     6
import optparse
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     7
import os
5252
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
     8
import re
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     9
import sys
5072
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    10
import tempfile
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    11
5090
bf60e4bd6672 hghave: prefix temporary files with "hg-hghave-"
Patrick Mezard <pmezard@gmail.com>
parents: 5084
diff changeset
    12
tempprefix = 'hg-hghave-'
bf60e4bd6672 hghave: prefix temporary files with "hg-hghave-"
Patrick Mezard <pmezard@gmail.com>
parents: 5084
diff changeset
    13
5302
961876838de0 hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
    14
def matchoutput(cmd, regexp, ignorestatus=False):
5252
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    15
    """Return True if cmd executes successfully and its output
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    16
    is matched by the supplied regular expression.
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    17
    """
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    18
    r = re.compile(regexp)
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    19
    fh = os.popen(cmd)
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
    20
    s = fh.read()
8213
ac9c4049fd29 hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents: 8127
diff changeset
    21
    try:
ac9c4049fd29 hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents: 8127
diff changeset
    22
        ret = fh.close()
ac9c4049fd29 hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents: 8127
diff changeset
    23
    except IOError:
ac9c4049fd29 hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents: 8127
diff changeset
    24
        # Happen in Windows test environment
ac9c4049fd29 hghave: handle Windows raising on popen() failure
Patrick Mezard <pmezard@gmail.com>
parents: 8127
diff changeset
    25
        ret = 1
5302
961876838de0 hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
    26
    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
    27
6078
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6063
diff changeset
    28
def has_baz():
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6063
diff changeset
    29
    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
    30
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents: 6998
diff changeset
    31
def has_bzr():
7061
8b874f8cd29f tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7053
diff changeset
    32
    try:
8b874f8cd29f tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7053
diff changeset
    33
        import bzrlib
7773
607de5bd3578 test suite: saver check if bzr is installed
Simon Heimberg <simohe@besonet.ch>
parents: 7429
diff changeset
    34
        return bzrlib.__doc__ != None
7061
8b874f8cd29f tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7053
diff changeset
    35
    except ImportError:
8b874f8cd29f tests: check for bzr support by importing bzrlib
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7053
diff changeset
    36
        return False
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents: 6998
diff changeset
    37
8126
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    38
def has_bzr114():
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    39
    try:
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    40
        import bzrlib
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    41
        return (bzrlib.__doc__ != None
9244
3f52a70959ce tests/hghave: bzr114 checks for bzr >= 1.14
Mads Kiilerich <mads@kiilerich.com>
parents: 8809
diff changeset
    42
                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
    43
    except ImportError:
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    44
        return False
13b36eb14324 convert/bzr: handle files replaced by directories (issue1623)
Patrick Mezard <pmezard@gmail.com>
parents: 7823
diff changeset
    45
5302
961876838de0 hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
    46
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
    47
    re = r'Concurrent Versions System.*?server'
59f7b804352f tests: don't run test-convert-cvs if there's no cvs server
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6384
diff changeset
    48
    return matchoutput('cvs --version 2>&1', re)
5302
961876838de0 hghave: detect cvs and cvsps availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
    49
5410
2daecf3d2582 hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents: 5409
diff changeset
    50
def has_darcs():
9326
b236f34ec1e9 Fix failing darcs test
Bryan O'Sullivan <bos@serpentine.com>
parents: 9244
diff changeset
    51
    return matchoutput('darcs --version', r'2\.[2-9]', True)
5410
2daecf3d2582 hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents: 5409
diff changeset
    52
6372
8f79820443a4 Add a test for monotone conversion
Patrick Mezard <pmezard@gmail.com>
parents: 6355
diff changeset
    53
def has_mtn():
6384
8bc876e03143 Skip older monotone versions for tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6372
diff changeset
    54
    return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
8bc876e03143 Skip older monotone versions for tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6372
diff changeset
    55
        'mtn --version', r'monotone 0\.(\d|[12]\d|3[01])[^\d]', True)
6372
8f79820443a4 Add a test for monotone conversion
Patrick Mezard <pmezard@gmail.com>
parents: 6355
diff changeset
    56
5409
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    57
def has_eol_in_paths():
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    58
    try:
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    59
        fd, path = tempfile.mkstemp(prefix=tempprefix, suffix='\n\r')
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    60
        os.close(fd)
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    61
        os.remove(path)
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    62
        return True
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    63
    except:
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    64
        return False
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
    65
5072
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    66
def has_executablebit():
5090
bf60e4bd6672 hghave: prefix temporary files with "hg-hghave-"
Patrick Mezard <pmezard@gmail.com>
parents: 5084
diff changeset
    67
    fd, path = tempfile.mkstemp(prefix=tempprefix)
5072
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    68
    os.close(fd)
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    69
    try:
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    70
        s = os.lstat(path).st_mode
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    71
        os.chmod(path, s | 0100)
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    72
        return (os.lstat(path).st_mode & 0100 != 0)
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    73
    finally:
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    74
        os.remove(path)
7e2385a31933 hghave: detect executable permission availability.
Patrick Mezard <pmezard@gmail.com>
parents: 5070
diff changeset
    75
6806
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    76
def has_icasefs():
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    77
    # Stolen from mercurial.util
9395
163e79e2ed5f hghave: check for case insensitive filesystem in current dir
Simon Heimberg <simohe@besonet.ch>
parents: 9326
diff changeset
    78
    fd, path = tempfile.mkstemp(prefix=tempprefix, dir='.')
6806
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    79
    os.close(fd)
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    80
    try:
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    81
        s1 = os.stat(path)
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    82
        d, b = os.path.split(path)
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    83
        p2 = os.path.join(d, b.upper())
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    84
        if path == p2:
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    85
            p2 = os.path.join(d, b.lower())
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    86
        try:
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    87
            s2 = os.stat(p2)
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    88
            return s2 == s1
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    89
        except:
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    90
            return False
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
    91
    finally:
6998
ddfcefab8b97 merge with -stable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6806 6996
diff changeset
    92
        os.remove(path)
ddfcefab8b97 merge with -stable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6806 6996
diff changeset
    93
6996
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
    94
def has_inotify():
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
    95
    try:
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
    96
        import hgext.inotify.linux.watcher
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
    97
        return True
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
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
   100
5409
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   101
def has_fifo():
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   102
    return hasattr(os, "mkfifo")
5074
e86788af599a hghave: detect support for EOL in paths.
Patrick Mezard <pmezard@gmail.com>
parents: 5072
diff changeset
   103
5102
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   104
def has_hotshot():
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   105
    try:
5103
e5b21a549cc5 hghave: test hotshot dependencies (debian does not provide profile)
Patrick Mezard <pmezard@gmail.com>
parents: 5102
diff changeset
   106
        # hotshot.stats tests hotshot and many problematic dependencies
e5b21a549cc5 hghave: test hotshot dependencies (debian does not provide profile)
Patrick Mezard <pmezard@gmail.com>
parents: 5102
diff changeset
   107
        # like profile.
e5b21a549cc5 hghave: test hotshot dependencies (debian does not provide profile)
Patrick Mezard <pmezard@gmail.com>
parents: 5102
diff changeset
   108
        import hotshot.stats
5102
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   109
        return True
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   110
    except ImportError:
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   111
        return False
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   112
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   113
def has_lsprof():
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   114
    try:
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   115
        import _lsprof
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   116
        return True
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   117
    except ImportError:
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   118
        return False
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   119
5218
4fa0f2dff643 hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents: 5103
diff changeset
   120
def has_git():
5252
c0281c6b40b0 hghave: wrap command output matching
Patrick Mezard <pmezard@gmail.com>
parents: 5218
diff changeset
   121
    return matchoutput('git --version 2>&1', r'^git version')
5218
4fa0f2dff643 hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents: 5103
diff changeset
   122
9446
57d682d7d2da test-gendoc: test documentation generation
Martin Geisler <mg@lazybytes.net>
parents: 9395
diff changeset
   123
def has_rst2html():
9817
912ce84eebae hghave: be more tolerant to rst2html output
Patrick Mezard <pmezard@gmail.com>
parents: 9719
diff changeset
   124
    for name in ('rst2html', 'rst2html.py'):
912ce84eebae hghave: be more tolerant to rst2html output
Patrick Mezard <pmezard@gmail.com>
parents: 9719
diff changeset
   125
        name = name + ' --version 2>&1'
912ce84eebae hghave: be more tolerant to rst2html output
Patrick Mezard <pmezard@gmail.com>
parents: 9719
diff changeset
   126
        if matchoutput(name, r'^rst2html(?:\.py)? \(Docutils'):
912ce84eebae hghave: be more tolerant to rst2html output
Patrick Mezard <pmezard@gmail.com>
parents: 9719
diff changeset
   127
            return True
912ce84eebae hghave: be more tolerant to rst2html output
Patrick Mezard <pmezard@gmail.com>
parents: 9719
diff changeset
   128
    return False
9446
57d682d7d2da test-gendoc: test documentation generation
Martin Geisler <mg@lazybytes.net>
parents: 9395
diff changeset
   129
5253
d82ebcdf20e1 hghave: detect subversion client and admin tools availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
   130
def has_svn():
9819
dec177286deb convert: reenable SVN support after license issue solved
Patrick Mezard <pmezard@gmail.com>
parents: 9817
diff changeset
   131
    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
   132
        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
   133
5254
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   134
def has_svn_bindings():
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   135
    try:
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   136
        import svn.core
7315
408cf9eb9e5d tests: run svn tests only with svn bindings >1.3
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7061
diff changeset
   137
        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
   138
        if version < (1, 4):
408cf9eb9e5d tests: run svn tests only with svn bindings >1.3
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 7061
diff changeset
   139
            return False
5254
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   140
        return True
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   141
    except ImportError:
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   142
        return False
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   143
7823
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7773
diff changeset
   144
def has_p4():
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7773
diff changeset
   145
    return matchoutput('p4 -V', r'Rev\. P4/') and matchoutput('p4d -V', r'Rev\. P4D/')
11efa41037e2 convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 7773
diff changeset
   146
5409
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   147
def has_symlink():
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   148
    return hasattr(os, "symlink")
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   149
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6078
diff changeset
   150
def has_tla():
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6078
diff changeset
   151
    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
   152
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents: 8213
diff changeset
   153
def has_gpg():
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents: 8213
diff changeset
   154
    return matchoutput('gpg --version 2>&1', r'GnuPG')
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents: 8213
diff changeset
   155
6063
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   156
def has_unix_permissions():
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   157
    d = tempfile.mkdtemp(prefix=tempprefix, dir=".")
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   158
    try:
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   159
        fname = os.path.join(d, 'foo')
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   160
        for umask in (077, 007, 022):
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   161
            os.umask(umask)
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   162
            f = open(fname, 'w')
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   163
            f.close()
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   164
            mode = os.stat(fname).st_mode
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   165
            os.unlink(fname)
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   166
            if mode & 0777 != ~umask & 0666:
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   167
                return False
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   168
        return True
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   169
    finally:
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   170
        os.rmdir(d)
b74a0c4bfb30 hghave: detect unix-style permissions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5685
diff changeset
   171
6355
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   172
def has_pygments():
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   173
    try:
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   174
        import pygments
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   175
        return True
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   176
    except ImportError:
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   177
        return False
3b841c189ab7 tests: add highlight extension tests
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6079
diff changeset
   178
7429
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7315
diff changeset
   179
def has_outer_repo():
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7315
diff changeset
   180
    return matchoutput('hg root 2>&1', r'')
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7315
diff changeset
   181
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   182
checks = {
6078
ebc23d34102f convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6063
diff changeset
   183
    "baz": (has_baz, "GNU Arch baz client"),
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents: 6998
diff changeset
   184
    "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
   185
    "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
6626
59f7b804352f tests: don't run test-convert-cvs if there's no cvs server
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6384
diff changeset
   186
    "cvs": (has_cvs, "cvs client/server"),
5410
2daecf3d2582 hghave: detect darcs client
Patrick Mezard <pmezard@gmail.com>
parents: 5409
diff changeset
   187
    "darcs": (has_darcs, "darcs client"),
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   188
    "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
   189
    "execbit": (has_executablebit, "executable bit"),
5409
190c234c8fa0 hghave: reorder check functions and entries
Patrick Mezard <pmezard@gmail.com>
parents: 5308
diff changeset
   190
    "fifo": (has_fifo, "named pipes"),
5218
4fa0f2dff643 hghave: detect git availability
Patrick Mezard <pmezard@gmail.com>
parents: 5103
diff changeset
   191
    "git": (has_git, "git command line client"),
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents: 8213
diff changeset
   192
    "gpg": (has_gpg, "gpg client"),
5102
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
   193
    "hotshot": (has_hotshot, "python hotshot module"),
6806
2134d6c09432 Add test for case folding issues
Patrick Mezard <pmezard@gmail.com>
parents: 6626
diff changeset
   194
    "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
   195
    "inotify": (has_inotify, "inotify extension support"),
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   196
    "lsprof": (has_lsprof, "python lsprof module"),
6384
8bc876e03143 Skip older monotone versions for tests.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6372
diff changeset
   197
    "mtn": (has_mtn, "monotone client (> 0.31)"),
7429
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7315
diff changeset
   198
    "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
   199
    "p4": (has_p4, "Perforce server and client"),
6996
fecf060f32a1 inotify: deactivate inotify status on failure
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6626
diff changeset
   200
    "pygments": (has_pygments, "Pygments source highlighting library"),
9446
57d682d7d2da test-gendoc: test documentation generation
Martin Geisler <mg@lazybytes.net>
parents: 9395
diff changeset
   201
    "rst2html": (has_rst2html, "Docutils rst2html tool"),
5253
d82ebcdf20e1 hghave: detect subversion client and admin tools availability
Patrick Mezard <pmezard@gmail.com>
parents: 5252
diff changeset
   202
    "svn": (has_svn, "subversion client and admin tools"),
5254
d61e98a82cee hghave: detect subversion bindings availability
Patrick Mezard <pmezard@gmail.com>
parents: 5253
diff changeset
   203
    "svn-bindings": (has_svn_bindings, "subversion python bindings"),
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents: 5092
diff changeset
   204
    "symlink": (has_symlink, "symbolic links"),
6079
ea34059b89de convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents: 6078
diff changeset
   205
    "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
   206
    "unix-permissions": (has_unix_permissions, "unix-style permissions"),
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   207
}
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   208
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   209
def list_features():
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   210
    for name, feature in checks.iteritems():
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   211
        desc = feature[1]
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   212
        print name + ':', desc
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   213
8059
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   214
def test_features():
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   215
    failed = 0
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   216
    for name, feature in checks.iteritems():
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   217
        check, _ = feature
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   218
        try:
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   219
            check()
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   220
        except Exception, e:
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   221
            print "feature %s failed:  %s" % (name, e)
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   222
            failed += 1
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   223
    return failed
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   224
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   225
parser = optparse.OptionParser("%prog [options] [features]")
8059
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   226
parser.add_option("--test-features", action="store_true",
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   227
                  help="test available features")
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   228
parser.add_option("--list-features", action="store_true",
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   229
                  help="list available features")
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   230
parser.add_option("-q", "--quiet", action="store_true",
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   231
                  help="check features silently")
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   232
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   233
if __name__ == '__main__':
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   234
    options, args = parser.parse_args()
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   235
    if options.list_features:
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   236
        list_features()
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   237
        sys.exit(0)
5081
ea7b982b6c08 Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5074
diff changeset
   238
8059
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   239
    if options.test_features:
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   240
        sys.exit(test_features())
41a2c5cbcb6a hghave: checking that all targets are Exception-free
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 7823
diff changeset
   241
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   242
    quiet = options.quiet
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   243
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   244
    failures = 0
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   245
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   246
    def error(msg):
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   247
        global failures
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   248
        if not quiet:
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   249
            sys.stderr.write(msg + '\n')
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   250
        failures += 1
5081
ea7b982b6c08 Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5074
diff changeset
   251
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   252
    for feature in args:
5084
80309fa23cdb hghave: feature absence can be checked by prefixing with 'no-'
Patrick Mezard <pmezard@gmail.com>
parents: 5081
diff changeset
   253
        negate = feature.startswith('no-')
80309fa23cdb hghave: feature absence can be checked by prefixing with 'no-'
Patrick Mezard <pmezard@gmail.com>
parents: 5081
diff changeset
   254
        if negate:
80309fa23cdb hghave: feature absence can be checked by prefixing with 'no-'
Patrick Mezard <pmezard@gmail.com>
parents: 5081
diff changeset
   255
            feature = feature[3:]
5091
fc6106267198 Hide absolute path from test-no-symlinks output.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5090
diff changeset
   256
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   257
        if feature not in checks:
5685
57d29a45ffbc Use skipped: instead of hghave: for skipping tests, use this in test-merge-types
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5410
diff changeset
   258
            error('skipped: unknown feature: ' + feature)
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   259
            continue
5081
ea7b982b6c08 Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5074
diff changeset
   260
ea7b982b6c08 Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5074
diff changeset
   261
        check, desc = checks[feature]
8060
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   262
        try:
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   263
            available = check()
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   264
        except Exception, e:
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   265
            error('hghave check failed: ' + feature)
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   266
            continue
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   267
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   268
        if not negate and not available:
5685
57d29a45ffbc Use skipped: instead of hghave: for skipping tests, use this in test-merge-types
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5410
diff changeset
   269
            error('skipped: missing feature: ' + desc)
8060
84d0fe34427b run-tests: detect when hghave fails to check for a feature and fail test
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8059
diff changeset
   270
        elif negate and available:
5685
57d29a45ffbc Use skipped: instead of hghave: for skipping tests, use this in test-merge-types
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5410
diff changeset
   271
            error('skipped: system supports %s' % desc)
4881
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   272
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   273
    if failures != 0:
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   274
        sys.exit(1)
c51c9bc4579d Add hghave utility and run-tests.py support.
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   275
5081
ea7b982b6c08 Remove trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5074
diff changeset
   276