Skip to content

Commit

Permalink
Add a new check to make sure -n works
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Oct 1, 2024
1 parent e1fdfcb commit 87bd5b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions test/k4FWCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ add_test_with_env(FunctionalMetadataReadOldAlgorithm options/ExampleFunctionalMe
add_test_with_env(FunctionalNonExistingFile options/ExampleFunctionalNonExistingFile.py)
set_tests_properties(FunctionalNonExistingFile PROPERTIES PASS_REGULAR_EXPRESSION "File.*couldn't be found")
add_test_with_env(FunctionalNonExistingFileOverwritten options/ExampleFunctionalNonExistingFile.py --IOSvc.Input functional_producer.root)
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(FunctionalWrongImport options/ExampleFunctionalWrongImport.py)
set_tests_properties(FunctionalWrongImport PROPERTIES PASS_REGULAR_EXPRESSION "ImportError: Importing ApplicationMgr or IOSvc from Configurables is not allowed.")
add_test_with_env(FunctionalReadNthEvent options/ExampleFunctionalReadNthEvent.py ADD_TO_CHECK_FILES)

# Do this after checking the files not to overwrite them
add_test_with_env(FunctionalFile_toolong options/ExampleFunctionalFile.py -n 999 PROPERTIES DEPENDS FunctionalCheckFiles PASS_REGULAR_EXPRESSION
"Application Manager Terminated successfully with a user requested ScheduledStop")

# The following is done to make the tests work without installing the files in
# the installation directory. The k4FWCore in the build directory is populated by
Expand Down
15 changes: 6 additions & 9 deletions test/k4FWCoreTest/scripts/CheckOutputFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ def check_metadata(filename, expected_metadata):
if len(ev.get("NewMCParticles")) != 4:
raise RuntimeError(f"Expected 4 NewMCParticles but got {len(ev.get('NewMCParticles'))}")

check_events(
"functional_filter.root",
5,
)

check_collections("functional_metadata.root", ["MCParticles"])

check_metadata(
Expand Down Expand Up @@ -229,7 +224,9 @@ def check_metadata(filename, expected_metadata):
raise RuntimeError(f"Event number {event_number} is duplicated")
seen_event_numbers.add(event_number)

check_events(
"functional_nth_event.root",
3,
)
for name, events in {
"functional_filter.root": 5,
"functional_nth_event.root": 3,
"two_events.root": 2,
}.items():
check_events(name, events)

0 comments on commit 87bd5b1

Please sign in to comment.