Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40136 )

Change subject: ext: testlib loading tests from multiple directories
......................................................................

ext: testlib loading tests from multiple directories

We currently run regressions with the following command line

./main.py run [...] <directory>

Where <directory> is the positional argument pointing to the tests root
directory: Testlib will walk through the directory and load every
testsuite it encounters in its path.

./main.py run [...] <directory1> <directory2> ...

Allowing testlib to load tests from multiple directories will make it
possible to load out of tree regressions (living in an EXTRAS repository
for example)

JIRA: https://gem5.atlassian.net/browse/GEM5-905

Change-Id: I802d8753a18f4dfb00347252f031b5438e9be672
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40136
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M TESTING.md
M ext/testlib/configuration.py
M ext/testlib/main.py
3 files changed, 27 insertions(+), 9 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/TESTING.md b/TESTING.md
index 17aeff9..88d1f29 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -63,6 +63,20 @@
 The above is the *minumum* you should run before posting a patch to
 https://gem5-review.googlesource.com

+## Running tests from multiple directories
+
+The command line above will walk the directory tree starting from the cwd
+(tests), and it will run every test it encounters in its path. It is possible
+to specify multiple root directories by providing several positional
+arguments:
+
+```shell
+./main.py run <directory1> <directory2> [...]
+```
+
+This will load every test in directory1 and directory2 (and their
+subdirectories).
+
 ## Specifying a subset of tests to run

You can use the tag query interface to specify the exact tests you want to run.
diff --git a/ext/testlib/configuration.py b/ext/testlib/configuration.py
index f2d93d6..1fffab4 100644
--- a/ext/testlib/configuration.py
+++ b/ext/testlib/configuration.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 ARM Limited
+# Copyright (c) 2020-2021 ARM Limited
 # All rights reserved
 #
 # The license below extends only to copyright in the software and shall
@@ -493,10 +493,11 @@
     # A list of common arguments/flags used across cli parsers.
     common_args = [
         Argument(
-            'directory',
-            nargs='?',
-            default=os.getcwd(),
-            help='Directory to start searching for tests in'),
+            'directories',
+            nargs='*',
+            default=[os.getcwd()],
+            help='Space separated list of directories to start searching '
+                 'for tests in'),
         Argument(
             '--exclude-tags',
             action=StorePositionalTagsAction,
@@ -646,7 +647,7 @@

         common_args.uid.add_to(parser)
         common_args.skip_build.add_to(parser)
-        common_args.directory.add_to(parser)
+        common_args.directories.add_to(parser)
         common_args.build_dir.add_to(parser)
         common_args.base_dir.add_to(parser)
         common_args.bin_path.add_to(parser)
@@ -703,7 +704,7 @@
             help='Quiet output (machine readable).'
         ).add_to(parser)

-        common_args.directory.add_to(parser)
+        common_args.directories.add_to(parser)
         common_args.bin_path.add_to(parser)
         common_args.isa.add_to(parser)
         common_args.variant.add_to(parser)
@@ -722,7 +723,7 @@
         super(RerunParser, self).__init__(parser)

         common_args.skip_build.add_to(parser)
-        common_args.directory.add_to(parser)
+        common_args.directories.add_to(parser)
         common_args.build_dir.add_to(parser)
         common_args.base_dir.add_to(parser)
         common_args.bin_path.add_to(parser)
diff --git a/ext/testlib/main.py b/ext/testlib/main.py
index d2ae5a9..6087a8e 100644
--- a/ext/testlib/main.py
+++ b/ext/testlib/main.py
@@ -205,7 +205,10 @@
     testloader = loader_mod.Loader()
     log.test_log.message(terminal.separator())
     log.test_log.message('Loading Tests', bold=True)
-    testloader.load_root(configuration.config.directory)
+
+    for root in configuration.config.directories:
+        testloader.load_root(root)
+
     return testloader

 def do_list():

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40136
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I802d8753a18f4dfb00347252f031b5438e9be672
Gerrit-Change-Number: 40136
Gerrit-PatchSet: 2
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to