diff --git a/k4FWCore/scripts/k4run b/k4FWCore/scripts/k4run index 30d8c713..f9c724ec 100755 --- a/k4FWCore/scripts/k4run +++ b/k4FWCore/scripts/k4run @@ -86,6 +86,10 @@ def add_arguments(parser, app_mgr): if proptype is list: if value: proptype = type(value[0]) + # If the list is empty, we can't determine the type + # Assume it's a string by default and hope it will work + else: + proptype = str args = "+" # add the argument twice, once as "--PodioOutput.filename" diff --git a/test/k4FWCoreTest/CMakeLists.txt b/test/k4FWCoreTest/CMakeLists.txt index 2dde36d9..43c91f78 100644 --- a/test/k4FWCoreTest/CMakeLists.txt +++ b/test/k4FWCoreTest/CMakeLists.txt @@ -174,6 +174,8 @@ add_test_with_env(FunctionalNonExistingFileOverwritten options/ExampleFunctional add_test_with_env(FunctionalFileTooLong options/ExampleFunctionalFile.py -n 999 --IOSvc.Output toolong.root PROPERTIES PASS_REGULAR_EXPRESSION "Application Manager Terminated successfully with a user requested ScheduledStop") add_test_with_env(FunctionalFileTooShort options/ExampleFunctionalFile.py -n 2 --IOSvc.Output two_events.root ADD_TO_CHECK_FILES) +add_test_with_env(FunctionalFileCLI options/ExampleFunctionalNoFile.py --IOSvc.Input functional_producer.root --IOSvc.Output functional_transformer_cli.root ADD_TO_CHECK_FILES) +set_tests_properties(FunctionalFileCLI PROPERTIES DEPENDS FunctionalProducer) add_test_with_env(FunctionalWrongImport options/ExampleFunctionalWrongImport.py) set_tests_properties(FunctionalWrongImport PROPERTIES PASS_REGULAR_EXPRESSION "ImportError: Importing ApplicationMgr or IOSvc from Configurables is not allowed.") diff --git a/test/k4FWCoreTest/options/ExampleFunctionalNoFile.py b/test/k4FWCoreTest/options/ExampleFunctionalNoFile.py new file mode 100644 index 00000000..4225b849 --- /dev/null +++ b/test/k4FWCoreTest/options/ExampleFunctionalNoFile.py @@ -0,0 +1,40 @@ +# +# Copyright (c) 2014-2024 Key4hep-Project. +# +# This file is part of Key4hep. +# See https://key4hep.github.io/key4hep-doc/ for further info. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This is an example reading from a file and using a transformer to create new +# data + +from Gaudi.Configuration import INFO +from Configurables import ExampleFunctionalTransformer +from Configurables import EventDataSvc +from k4FWCore import ApplicationMgr, IOSvc + +svc = IOSvc("IOSvc") + +transformer = ExampleFunctionalTransformer( + "Transformer", InputCollection=["MCParticles"], OutputCollection=["NewMCParticles"] +) + +mgr = ApplicationMgr( + TopAlg=[transformer], + EvtSel="NONE", + EvtMax=-1, + ExtSvc=[EventDataSvc("EventDataSvc")], + OutputLevel=INFO, +) diff --git a/test/k4FWCoreTest/scripts/CheckOutputFiles.py b/test/k4FWCoreTest/scripts/CheckOutputFiles.py index 3188126a..7f152608 100644 --- a/test/k4FWCoreTest/scripts/CheckOutputFiles.py +++ b/test/k4FWCoreTest/scripts/CheckOutputFiles.py @@ -70,6 +70,7 @@ def check_metadata(filename, expected_metadata): check_collections("functional_transformer.root", ["MCParticles", "NewMCParticles"]) +check_collections("functional_transformer_cli.root", ["MCParticles", "NewMCParticles"]) check_collections( "functional_transformer_multiple.root", [