tests: move "venv" to "build-root" directory from "test" directory 93/36893/3
authorSaima Yunus <yunus.saima.234@gmail.com>
Wed, 10 Aug 2022 07:25:31 +0000 (03:25 -0400)
committerDave Wallace <dwallacelf@gmail.com>
Tue, 16 Aug 2022 20:27:37 +0000 (20:27 +0000)
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

.gitignore
test/Makefile
test/config.py
test/discover_tests.py
test/run_tests.py
test/scripts/run.sh

index 4b7ed4f..71225df 100644 (file)
 /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
index e5c2b2d..87b121a 100644 (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):
index b94dbcb..b8bbbbc 100644 (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}"
index 7f05c31..0eaa149 100755 (executable)
@@ -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
index 917e0dc..85344ca 100644 (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 = []
index 544a536..51c1c62 100755 (executable)
@@ -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