summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2024-04-18 16:02:57 -0700
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-04-19 08:25:30 +0000
commit2b85a089251161df54b227578218fc11ad5f02a3 (patch)
treea99b805e7ece9ea5c12f016ad3facad75adf1cdc
parent74a8729d753059da9478b8ee2799dac8ba330f66 (diff)
downloadbuild-2b85a089251161df54b227578218fc11ad5f02a3.tar.gz
kleaf: wrapper fixes --strip_execroot flag.
Import re globally. Test: TH Bug: N/A Change-Id: Ifc7ab2c2922e5e1c0fc97a1aab25a8b11c6fa77e
-rwxr-xr-xkleaf/bazel.py3
-rw-r--r--kleaf/tests/integration_test/integration_test.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/kleaf/bazel.py b/kleaf/bazel.py
index 9a87627..ff8c973 100755
--- a/kleaf/bazel.py
+++ b/kleaf/bazel.py
@@ -15,6 +15,7 @@
import argparse
import os
import pathlib
+import re
import shlex
import shutil
import sys
@@ -546,7 +547,6 @@ class BazelWrapper(KleafHelpPrinter):
if run_as_subprocess:
import asyncio
- import re
asyncio.run(run(final_args, self.env, filter_regex, epilog_coro))
else:
os.execve(path=self.bazel_path, argv=final_args, env=self.env)
@@ -561,7 +561,6 @@ async def output_filter(input_stream, output_stream, filter_regex):
If filter_regex is None, don't filter lines.
"""
- import re
while not input_stream.at_eof():
output = await input_stream.readline()
if filter_regex:
diff --git a/kleaf/tests/integration_test/integration_test.py b/kleaf/tests/integration_test/integration_test.py
index f874d55..021a804 100644
--- a/kleaf/tests/integration_test/integration_test.py
+++ b/kleaf/tests/integration_test/integration_test.py
@@ -617,6 +617,11 @@ class QuickIntegrationTest(KleafIntegrationTestBase):
"""Test that `bazel help kleaf` works."""
self._check_output("help", ["kleaf"])
+ def test_strip_execroot(self):
+ """Test that --strip_execroot works."""
+ self._check_output("build", ["--nobuild", "--strip_execroot",
+ "//build/kernel:hermetic-tools"])
+
class ScmversionIntegrationTest(KleafIntegrationTestBase):