Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash without arguments #110

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions k4FWCore/scripts/k4run
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ option_db = {}

class LoadFromFile(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
if not values:
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 wrapper in values:
if wrapper.name in seen_files:
return
Expand Down
7 changes: 7 additions & 0 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ add_test(NAME TestUniqueIDGenSvc
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${K4RUN} options/TestUniqueIDGenSvc.py)
set_test_env(TestUniqueIDGenSvc)

add_test(NAME Testk4runNoArguments
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
COMMAND ${K4RUN})
set_test_env(Testk4runNoArguments)
tmadlener marked this conversation as resolved.
Show resolved Hide resolved
set_tests_properties(Testk4runNoArguments
PROPERTIES PASS_REGULAR_EXPRESSION "Usage: k4run <options_file.py>, use --help to get a complete list of arguments")