MCPcopy Create free account
hub / github.com/FDio/vpp / vm_test_runner

Function vm_test_runner

test/run.py:116–151  ·  view source on GitHub ↗

Runs a test inside a spawned QEMU VM.

(
    test_name, kernel_image, test_data_dir, cpu_mask, mem, jobs="auto", env=None
)

Source from the content-addressed store, hash-verified

114# If a kernel image is not provided, a linux-image-kvm image is
115# downloaded to the test_data_dir
116def vm_test_runner(
117 test_name, kernel_image, test_data_dir, cpu_mask, mem, jobs="auto", env=None
118):
119 """Runs a test inside a spawned QEMU VM."""
120 run_vpp_in_vm_sh = base_dir / "scripts" / "run_vpp_in_vm.sh"
121 # Set the environment variables required for running a VM test
122 os.environ["TEST_JOBS"] = str(jobs)
123 os.environ["WS_ROOT"] = str(ws_root)
124 os.environ["BR"] = env["BR"]
125 os.environ["VPP_TEST_DATA_DIR"] = str(test_data_dir)
126 os.environ["VPP_BUILD_DIR"] = env["VPP_BUILD_DIR"]
127 os.environ["VPP_INSTALL_PATH"] = env["VPP_INSTALL_PATH"]
128 os.environ["VPP_BIN"] = env["VPP_BIN"]
129 os.environ["VPP_PLUGIN_PATH"] = env["VPP_PLUGIN_PATH"]
130 os.environ["VPP_TEST_PLUGIN_PATH"] = env["VPP_TEST_PLUGIN_PATH"]
131 os.environ["LD_LIBRARY_PATH"] = env["LD_LIBRARY_PATH"]
132 os.environ["RND_SEED"] = env["RND_SEED"]
133 os.environ["VENV_PATH"] = env["VENV_PATH"]
134 os.environ["TAG"] = env["TAG"]
135 os.environ["VPP_WORKER_COUNT"] = env["VPP_WORKER_COUNT"]
136 os.environ["FAILED_DIR"] = env["FAILED_DIR"]
137 os.environ["SKIP_FILTER"] = env["SKIP_FILTER"]
138 if not run_vpp_in_vm_sh.is_file():
139 print(f"Error: script {base_dir}/scripts/run_vpp_in_vm.sh not found.")
140 sys.exit(1)
141 p = Popen(
142 [run_vpp_in_vm_sh, test_name, kernel_image, test_data_dir, cpu_mask, mem],
143 stdout=PIPE,
144 cwd=ws_root,
145 )
146 # Show only the test result without clobbering the stdout.
147 # The VM console displays VPP stderr & Linux IPv6 netdev change
148 # messages, which is logged by default and can be excluded.
149 exclude_pattern = r"vpp\[\d+\]:|ADDRCONF\(NETDEV_CHANGE\):"
150 show_progress(p.stdout, exclude_pattern)
151 post_vm_test_run()
152
153
154def post_vm_test_run():

Callers 1

run.pyFile · 0.85

Calls 3

printFunction · 0.85
show_progressFunction · 0.85
post_vm_test_runFunction · 0.85

Tested by

no test coverage detected