This is an automated email from the ASF dual-hosted git repository. bbannier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 4da90f4843237e9f6094c93aadd2a34bf082360e Author: Benjamin Bannier <[email protected]> AuthorDate: Wed Nov 7 22:40:11 2018 +0100 Added environment sanity check to parallel test runner. This patch adds a check to the parallel test runner that catches setups where the user is not allowed to launch many process (e.g., the default value for `ulimit -u` on centos7). This can lead to test execution failures if many `mesos-tests` instances are run in parallel on machines with many cores (by default the parallel test runner would execute `nproc` shards which would fork potentially multiple executable launching `nproc` libprocess worker threads). Review: https://reviews.apache.org/r/69275/ --- support/mesos-gtest-runner.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/support/mesos-gtest-runner.py b/support/mesos-gtest-runner.py index c8f4d51..d2a57ee 100755 --- a/support/mesos-gtest-runner.py +++ b/support/mesos-gtest-runner.py @@ -201,8 +201,37 @@ def parse_arguments(): return executable, args +def validate_setup(options): + """Validate the execution environment and the used options.""" + + # Check the number of processes/threads a user is allowed to execute. + try: + ulimit = int(subprocess.check_output(['ulimit', '-u'])) + + # As a proxy for our requirements we assume that each test executable + # launches a thread for every available CPU times a factor of 16 to + # accommodate additional processes forked in parallel. + requirement = options.jobs * multiprocessing.cpu_count() * 16 + + if ulimit < requirement: + print(Bcolors.colorize( + "Detected low process count ulimit ({} vs {}). Increase " + "'ulimit -u' to avoid spurious test failures." + .format(ulimit, requirement), + Bcolors.WARNING), + file=sys.stderr) + sys.exit(1) + except Exception as err: + print(Bcolors.colorize( + "Could not check compatibility of ulimit settings: {}".format(err), + Bcolors.WARNING), + file=sys.stderr) + sys.exit() + + if __name__ == '__main__': EXECUTABLE, OPTIONS = parse_arguments() + validate_setup(OPTIONS) def options_gen(executable, filter_, jobs): """Generator for options for a certain shard.
