diff --git a/test/regression/cocotb/cocotb-config b/test/regression/cocotb/cocotb-config new file mode 100755 index 000000000..a0c674f1c --- /dev/null +++ b/test/regression/cocotb/cocotb-config @@ -0,0 +1,22 @@ +#!/bin/bash + +COCOTB_CONFIG=`which -a cocotb-config | tail -n 1` + +if [ ! -f "cocotb-config.cache" ]; then + $COCOTB_CONFIG --python-bin >> cocotb-config.cache + $COCOTB_CONFIG --prefix >> cocotb-config.cache + $COCOTB_CONFIG --makefiles >> cocotb-config.cache + $COCOTB_CONFIG --lib-dir >> cocotb-config.cache + $COCOTB_CONFIG --libpython >> cocotb-config.cache +fi + +case $1 in + "--python-bin") N=1 ;; + "--prefix") N=2 ;; + "--makefiles") N=3 ;; + "--lib-dir") N=4 ;; + "--libpython") N=5 ;; +esac + +sed "${N}q;d" cocotb-config.cache + diff --git a/test/regression/test_regression.py b/test/regression/test_regression.py index 88fc538f1..b28329ec5 100644 --- a/test/regression/test_regression.py +++ b/test/regression/test_regression.py @@ -73,7 +73,10 @@ def regression_body_with_cocotb(test_name: str, traces: bool): if traces: arglist += ["TRACES=1"] - res = subprocess.run(arglist) + my_env = dict(os.environ) + my_env["PATH"] = os.path.join(os.getcwd(), "test/regression/cocotb") + ":" + my_env["PATH"] + + res = subprocess.run(arglist, env=my_env) assert res.returncode == 0