[PATCH v2 10/24] buildman: Hide the test options unless test code is available

Simon Glass sjg at chromium.org
Fri Feb 24 02:18:10 CET 2023


It doesn't make much sense to expose tests when buildman is running
outside of the U-Boot git checkout. Hide the option in this case

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Add a patch to hide the test options unless test code is available

 tools/buildman/cmdline.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index c485994e9fe..e22aaf6c7bc 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -3,6 +3,11 @@
 #
 
 from optparse import OptionParser
+import os
+import pathlib
+
+BUILDMAN_DIR = pathlib.Path(__file__).parent
+HAS_TESTS = os.path.exists(BUILDMAN_DIR / "test.py")
 
 def ParseArgs():
     """Parse command line arguments from sys.argv[]
@@ -101,12 +106,13 @@ def ParseArgs():
           default=False, help='Show a build summary')
     parser.add_option('-S', '--show-sizes', action='store_true',
           default=False, help='Show image size variation in summary')
-    parser.add_option('--skip-net-tests', action='store_true', default=False,
-                      help='Skip tests which need the network')
     parser.add_option('--step', type='int',
           default=1, help='Only build every n commits (0=just first and last)')
-    parser.add_option('-t', '--test', action='store_true', dest='test',
-                      default=False, help='run tests')
+    if HAS_TESTS:
+        parser.add_option('--skip-net-tests', action='store_true', default=False,
+                          help='Skip tests which need the network')
+        parser.add_option('-t', '--test', action='store_true', dest='test',
+                          default=False, help='run tests')
     parser.add_option('-T', '--threads', type='int',
           default=None,
           help='Number of builder threads to use (0=single-thread)')
-- 
2.39.2.637.g21b0678d19-goog



More information about the U-Boot mailing list