Skip to content

Commit

Permalink
Allow help without config file (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt authored Aug 15, 2023
1 parent 97ead95 commit f5238d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions k4FWCore/scripts/k4run
Original file line number Diff line number Diff line change
Expand Up @@ -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 <options_file.py>, use --help to get a complete list of arguments')
sys.exit(1)

for file in opts[0].config_files:
load_file(file)

Expand All @@ -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 <options_file.py>, 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))

Expand Down
7 changes: 7 additions & 0 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit f5238d8

Please sign in to comment.