From f5238d8ea3ac2a073412cf215eeae6cc7b0a3c01 Mon Sep 17 00:00:00 2001 From: Juraj Smiesko <34742917+kjvbrt@users.noreply.github.com> Date: Tue, 15 Aug 2023 13:51:34 +0200 Subject: [PATCH] Allow help without config file (#135) --- k4FWCore/scripts/k4run | 10 +++++----- test/k4FWCoreTest/CMakeLists.txt | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/k4FWCore/scripts/k4run b/k4FWCore/scripts/k4run index 76b3d038..92802c74 100755 --- a/k4FWCore/scripts/k4run +++ b/k4FWCore/scripts/k4run @@ -122,11 +122,6 @@ if __name__ == "__main__": print(" %s (from %s)" % (item, cfgDb[item]["lib"])) sys.exit() - if len(opts[0].config_files) == 0: - print('Error: missing gaudi options file.\n' - 'Usage: k4run , use --help to get a complete list of arguments') - sys.exit(1) - for file in opts[0].config_files: load_file(file) @@ -139,6 +134,11 @@ if __name__ == "__main__": opts = parser.parse_args() + if len(opts.config_files) == 0: + print('Error: missing gaudi options file.\n' + 'Usage: k4run , use --help to get a complete list of arguments') + sys.exit(1) + # print a doc line showing the configured algorithms logger.info(' '.join(f'--> {alg.name()}' for alg in ApplicationMgr().TopAlg)) diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index e4491fbf..50053eca 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -151,3 +151,10 @@ add_test(NAME Testk4runVerboseOutput set_test_env(Testk4runVerboseOutput) set_tests_properties(Testk4runVerboseOutput PROPERTIES PASS_REGULAR_EXPRESSION " VERBOSE ") + +add_test(NAME Testk4runHelpOnly + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + COMMAND ${K4RUN} --help) +set_test_env(Testk4runHelpOnly) +set_tests_properties(Testk4runHelpOnly + PROPERTIES PASS_REGULAR_EXPRESSION "show this help message and exit")