[PATCH 7/9] patman: hide the 'test' action unless test data is available

Maxim Cournoyer maxim.cournoyer at gmail.com
Mon Dec 19 02:59:20 CET 2022


Some tests would fail when the test data is not available, so it
doesn't make much sense to expose the action when patman is running
outside of the u-boot git checkout.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer at savoirfairelinux.com>
---

 tools/patman/__main__.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py
index 5a7756a221..82cef4fc0b 100755
--- a/tools/patman/__main__.py
+++ b/tools/patman/__main__.py
@@ -21,6 +21,7 @@ if __name__ == "__main__":
 # Our modules
 from patman import command
 from patman import control
+from patman import func_test
 from patman import gitutil
 from patman import project
 from patman import settings
@@ -96,9 +97,11 @@ send.add_argument('--smtp-server', type=str,
 
 send.add_argument('patchfiles', nargs='*')
 
-test_parser = subparsers.add_parser('test', help='Run tests')
-test_parser.add_argument('testname', type=str, default=None, nargs='?',
-                         help="Specify the test to run")
+# Only add the 'test' action if the test data files are available.
+if os.path.exists(func_test.TEST_DATA_DIR):
+    test_parser = subparsers.add_parser('test', help='Run tests')
+    test_parser.add_argument('testname', type=str, default=None, nargs='?',
+                             help="Specify the test to run")
 
 status = subparsers.add_parser('status',
                                help='Check status of patches in patchwork')
-- 
2.38.1



More information about the U-Boot mailing list