| # COS: This patch is needed for updating packages in chromiumos-overlay. |
| # commit 8b639eaa96932565b41da559e4a533f65ba471af introduces a change in |
| # namespaces.SimpleUnshare() in common-mk/platform2_test.py. Until we pick |
| # up the change in our mirror repo, we have to keep the old interface. |
| # commit 3bb505c6986 introduces dependency on gtest_parallel. We need to |
| # remove that dependency since we don't have it in COS source code. |
| # commit 3ce1c04bb8 removed post_test support. We need to add it back. |
| diff --git a/common-mk/platform2_test.py b/common-mk/platform2_test.py |
| index 435e7e8dde..d051b371af 100755 |
| --- a/common-mk/platform2_test.py |
| +++ b/common-mk/platform2_test.py |
| @@ -434,6 +434,12 @@ class Platform2Test: |
| self.qemu.Install() |
| self.qemu.RegisterBinfmt() |
| |
| + def post_test(self): |
| + """Runs post-test teardown. |
| + |
| + Removes mounts/files copied during pre-test. |
| + """ |
| + |
| def _remount_ro(self, path: str) -> None: |
| """Helper to remount a path as read-only. |
| |
| @@ -759,25 +765,6 @@ class Platform2Test: |
| if gtest_filter != "-": |
| argv.append("--gtest_filter=" + gtest_filter) |
| |
| - # Default for jobs is 1 right now in which case we run the test runner |
| - # directly since running it as gtest_parallel carries a non-trivial |
| - # overhead. |
| - if self.jobs != 1: |
| - # Switch to using gtest-parallel instead to run tests parallelly. |
| - # Introduces a dependency on python while running tests, which |
| - # means that for some cross compilations this maybe slower. |
| - cmd = os.path.join( |
| - constants.CHROOT_SOURCE_ROOT, |
| - "src/third_party/gtest-parallel/gtest-parallel", |
| - ) |
| - argv.insert(0, cmd) |
| - # Special value 0 is used to indicate “use all available CPU cores". |
| - # If the invocation specifies any number other than zero or one, use |
| - # that. The default for gtest-parallel is to use all available |
| - # workers. |
| - if self.jobs: |
| - argv.append(f"--workers={self.jobs}") |
| - |
| # Make orphaned child processes reparent to this process |
| # instead of the init process. This allows us to kill them if |
| # they do not terminate after the test has finished running. |
| @@ -1024,14 +1011,12 @@ def _ReExecuteIfNeeded( |
| print(f"error: user not supported: {user}", file=sys.stderr) |
| sys.exit(1) |
| |
| - namespaces.SimpleUnshare( |
| - net=ns_net, pid=ns_pid, pid_uid=pid_uid, pid_gid=pid_gid |
| - ) |
| + namespaces.SimpleUnshare(net=ns_net, pid=ns_pid) |
| |
| |
| def GetParser(): |
| """Return a command line parser.""" |
| - actions = ["pre_test", "run"] |
| + actions = ["pre_test", "post_test", "run"] |
| |
| parser = commandline.ArgumentParser(description=__doc__) |
| group = parser.add_argument_group("Namespaces") |
| @@ -1141,9 +1126,6 @@ def main(argv): |
| if not os.path.isdir(options.sysroot): |
| parser.error(message="Sysroot does not exist: %s" % options.sysroot) |
| |
| - if options.jobs < 0: |
| - parser.error("You must specify jobs greater than or equal to 0") |
| - |
| if options.strategy == "sudo": |
| if options.pid_uid is None: |
| options.pid_uid = os.getuid() |