Skip to content
Snippets Groups Projects
Commit 1b116260 authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Make sure OutputStream instances are configured with and explicit OutputFile

parent b945597f
No related branches found
No related tags found
1 merge request!1467Make sure OutputStream instances are configured with and explicit Output option
Pipeline #5746955 passed
...@@ -54,6 +54,11 @@ StatusCode OutputStream::initialize() { ...@@ -54,6 +54,11 @@ StatusCode OutputStream::initialize() {
auto status = Algorithm::initialize(); auto status = Algorithm::initialize();
if ( status.isFailure() ) return status; if ( status.isFailure() ) return status;
if ( m_output.empty() ) {
fatal() << "property Output not set. OutputStream instances require an output" << endmsg;
return StatusCode::FAILURE;
}
// Reset the number of events written // Reset the number of events written
m_events = 0; m_events = 0;
// Get access to the DataManagerSvc // Get access to the DataManagerSvc
......
#####################################################################################
# (c) Copyright 2023 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
#####################################################################################
import os
import sys
from GaudiTests import run_gaudi
def config():
"""
Configure a job writing to an empty file.
"""
from Configurables import GaudiPersistency
from GaudiConfig2 import Configurables as C
GaudiPersistency()
out = C.OutputStream(
ItemList=["/Event#999"],
)
app = C.ApplicationMgr(EvtMax=1, OutStream=[out.__opt_value__()])
return [app, out]
def test(tmp_path):
"""
Check that an output file is created even if no event is written to it.
"""
os.chdir(tmp_path)
result = run_gaudi(
f"{__file__}:config", capture_output=True, errors="surrogateescape"
)
print(result.stdout, end="")
print(result.stderr, end="", file=sys.stderr)
assert result.returncode == 1
assert "OutputStream instances require an output" in result.stdout
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment