30 lines
866 B
Python
30 lines
866 B
Python
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
def test_usb_configuration_management_native(tmp_path: Path) -> None:
|
|
root = Path(__file__).resolve().parents[1]
|
|
compiler = shutil.which("c++") or shutil.which("g++")
|
|
assert compiler is not None, "a host C++ compiler is required"
|
|
|
|
executable = tmp_path / "usb_configuration_management_test"
|
|
subprocess.run(
|
|
[
|
|
compiler,
|
|
"-std=c++17",
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-Werror",
|
|
"-pedantic",
|
|
f"-I{root / 'tests' / 'usb_management_native_stubs'}",
|
|
f"-I{root}",
|
|
str(root / "tests" / "usb_configuration_management_test.cpp"),
|
|
"-o",
|
|
str(executable),
|
|
],
|
|
check=True,
|
|
cwd=root,
|
|
)
|
|
subprocess.run([str(executable)], check=True, cwd=root)
|