tests/common-pattern.py
author Matt Harbison <matt_harbison@yahoo.com>
Sat, 16 Dec 2017 11:32:10 -0500
changeset 35446 991e4404e910
parent 35259 ad5f2b923b0d
child 35449 24528dba0e64
permissions -rw-r--r--
tests: convert the 'file://\$TESTTMP' rule to an automatic substitution The rule only triggered on non Windows platforms, even though Windows also required an adjustment. Automatic seems better. The aggressive globbing in test-subrepo-svn.t was found and rewritten by the substitution.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35070
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
# common patterns in test at can safely be replaced
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
from __future__ import absolute_import
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
substitutions = [
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
    # list of possible compressions
35234
f0445eea9b93 test: fix common-pattern for pure variant
Boris Feld <boris.feld@octobus.net>
parents: 35233
diff changeset
     6
    (br'(zstd,)?zlib,none,bzip2',
35070
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     7
     br'$USUAL_COMPRESSIONS$'
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
    ),
35071
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
     9
    # capabilities sent through http
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    10
    (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
35259
ad5f2b923b0d push: include a 'check:bookmarks' part when possible
Boris Feld <boris.feld@octobus.net>
parents: 35234
diff changeset
    11
     br'bookmarks%250A'
35071
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    12
     br'changegroup%253D01%252C02%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    13
     br'digests%253Dmd5%252Csha1%252Csha512%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    14
     br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    15
     br'hgtagsfnodes%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    16
     br'listkeys%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    17
     br'phases%253Dheads%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    18
     br'pushkey%250A'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    19
     br'remote-changegroup%253Dhttp%252Chttps',
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    20
     # (the replacement patterns)
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    21
     br'$USUAL_BUNDLE_CAPS$'
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    22
    ),
35072
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    23
    # bundle2 capabilities sent through ssh
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    24
    (br'bundle2=HG20%0A'
35259
ad5f2b923b0d push: include a 'check:bookmarks' part when possible
Boris Feld <boris.feld@octobus.net>
parents: 35234
diff changeset
    25
     br'bookmarks%0A'
35072
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    26
     br'changegroup%3D01%2C02%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    27
     br'digests%3Dmd5%2Csha1%2Csha512%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    28
     br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    29
     br'hgtagsfnodes%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    30
     br'listkeys%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    31
     br'phases%3Dheads%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    32
     br'pushkey%0A'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    33
     br'remote-changegroup%3Dhttp%2Chttps',
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    34
     # (replacement patterns)
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    35
     br'$USUAL_BUNDLE2_CAPS$'
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    36
    ),
35073
7f0c9e28a816 test-pattern: substitute the HTTP log timestamp too
Boris Feld <boris.feld@octobus.net>
parents: 35072
diff changeset
    37
    # HTTP log dates
7f0c9e28a816 test-pattern: substitute the HTTP log timestamp too
Boris Feld <boris.feld@octobus.net>
parents: 35072
diff changeset
    38
    (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
7f0c9e28a816 test-pattern: substitute the HTTP log timestamp too
Boris Feld <boris.feld@octobus.net>
parents: 35072
diff changeset
    39
     br' - - [$LOGDATE$] "GET'
7f0c9e28a816 test-pattern: substitute the HTTP log timestamp too
Boris Feld <boris.feld@octobus.net>
parents: 35072
diff changeset
    40
    ),
35446
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    41
    # Windows has an extra '/' in the following lines that get globbed away:
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    42
    #   pushing to file:/*/$TESTTMP/r2 (glob)
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    43
    #   comparing with file:/*/$TESTTMP/r2 (glob)
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    44
    #   sub/maybelarge.dat: largefile 34..9c not available from
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    45
    #       file:/*/$TESTTMP/largefiles-repo (glob)
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    46
    (br'(.*file:/)/?(/\$TESTTMP.*)',
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    47
     lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
    48
    ),
35070
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    49
]
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    50
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    51
# Various platform error strings, keyed on a common replacement string
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    52
_errors = {
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    53
    br'$ENOENT$': (
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    54
        # strerror()
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    55
        br'No such file or directory',
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    56
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    57
        # FormatMessage(ERROR_FILE_NOT_FOUND)
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    58
        br'The system cannot find the file specified',
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    59
    ),
35231
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    60
    br'$ENOTDIR$': (
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    61
        # strerror()
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    62
        br'Not a directory',
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    63
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    64
        # FormatMessage(ERROR_PATH_NOT_FOUND)
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    65
        br'The system cannot find the path specified',
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
    66
    ),
35232
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    67
    br'$ECONNRESET$': (
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    68
        # strerror()
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    69
        br'Connection reset by peer',
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    70
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    71
        # FormatMessage(WSAECONNRESET)
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    72
        br'An existing connection was forcibly closed by the remote host',
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
    73
    ),
35233
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    74
    br'$EADDRINUSE$': (
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    75
        # strerror()
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    76
        br'Address already in use',
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    77
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    78
        # FormatMessage(WSAEADDRINUSE)
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    79
        br'Only one usage of each socket address'
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    80
        br' \(protocol/network address/port\) is normally permitted',
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
    81
    ),
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    82
}
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    83
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    84
for replace, msgs in _errors.items():
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
    85
    substitutions.extend((m, replace) for m in msgs)