tests/fsmonitor-run-tests.py
author Raphaël Gomès <rgomes@octobus.net>
Tue, 01 Oct 2024 13:49:11 +0200
changeset 52060 8b7123c8947b
parent 51703 ca7bde5dbafb
permissions -rwxr-xr-x
update: add a Rust fast-path when updating from null (and clean) This case is easy to detect and we have all we need to generate a valid working copy and dirstate entirely in Rust, which speeds things up considerably: On my machine updating a repo of ~300k files goes from 10.00s down to 4.2s, all while consuming 50% less system time, with all caches hot. Something to note is that further improvements will probably happen with the upcoming `InnerRevlog` series that does smarter mmap hanlding, especially for filelogs. Here are benchmark numbers on a machine with only 4 cores (and no SMT enabled) ``` ### data-env-vars.name = heptapod-public-2024-03-25-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 5.328762 ~~~~~ rust: 1.308654 (-75.44%, -4.02) ### data-env-vars.name = mercurial-devel-2024-03-22-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 1.693271 ~~~~~ rust: 1.151053 (-32.02%, -0.54) ### data-env-vars.name = mozilla-unified-2024-03-22-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 38.901613 ~~~~~ rust: 11.637880 (-70.08%, -27.26) ### data-env-vars.name = netbsd-xsrc-public-2024-09-19-ds2-pnm # benchmark.name = hg.command.update # bin-env-vars.hg.py-re2-module = default # bin-env-vars.hg.changeset.node = <this change> # benchmark.variants.atomic-update = no # benchmark.variants.scenario = null-to-tip # benchmark.variants.worker = default default: 4.793727 ~~~~~ rust: 1.505905 (-68.59%, -3.29) ```
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45830
c102b704edb5 global: use python3 in shebangs
Gregory Szorc <gregory.szorc@gmail.com>
parents: 44448
diff changeset
     1
#!/usr/bin/env python3
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     2
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     3
# fsmonitor-run-tests.py - Run Mercurial tests with fsmonitor enabled
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     4
#
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     5
# Copyright 2017 Facebook, Inc.
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     6
#
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     7
# This software may be used and distributed according to the terms of the
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     8
# GNU General Public License version 2 or any later version.
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
     9
#
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    10
# This is a wrapper around run-tests.py that spins up an isolated instance of
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    11
# Watchman and runs the Mercurial tests against it. This ensures that the global
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    12
# version of Watchman isn't affected by anything this test does.
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    13
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    14
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    15
import argparse
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    16
import contextlib
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    17
import json
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    18
import os
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    19
import shutil
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    20
import subprocess
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    21
import sys
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    22
import tempfile
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    23
import uuid
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    24
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    25
osenvironb = getattr(os, 'environb', os.environ)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    26
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    27
if sys.version_info > (3, 5, 0):
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    28
    PYTHON3 = True
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    29
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
    30
    def _sys2bytes(p):
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    31
        return p.encode('utf-8')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    32
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    33
elif sys.version_info >= (3, 0, 0):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    34
    print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    35
        '%s is only supported on Python 3.5+ and 2.7, not %s'
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    36
        % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    37
    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    38
    sys.exit(70)  # EX_SOFTWARE from `man 3 sysexit`
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    39
else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    40
    PYTHON3 = False
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    41
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    42
    # In python 2.x, path operations are generally done using
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    43
    # bytestrings by default, so we don't have to do any extra
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    44
    # fiddling there. We define the wrapper functions anyway just to
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    45
    # help keep code consistent between platforms.
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
    46
    def _sys2bytes(p):
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    47
        return p
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    48
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    49
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    50
def getparser():
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    51
    """Obtain the argument parser used by the CLI."""
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    52
    parser = argparse.ArgumentParser(
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    53
        description='Run tests with fsmonitor enabled.',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    54
        epilog='Unrecognized options are passed to run-tests.py.',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    55
    )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    56
    # - keep these sorted
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    57
    # - none of these options should conflict with any in run-tests.py
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    58
    parser.add_argument(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    59
        '--keep-fsmonitor-tmpdir',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    60
        action='store_true',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    61
        help='keep temporary directory with fsmonitor state',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    62
    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    63
    parser.add_argument(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    64
        '--watchman',
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    65
        help='location of watchman binary (default: watchman in PATH)',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    66
        default='watchman',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    67
    )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    68
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    69
    return parser
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    70
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    71
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    72
@contextlib.contextmanager
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    73
def watchman(args):
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    74
    basedir = tempfile.mkdtemp(prefix='hg-fsmonitor')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    75
    try:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    76
        # Much of this configuration is borrowed from Watchman's test harness.
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    77
        cfgfile = os.path.join(basedir, 'config.json')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    78
        # TODO: allow setting a config
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    79
        with open(cfgfile, 'w') as f:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    80
            f.write(json.dumps({}))
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    81
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    82
        logfile = os.path.join(basedir, 'log')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    83
        clilogfile = os.path.join(basedir, 'cli-log')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    84
        if os.name == 'nt':
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    85
            sockfile = '\\\\.\\pipe\\watchman-test-%s' % uuid.uuid4().hex
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    86
        else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    87
            sockfile = os.path.join(basedir, 'sock')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    88
        pidfile = os.path.join(basedir, 'pid')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    89
        statefile = os.path.join(basedir, 'state')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    90
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    91
        argv = [
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    92
            args.watchman,
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    93
            '--sockname',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    94
            sockfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    95
            '--logfile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    96
            logfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    97
            '--pidfile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    98
            pidfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    99
            '--statefile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   100
            statefile,
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   101
            '--foreground',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   102
            '--log-level=2',  # debug logging for watchman
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   103
        ]
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   104
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   105
        envb = osenvironb.copy()
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
   106
        envb[b'WATCHMAN_CONFIG_FILE'] = _sys2bytes(cfgfile)
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   107
        with open(clilogfile, 'wb') as f:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   108
            proc = subprocess.Popen(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   109
                argv, env=envb, stdin=None, stdout=f, stderr=f
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   110
            )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   111
            try:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   112
                yield sockfile
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   113
            finally:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   114
                proc.terminate()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   115
                proc.kill()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   116
    finally:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   117
        if args.keep_fsmonitor_tmpdir:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   118
            print('fsmonitor dir available at %s' % basedir)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   119
        else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   120
            shutil.rmtree(basedir, ignore_errors=True)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   121
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   122
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   123
def run():
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   124
    parser = getparser()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   125
    args, runtestsargv = parser.parse_known_args()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   126
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   127
    with watchman(args) as sockfile:
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
   128
        osenvironb[b'WATCHMAN_SOCK'] = _sys2bytes(sockfile)
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   129
        # Indicate to hghave that we're running with fsmonitor enabled.
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   130
        osenvironb[b'HGFSMONITOR_TESTS'] = b'1'
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   131
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   132
        runtestdir = os.path.dirname(__file__)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   133
        runtests = os.path.join(runtestdir, 'run-tests.py')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   134
        blacklist = os.path.join(runtestdir, 'blacklists', 'fsmonitor')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   135
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   136
        runtestsargv.insert(0, runtests)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   137
        runtestsargv.extend(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   138
            [
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   139
                '--extra-config',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   140
                'extensions.fsmonitor=',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   141
                # specify fsmonitor.mode=paranoid always in order to force
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   142
                # fsmonitor extension execute "paranoid" code path
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   143
                #
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   144
                # TODO: make fsmonitor-run-tests.py accept specific options
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   145
                '--extra-config',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   146
                'fsmonitor.mode=paranoid',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   147
                '--blacklist',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   148
                blacklist,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   149
            ]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   150
        )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   151
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   152
        return subprocess.call(runtestsargv)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   153
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   154
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   155
if __name__ == '__main__':
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   156
    sys.exit(run())