From c7f93b321d02c532f612587f939f8188526139ac Mon Sep 17 00:00:00 2001 From: Saima Yunus Date: Wed, 10 Aug 2022 03:25:31 -0400 Subject: tests: move "venv" to "build-root" directory from "test" directory Type: refactor - refactored VPP test code to remove "ignore_path" variable from "discover_tests" function and "run_test" code - configured VPP test makefile, config file, and 'run.sh' shell script to move "venv" directory from "test" dir to "build-root" dir Signed-off-by: Saima Yunus Change-Id: Id2beecbb99f24ce13ed118a1869c5adbef247e50 --- .gitignore | 2 +- test/Makefile | 5 +++-- test/config.py | 2 +- test/discover_tests.py | 6 ++---- test/run_tests.py | 3 +-- test/scripts/run.sh | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 4b7ed4f3277..71225df0e90 100644 --- a/.gitignore +++ b/.gitignore @@ -18,10 +18,10 @@ /build-root/rpmbuild/ /build-root/test-doc/ /build-root/test-cov/ +/build-root/test/ /test/run/ /test/build/ /test/coverage/ -/test/venv/ /test/vapi_test/ /test/doc/build/ /build-config.mk diff --git a/test/Makefile b/test/Makefile index e5c2b2d21d5..87b121ac11f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -54,7 +54,8 @@ PYTHON_OPTS="-m cProfile $(PROFILE_OUTPUT_OPTS) -s $(PROFILE_SORT_BY)" FORCE_FOREGROUND=1 endif -VENV_PATH=$(TEST_DIR)/venv +VENV_BR_DIR=$(BR)/test +VENV_PATH=$(VENV_BR_DIR)/venv ifeq ($(TEST_DEBUG),1) VENV_RUN_DIR:=$(VENV_PATH)/run-debug @@ -314,7 +315,7 @@ reset: .PHONY: wipe wipe: reset - @rm -rf $(VENV_PATH) + @rm -rf $(VENV_BR_DIR) @rm -rf $(patsubst %,%/__pycache__, $(VPP_TEST_DIRS)) $(BUILD_COV_DIR): diff --git a/test/config.py b/test/config.py index b94dbcb10d7..b8bbbbcde7c 100644 --- a/test/config.py +++ b/test/config.py @@ -395,7 +395,7 @@ config.test_src_dir = test_dirs if config.venv_dir is None: - config.venv_dir = f"{ws}/test/venv" + config.venv_dir = f"{ws}/build-root/test/venv" if config.failed_dir is None: config.failed_dir = f"{config.tmp_dir}" diff --git a/test/discover_tests.py b/test/discover_tests.py index 7f05c3184ff..0eaa149d0db 100755 --- a/test/discover_tests.py +++ b/test/discover_tests.py @@ -7,14 +7,12 @@ import importlib import argparse -def discover_tests(directory, callback, ignore_path): +def discover_tests(directory, callback): do_insert = True for _f in os.listdir(directory): f = "%s/%s" % (directory, _f) if os.path.isdir(f): - if ignore_path is not None and f.startswith(ignore_path): - continue - discover_tests(f, callback, ignore_path) + discover_tests(f, callback) continue if not os.path.isfile(f): continue diff --git a/test/run_tests.py b/test/run_tests.py index 917e0dc0057..85344ca15e2 100644 --- a/test/run_tests.py +++ b/test/run_tests.py @@ -947,11 +947,10 @@ if __name__ == "__main__": filter_cb = FilterByTestOption(filter_file, filter_class, filter_func) - ignore_path = config.venv_dir cb = SplitToSuitesCallback(filter_cb) for d in config.test_src_dir: print("Adding tests from directory tree %s" % d) - discover_tests(d, cb, ignore_path) + discover_tests(d, cb) # suites are not hashable, need to use list suites = [] diff --git a/test/scripts/run.sh b/test/scripts/run.sh index 544a536ed36..51c1c62df9d 100755 --- a/test/scripts/run.sh +++ b/test/scripts/run.sh @@ -55,7 +55,7 @@ fi if [ -z "$venv_dir" ] then - venv_dir="$ws_dir/test/venv" + venv_dir="$ws_dir/build-root/test/venv" echo "Argument --venv-path not specified, defaulting to '$venv_dir'" extra_args="$extra_args --venv-dir=$venv_dir" fi -- cgit 1.2.3-korg