tests/common-pattern.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 02 Dec 2022 05:10:05 +0100
changeset 49724 f3b685d9e899
parent 49524 45268599f55e
child 50292 adecb1ab4a0d
child 50381 2cf264e9aa75
permissions -rw-r--r--
path: pass `path` to `peer` in `hg summary` We directly use the `path` object to build the `peer` object.
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
35449
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
     3
import os
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
     4
35070
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
substitutions = [
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
    # list of possible compressions
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
     7
    (br'(zstd,)?zlib,none,bzip2', br'$USUAL_COMPRESSIONS$'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
     8
    (br'=(zstd,)?zlib', br'=$BUNDLE2_COMPRESSIONS$'),
35071
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
     9
    # capabilities sent through http
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    10
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    11
        br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    12
        br'bookmarks%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    13
        br'changegroup%253D01%252C02%250A'
44412
edc8504bc26b exchange: turn on option that makes concurrent pushes work better
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 43076
diff changeset
    14
        br'checkheads%253Drelated%250A'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    15
        br'digests%253Dmd5%252Csha1%252Csha512%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    16
        br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    17
        br'hgtagsfnodes%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    18
        br'listkeys%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    19
        br'phases%253Dheads%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    20
        br'pushkey%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    21
        br'remote-changegroup%253Dhttp%252Chttps%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    22
        br'stream%253Dv2',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    23
        # (the replacement patterns)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    24
        br'$USUAL_BUNDLE_CAPS$',
35071
b4767ae63b32 test-pattern: register current the bundlecaps string
Boris Feld <boris.feld@octobus.net>
parents: 35070
diff changeset
    25
    ),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    26
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    27
        br'bundlecaps=HG20%2Cbundle2%3DHG20%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    28
        br'bookmarks%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    29
        br'changegroup%253D01%252C02%250A'
44412
edc8504bc26b exchange: turn on option that makes concurrent pushes work better
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 43076
diff changeset
    30
        br'checkheads%3Drelated%0A'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    31
        br'digests%253Dmd5%252Csha1%252Csha512%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    32
        br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    33
        br'hgtagsfnodes%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    34
        br'listkeys%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    35
        br'phases%253Dheads%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    36
        br'pushkey%250A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    37
        br'remote-changegroup%253Dhttp%252Chttps',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    38
        # (the replacement patterns)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    39
        br'$USUAL_BUNDLE_CAPS_SERVER$',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    40
    ),
35072
c4ec72a10798 test-pattern: register the current the bundle2 capabilities string
Boris Feld <boris.feld@octobus.net>
parents: 35071
diff changeset
    41
    # bundle2 capabilities sent through ssh
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    42
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    43
        br'bundle2=HG20%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    44
        br'bookmarks%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    45
        br'changegroup%3D01%2C02%0A'
44412
edc8504bc26b exchange: turn on option that makes concurrent pushes work better
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 43076
diff changeset
    46
        br'checkheads%3Drelated%0A'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    47
        br'digests%3Dmd5%2Csha1%2Csha512%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    48
        br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    49
        br'hgtagsfnodes%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    50
        br'listkeys%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    51
        br'phases%3Dheads%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    52
        br'pushkey%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    53
        br'remote-changegroup%3Dhttp%2Chttps%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    54
        br'stream%3Dv2',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    55
        # (replacement patterns)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    56
        br'$USUAL_BUNDLE2_CAPS$',
35792
1d118f9f4f57 bundle2: always advertise client support for stream parts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35449
diff changeset
    57
    ),
1d118f9f4f57 bundle2: always advertise client support for stream parts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35449
diff changeset
    58
    # bundle2 capabilities advertised by the server
38728
88be288e8ac1 tests: refactor common bundle2 capabilities
Joerg Sonnenberger <joerg@bec.de>
parents: 37477
diff changeset
    59
    (
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    60
        br'bundle2=HG20%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    61
        br'bookmarks%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    62
        br'changegroup%3D01%2C02%0A'
44412
edc8504bc26b exchange: turn on option that makes concurrent pushes work better
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 43076
diff changeset
    63
        br'checkheads%3Drelated%0A'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    64
        br'digests%3Dmd5%2Csha1%2Csha512%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    65
        br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    66
        br'hgtagsfnodes%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    67
        br'listkeys%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    68
        br'phases%3Dheads%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    69
        br'pushkey%0A'
46633
7015b0232c5e exchange: stop advertising rev-branch-cache bundle capability
Joerg Sonnenberger <joerg@bec.de>
parents: 44412
diff changeset
    70
        br'remote-changegroup%3Dhttp%2Chttps',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    71
        # (replacement patterns)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    72
        br'$USUAL_BUNDLE2_CAPS_SERVER$',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    73
    ),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    74
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    75
        br'bundle2=HG20%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    76
        br'bookmarks%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    77
        br'changegroup%3D01%2C02%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    78
        br'digests%3Dmd5%2Csha1%2Csha512%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    79
        br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    80
        br'hgtagsfnodes%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    81
        br'listkeys%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    82
        br'pushkey%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    83
        br'remote-changegroup%3Dhttp%2Chttps%0A'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    84
        br'stream%3Dv2',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    85
        # (replacement patterns)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    86
        br'$USUAL_BUNDLE2_CAPS_NO_PHASES$',
38728
88be288e8ac1 tests: refactor common bundle2 capabilities
Joerg Sonnenberger <joerg@bec.de>
parents: 37477
diff changeset
    87
    ),
37477
28e8c5949109 tests: add a substitution pattern for HTTP error log dates
Matt Harbison <matt_harbison@yahoo.com>
parents: 37008
diff changeset
    88
    # HTTP access log dates
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    89
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    90
        br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    91
        lambda m: br' - - [$LOGDATE$] "' + m.group(1),
35073
7f0c9e28a816 test-pattern: substitute the HTTP log timestamp too
Boris Feld <boris.feld@octobus.net>
parents: 35072
diff changeset
    92
    ),
37477
28e8c5949109 tests: add a substitution pattern for HTTP error log dates
Matt Harbison <matt_harbison@yahoo.com>
parents: 37008
diff changeset
    93
    # HTTP error log dates
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    94
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    95
        br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] (HG error:|Exception)',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    96
        lambda m: br' - - [$ERRDATE$] ' + m.group(1),
37477
28e8c5949109 tests: add a substitution pattern for HTTP error log dates
Matt Harbison <matt_harbison@yahoo.com>
parents: 37008
diff changeset
    97
    ),
36924
03368431f014 tests: add a substitution pattern for dates in HTTP headers and LFS payload
Matt Harbison <matt_harbison@yahoo.com>
parents: 36385
diff changeset
    98
    # HTTP header dates- RFC 1123
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
    99
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   100
        br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   101
        lambda m: br'%s: $HTTP_DATE$' % m.group(1),
36924
03368431f014 tests: add a substitution pattern for dates in HTTP headers and LFS payload
Matt Harbison <matt_harbison@yahoo.com>
parents: 36385
diff changeset
   102
    ),
03368431f014 tests: add a substitution pattern for dates in HTTP headers and LFS payload
Matt Harbison <matt_harbison@yahoo.com>
parents: 36385
diff changeset
   103
    # LFS expiration value
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   104
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   105
        br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   106
        br'"expires_at": "$ISO_8601_DATE_TIME$"',
36924
03368431f014 tests: add a substitution pattern for dates in HTTP headers and LFS payload
Matt Harbison <matt_harbison@yahoo.com>
parents: 36385
diff changeset
   107
    ),
35446
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
   108
    # 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
   109
    #   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
   110
    #   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
   111
    #   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
   112
    #       file:/*/$TESTTMP/largefiles-repo (glob)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   113
    (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   114
        br'(.*file:/)/?(/\$TESTTMP.*)',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   115
        lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)',
35446
991e4404e910 tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
Matt Harbison <matt_harbison@yahoo.com>
parents: 35259
diff changeset
   116
    ),
47868
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   117
    # `hg clone --stream` output
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   118
    (
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   119
        br'transferred (\S+?) KB in \S+? seconds \(.+?/sec\)(?: \(glob\))?(.*)',
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   120
        lambda m: (
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   121
            br'transferred %s KB in * seconds (* */sec) (glob)%s'
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   122
            % (m.group(1), m.group(2))
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   123
        ),
8ae828fd008b clone: automatically glob stream clone output in test
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46633
diff changeset
   124
    ),
35070
3abdd7da33bd test-pattern: substitute common compression list
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   125
]
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   126
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   127
# 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
   128
_errors = {
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   129
    br'$ENOENT$': (
42329
c7652f7440d9 rust-filepatterns: call new Rust implementations from Python
Raphaël Gomès <rgomes@octobus.net>
parents: 40881
diff changeset
   130
        # IOError in Python does not have the same error message
c7652f7440d9 rust-filepatterns: call new Rust implementations from Python
Raphaël Gomès <rgomes@octobus.net>
parents: 40881
diff changeset
   131
        # than in Rust, and automatic conversion is not possible
c7652f7440d9 rust-filepatterns: call new Rust implementations from Python
Raphaël Gomès <rgomes@octobus.net>
parents: 40881
diff changeset
   132
        # because of module member privacy.
c7652f7440d9 rust-filepatterns: call new Rust implementations from Python
Raphaël Gomès <rgomes@octobus.net>
parents: 40881
diff changeset
   133
        br'No such file or directory \(os error 2\)',
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   134
        # strerror()
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   135
        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
   136
        # 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
   137
        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
   138
    ),
35231
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
   139
    br'$ENOTDIR$': (
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
   140
        # strerror()
b33d4cf38666 tests: add a substitution for ENOTDIR/ERROR_PATH_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
   141
        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
   142
        # 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
   143
        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
   144
    ),
35232
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
   145
    br'$ECONNRESET$': (
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
   146
        # strerror()
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
   147
        br'Connection reset by peer',
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
   148
        # FormatMessage(WSAECONNRESET)
a037b6647d8c tests: add a substitution for ECONNRESET/WSAECONNRESET messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35231
diff changeset
   149
        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
   150
    ),
35233
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
   151
    br'$EADDRINUSE$': (
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
   152
        # strerror()
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
   153
        br'Address already in use',
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
   154
        # FormatMessage(WSAEADDRINUSE)
1b22d325089c tests: add a substitution for EADDRINUSE/WSAEADDRINUSE messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35232
diff changeset
   155
        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
   156
        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
   157
    ),
40881
8695fbe17f7c tests: update network related errors for Debian 9
Boris Feld <boris.feld@octobus.net>
parents: 39722
diff changeset
   158
    br'$EADDRNOTAVAIL$': (
8695fbe17f7c tests: update network related errors for Debian 9
Boris Feld <boris.feld@octobus.net>
parents: 39722
diff changeset
   159
        # strerror()
8695fbe17f7c tests: update network related errors for Debian 9
Boris Feld <boris.feld@octobus.net>
parents: 39722
diff changeset
   160
        br'Cannot assign requested address',
49524
45268599f55e tests: add another variation of EADDRNOTAVAIL message (e.g. from NetBSD)
Anton Shestakov <av6@dwimlabs.net>
parents: 48875
diff changeset
   161
        br'Can\'t assign requested address',
40881
8695fbe17f7c tests: update network related errors for Debian 9
Boris Feld <boris.feld@octobus.net>
parents: 39722
diff changeset
   162
        # FormatMessage(WSAEADDRNOTAVAIL)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   163
    ),
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   164
}
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   165
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 35073
diff changeset
   166
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
   167
    substitutions.extend((m, replace) for m in msgs)
35449
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   168
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   169
# Output lines on Windows that can be autocorrected for '\' vs '/' path
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   170
# differences.
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   171
_winpathfixes = [
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   172
    # cloning subrepo s\ss from $TESTTMP/t/s/ss
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   173
    # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   174
    br'(?m)^cloning subrepo \S+\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   175
    # pulling from $TESTTMP\issue1852a
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   176
    br'(?m)^pulling from \$TESTTMP\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   177
    # pushing to $TESTTMP\a
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   178
    br'(?m)^pushing to \$TESTTMP\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   179
    # pushing subrepo s\ss to $TESTTMP/t/s/ss
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   180
    br'(?m)^pushing subrepo \S+\\\S+ to.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   181
    # moving d1\d11\a1 to d3/d11/a1
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   182
    br'(?m)^moving \S+\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   183
    # d1\a: not recording move - dummy does not exist
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   184
    br'\S+\\\S+: not recording move .+',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   185
    # reverting s\a
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   186
    br'(?m)^reverting (?!subrepo ).*\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   187
    # saved backup bundle to
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   188
    #     $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   189
    br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   190
    # no changes made to subrepo s\ss since last push to ../tcc/s/ss
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   191
    br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   192
    # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   193
    #     $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   194
    br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   195
    # stuff/maybelarge.dat: largefile 76..38 not available from
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   196
    #     file:/*/$TESTTMP\largefiles-repo (glob)
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   197
    br'.*: largefile \S+ not available from file:/\*/.+',
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   198
]
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   199
24528dba0e64 run-tests: add substitution patterns for common '\' path output on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 35446
diff changeset
   200
if os.name == 'nt':
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   201
    substitutions.extend(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   202
        [
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   203
            (s, lambda match: match.group().replace(b'\\', b'/'))
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   204
            for s in _winpathfixes
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   205
        ]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42329
diff changeset
   206
    )