import time
import venv
import datetime
+import re
# Required Std. Path Variables
pip_version = "22.0.4"
pip_tools_version = "6.6.0"
-# Test requirement files
-test_requirements_file = os.path.join(test_dir, "requirements.txt")
-# Auto-generated requirement file
+# Compiled pip requirements file
pip_compiled_requirements_file = os.path.join(test_dir, "requirements-3.txt")
signal.signal(signal.SIGTERM, handler)
-def show_progress(stream):
+def show_progress(stream, exclude_pattern=None):
"""
Read lines from a subprocess stdout/stderr streams and write
to sys.stdout & the logfile
+
+ arguments:
+ stream - subprocess stdout or stderr data stream
+ exclude_pattern - lines matching this reg-ex will be excluded
+ from stdout.
"""
while True:
s = stream.readline()
# Filter the annoying SIGTERM signal from the output when VPP is
# terminated after a test run
if "SIGTERM" not in data:
- sys.stdout.write(data)
+ if exclude_pattern is not None:
+ if bool(re.search(exclude_pattern, data)) is False:
+ sys.stdout.write(data)
+ else:
+ sys.stdout.write(data)
logging.debug(data)
sys.stdout.flush()
stream.close()
os.environ[
"CUSTOM_COMPILE_COMMAND"
] = "make test-refresh-deps (or update requirements.txt)"
- # Cleanup previously auto-generated pip req. file
- try:
- os.unlink(pip_compiled_requirements_file)
- except OSError:
- pass
# Set the venv python executable & binary install path
env_exe = context.env_exe
bin_path = context.bin_path
test_req = [
["pip", "install", "pip===%s" % pip_version],
["pip", "install", "pip-tools===%s" % pip_tools_version],
- [
- "piptools",
- "compile",
- "-q",
- "--generate-hashes",
- test_requirements_file,
- "--output-file",
- pip_compiled_requirements_file,
- ],
["piptools", "sync", pip_compiled_requirements_file],
["pip", "install", "-e", papi_python_src_dir],
]
p = Popen(
[script, test_name, kernel_image, test_data_dir, cpu_mask, mem],
stdout=PIPE,
- stderr=STDOUT,
cwd=ws_root,
)
- show_progress(p.stdout)
+ # Show only the test result without clobbering the stdout.
+ # The VM console displays VPP stderr & Linux IPv6 netdev change
+ # messages, which is logged by default and can be excluded.
+ exclude_pattern = r"vpp\[\d+\]:|ADDRCONF\(NETDEV_CHANGE\):"
+ show_progress(p.stdout, exclude_pattern)
post_vm_test_run()
f"--jobs={jobs}",
f"--log-dir={log_dir}",
f"--tmp-dir={log_dir}",
+ f"--cache-vpp-output",
]
if running_vpp:
args = args + [f"--use-running-vpp"]