aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-12-19 17:32:43 -0500
committerSimon Glass <sjg@chromium.org>2023-01-05 19:21:57 -0700
commit52c1c333eaade606be03a6087a348f8f37843f62 (patch)
tree30ef77e5ff39bc4248842e61410225fda7e15130
parenta3997a0a00a03a85fd0ad4ca147763f17ba88b5b (diff)
downloadu-boot-52c1c333eaade606be03a6087a348f8f37843f62.zip
u-boot-52c1c333eaade606be03a6087a348f8f37843f62.tar.gz
u-boot-52c1c333eaade606be03a6087a348f8f37843f62.tar.bz2
patman: hide the 'test' command unless test data is available
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. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
-rwxr-xr-xtools/patman/__main__.py9
-rw-r--r--tools/patman/patman.rst4
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/patman/__main__.py b/tools/patman/__main__.py
index 2a2a7ea..70968f6 100755
--- a/tools/patman/__main__.py
+++ b/tools/patman/__main__.py
@@ -20,6 +20,7 @@ if __name__ == "__main__":
# Our modules
from patman import control
+from patman import func_test
from patman import gitutil
from patman import project
from patman import settings
@@ -95,9 +96,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')
diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst
index 8c5c9cc..ff4c8b3 100644
--- a/tools/patman/patman.rst
+++ b/tools/patman/patman.rst
@@ -680,6 +680,10 @@ them:
$ tools/patman/patman test
+Note that since the test suite depends on data files only available in
+the git checkout, the `test` command is hidden unless `patman` is
+invoked from the U-Boot git repository.
+
Error handling doesn't always produce friendly error messages - e.g.
putting an incorrect tag in a commit may provide a confusing message.