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 <yunus.saima.234@gmail.com>
Change-Id: Id2beecbb99f24ce13ed118a1869c5adbef247e50
This commit is contained in:
Saima Yunus
2022-08-10 03:25:31 -04:00
committed by Dave Wallace
parent 5c9f9968de
commit c7f93b321d
6 changed files with 9 additions and 11 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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):

View File

@ -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}"

View File

@ -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

View File

@ -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 = []

View File

@ -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