def run_and_check(self, argv, env=None, for_coverage=False, memcheck=False, analyze_output=True): """ Run a subprocess with `argv` and check it completes with status code 0. In case of failure, the test output is appended to the actual output and a TestError is raised. :param list[str] argv: List of arguments to pass to the subprocess. :param None|dict[str, str] env: If provided, environment variables to pass to the subprocess. :param bool for_coverage: If true and if coverage is enabled, produce a trace file. :param bool memcheck: If true and if Valgrind runs are requested, run this process under Valgrind. If there are memory issues, they be reported on the testcase output and the process will return non-zero. :param bool analyze_output: See e3.testsuite.driver.classic.ClassicTestDriver.shell. """ if for_coverage and self.coverage_enabled: trace_file = self.coverage_file('trace') argv = ['gnatcov', 'run', '-o', trace_file] + argv if memcheck and self.valgrind_enabled: argv = valgrind_cmd(argv) self.shell(argv, env=env, analyze_output=analyze_output)
def run(*argv, **kwargs): valgrind = kwargs.pop('valgrind', False) suppressions = kwargs.pop('valgrind_suppressions', []) assert not kwargs if valgrind_enabled and valgrind: argv = valgrind_cmd(list(argv), suppressions) subprocess.check_call(argv, env=env)