summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/Makefile19
-rw-r--r--test/run_tests.py8
2 files changed, 25 insertions, 2 deletions
diff --git a/test/Makefile b/test/Makefile
index 4e2863c6c82..939f88b2f89 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -25,6 +25,19 @@ else
FORCE_FOREGROUND=0
endif
+ifdef PROFILE_OUTPUT
+PROFILE_OUTPUT_OPTS=-o $(PROFILE_OUTPUT)
+endif
+
+ifndef PROFILE_SORT_BY
+PROFILE_SORT_BY=cumtime
+endif
+
+ifeq ($(PROFILE),1)
+PYTHON_PROFILE_OPTS=-m cProfile $(PROFILE_OUTPUT_OPTS) -s $(PROFILE_SORT_BY)
+FORCE_FOREGROUND=1
+endif
+
verify-no-running-vpp:
@if [ "$(VPP_PIDS)" != "" ]; then \
echo; \
@@ -95,7 +108,7 @@ $(PAPI_INSTALL_DONE): $(PIP_PATCH_DONE)
@touch $@
define retest-func
-@env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(PYTHON_VENV_PATH)/bin/activate python run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS) || env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) COMPRESS_FAILED_TEST_LOGS=$(COMPRESS_FAILED_TEST_LOGS) scripts/compress_failed.sh
+env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(PYTHON_VENV_PATH)/bin/activate python $(PYTHON_PROFILE_OPTS) run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS) || env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) COMPRESS_FAILED_TEST_LOGS=$(COMPRESS_FAILED_TEST_LOGS) scripts/compress_failed.sh
endef
.PHONY: sanity
@@ -252,6 +265,10 @@ help:
@echo " EXTERN_PLUGINS=<path>- path to out-of-tree plugins to be loaded by vpp under test"
@echo " EXTERN_COV_DIR=<path>- path to out-of-tree prefix, where source, object and .gcda files can be found for coverage report"
@echo ""
+ @echo " PROFILE=1 - enable profiling of test framework via cProfile module"
+ @echo " PROFILE_SORT_BY=opt - sort profiling report by opt - consult cProfile documentation for possible values (default: cumtime)"
+ @echo " PROFILE_OUTPUT=file - output profiling info to file - use absolute path (default: stdout)"
+ @echo ""
@echo " TEST_DEBUG=1 - turn on debugging of the test framework itself (expert)"
@echo ""
@echo "Creating test documentation"
diff --git a/test/run_tests.py b/test/run_tests.py
index c21acab2da5..02e4738184d 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -199,10 +199,16 @@ if __name__ == '__main__':
retries = int(os.getenv("RETRIES", 0))
except ValueError:
retries = 0
+
+ try:
+ force_foreground = int(os.getenv("FORCE_FOREGROUND", 0))
+ except ValueError:
+ force_foreground = 0
attempts = retries + 1
if attempts > 1:
print("Perform %s attempts to pass the suite..." % attempts)
- if (debug is not None and debug.lower() in ["gdb", "gdbserver"]) or step:
+ if (debug is not None and debug.lower() in ["gdb", "gdbserver"]) or step\
+ or force_foreground:
# don't fork if requiring interactive terminal..
sys.exit(not VppTestRunner(
verbosity=verbose, failfast=failfast).run(suite).wasSuccessful())
n23' href='#n23'>23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222