tests/fsmonitor-run-tests.py
author Sandu Turcan <idlsoft@gmail.com>
Tue, 03 May 2022 21:44:30 -0400
branchstable
changeset 49241 6b10151b9621
parent 45830 c102b704edb5
child 48875 6000f5b25c9b
permissions -rwxr-xr-x
narrow_widen_acl: enforce narrowacl in narrow_widen (SEC) Reviewer note: this was sent by the author as a simple bugfix, but can be considered a security patch, since it allows users to access things outside of the ACL, hence the (SEC) prefix. However, this affects the `narrow` extention which is still marked as experimental and has relatively few users aside from large companies with their own security layers on top from what we can gather. We feel (Alphare: or at least, I feel) like pinging the packaging list is enough in this case.
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
from __future__ import absolute_import
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    15
from __future__ import print_function
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    16
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    17
import argparse
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    18
import contextlib
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    19
import json
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    20
import os
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    21
import shutil
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    22
import subprocess
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    23
import sys
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    24
import tempfile
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    25
import uuid
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
osenvironb = getattr(os, 'environb', os.environ)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    28
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    29
if sys.version_info > (3, 5, 0):
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    30
    PYTHON3 = True
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    31
    xrange = range  # we use xrange in one place, and we'd rather not use range
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    32
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
    33
    def _sys2bytes(p):
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    34
        return p.encode('utf-8')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    35
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    36
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    37
elif sys.version_info >= (3, 0, 0):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    38
    print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    39
        '%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
    40
        % (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
    41
    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    42
    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
    43
else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    44
    PYTHON3 = False
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    45
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    46
    # 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
    47
    # 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
    48
    # 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
    49
    # 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
    50
    def _sys2bytes(p):
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    51
        return p
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    52
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    53
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    54
def getparser():
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    55
    """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
    56
    parser = argparse.ArgumentParser(
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    57
        description='Run tests with fsmonitor enabled.',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    58
        epilog='Unrecognized options are passed to run-tests.py.',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    59
    )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    60
    # - keep these sorted
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    61
    # - 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
    62
    parser.add_argument(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    63
        '--keep-fsmonitor-tmpdir',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    64
        action='store_true',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    65
        help='keep temporary directory with fsmonitor state',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    66
    )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    67
    parser.add_argument(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    68
        '--watchman',
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    69
        help='location of watchman binary (default: watchman in PATH)',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    70
        default='watchman',
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
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    73
    return parser
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    74
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    75
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    76
@contextlib.contextmanager
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    77
def watchman(args):
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    78
    basedir = tempfile.mkdtemp(prefix='hg-fsmonitor')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    79
    try:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    80
        # 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
    81
        cfgfile = os.path.join(basedir, 'config.json')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    82
        # TODO: allow setting a config
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    83
        with open(cfgfile, 'w') as f:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    84
            f.write(json.dumps({}))
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    85
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    86
        logfile = os.path.join(basedir, 'log')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    87
        clilogfile = os.path.join(basedir, 'cli-log')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    88
        if os.name == 'nt':
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    89
            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
    90
        else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    91
            sockfile = os.path.join(basedir, 'sock')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    92
        pidfile = os.path.join(basedir, 'pid')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    93
        statefile = os.path.join(basedir, 'state')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    94
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    95
        argv = [
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
    96
            args.watchman,
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    97
            '--sockname',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    98
            sockfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
    99
            '--logfile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   100
            logfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   101
            '--pidfile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   102
            pidfile,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   103
            '--statefile',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   104
            statefile,
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   105
            '--foreground',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   106
            '--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
   107
        ]
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   108
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   109
        envb = osenvironb.copy()
44448
55c443fcb4fc tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
Manuel Jacob <me@manueljacob.de>
parents: 43076
diff changeset
   110
        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
   111
        with open(clilogfile, 'wb') as f:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   112
            proc = subprocess.Popen(
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   113
                argv, env=envb, stdin=None, stdout=f, stderr=f
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   114
            )
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   115
            try:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   116
                yield sockfile
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   117
            finally:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   118
                proc.terminate()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   119
                proc.kill()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   120
    finally:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   121
        if args.keep_fsmonitor_tmpdir:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   122
            print('fsmonitor dir available at %s' % basedir)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   123
        else:
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   124
            shutil.rmtree(basedir, ignore_errors=True)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   125
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   126
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   127
def run():
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   128
    parser = getparser()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   129
    args, runtestsargv = parser.parse_known_args()
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   130
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   131
    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
   132
        osenvironb[b'WATCHMAN_SOCK'] = _sys2bytes(sockfile)
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   133
        # 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
   134
        osenvironb[b'HGFSMONITOR_TESTS'] = b'1'
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
        runtestdir = os.path.dirname(__file__)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   137
        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
   138
        blacklist = os.path.join(runtestdir, 'blacklists', 'fsmonitor')
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   139
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   140
        runtestsargv.insert(0, runtests)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   141
        runtestsargv.extend(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   142
            [
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   143
                '--extra-config',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   144
                'extensions.fsmonitor=',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   145
                # specify fsmonitor.mode=paranoid always in order to force
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   146
                # fsmonitor extension execute "paranoid" code path
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   147
                #
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   148
                # TODO: make fsmonitor-run-tests.py accept specific options
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   149
                '--extra-config',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   150
                'fsmonitor.mode=paranoid',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   151
                '--blacklist',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   152
                blacklist,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   153
            ]
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
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   156
        return subprocess.call(runtestsargv)
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   157
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40208
diff changeset
   158
32769
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   159
if __name__ == '__main__':
efd6e941e933 tests: add a wrapper to run fsmonitor tests
Siddharth Agarwal <sid0@fb.com>
parents:
diff changeset
   160
    sys.exit(run())