From 863d73d34baf171d73bee6f29482a6e5f177a8fd Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Mon, 2 Mar 2020 07:46:25 -0500 Subject: [PATCH] test: limit files scanned when searching for test completions When gathering test completions original grep went over all files in repository recursively. In some cases it took way longer than required. This patch limits searches only to rootdir and test directories. References #1068 Signed-off-by: Tomasz Zawadzki Change-Id: Ice0bba25f2fad62516226a7b045d12b6614bead5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1089 Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker --- test/common/autotest_common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 0d37e957f..dcb71276b 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -373,8 +373,11 @@ function timing_finish() { } function create_test_list() { - grep -rshI --include="*.sh" --exclude="autotest_common.sh" \ - -e "run_test " $rootdir | grep -v "#" \ + # First search all scripts in main SPDK directory. + completion=$(grep -shI -d skip --include="*.sh" -e "run_test " $rootdir/*) + # Follow up with search in test directory recursively. + completion+=$(grep -rshI --include="*.sh" --exclude="autotest_common.sh" -e "run_test " $rootdir/test) + printf "%s" "$completion" | grep -v "#" \ | sed 's/^.*run_test/run_test/' | awk '{print $2}' | \ sed 's/\"//g' | sort > $output_dir/all_tests.txt || true }