diff --git a/dunedataprep/DataPrep/Service/test/test_DuneDeconvolutionService.cxx b/dunedataprep/DataPrep/Service/test/test_DuneDeconvolutionService.cxx index 8a9f73d4..6fba98d6 100644 --- a/dunedataprep/DataPrep/Service/test/test_DuneDeconvolutionService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_DuneDeconvolutionService.cxx @@ -5,8 +5,11 @@ // // Test DuneDeconvolutionService. // -// This test crashes in cleanup until this problem is resolved: -// https://cdcvs.fnal.gov/redmine/issues/10618 +// This test previously crashed during cleanup (larsoft issue +// https://cdcvs.fnal.gov/redmine/issues/10618) because the art services +// were destroyed at program exit, after the ROOT/Cling interpreter they +// rely on had already been torn down. It now tears the services down +// explicitly (ArtServiceHelper::unload_services()) before main returns. #include #include @@ -120,6 +123,10 @@ int main(int argc, char* argv[]) { ssarg >> a_LogLevel; } int rstat = test_DuneDeconvolutionService(a_LogLevel); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash (larsoft issue 10618). + ArtServiceHelper::unload_services(); cout << myname << "Exiting." << endl; return rstat; } diff --git a/dunedataprep/DataPrep/Service/test/test_DuneRoiBuildingService.cxx b/dunedataprep/DataPrep/Service/test/test_DuneRoiBuildingService.cxx index 6c2302df..151dd392 100644 --- a/dunedataprep/DataPrep/Service/test/test_DuneRoiBuildingService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_DuneRoiBuildingService.cxx @@ -136,7 +136,12 @@ int main(int argc, char* argv[]) { istringstream ssarg(argv[1]); ssarg >> a_LogLevel; } - return test_DuneRoiBuildingService(a_LogLevel); + int rstat = test_DuneRoiBuildingService(a_LogLevel); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Service/test/test_KeepAllRoiBuildingService.cxx b/dunedataprep/DataPrep/Service/test/test_KeepAllRoiBuildingService.cxx index 8a9911fc..c1bafc49 100644 --- a/dunedataprep/DataPrep/Service/test/test_KeepAllRoiBuildingService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_KeepAllRoiBuildingService.cxx @@ -132,7 +132,12 @@ int main(int argc, char* argv[]) { } cout << " LogLevel: " << a_LogLevel << endl; cout << " explicitFcl: " << explicitFcl << endl; - return test_KeepAllRoiBuildingService(a_LogLevel, explicitFcl); + int rstat = test_KeepAllRoiBuildingService(a_LogLevel, explicitFcl); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Service/test/test_StandardAdcWireBuildingService.cxx b/dunedataprep/DataPrep/Service/test/test_StandardAdcWireBuildingService.cxx index 6c812dcf..0baf85eb 100644 --- a/dunedataprep/DataPrep/Service/test/test_StandardAdcWireBuildingService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_StandardAdcWireBuildingService.cxx @@ -194,7 +194,12 @@ int main(int argc, char* argv[]) { istringstream ssarg(argv[1]); ssarg >> a_LogLevel; } - return test_StandardAdcWireBuildingService(a_LogLevel); + int rstat = test_StandardAdcWireBuildingService(a_LogLevel); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Service/test/test_StandardRawDigitPrepService.cxx b/dunedataprep/DataPrep/Service/test/test_StandardRawDigitPrepService.cxx index 25bd4a45..805ad0e6 100644 --- a/dunedataprep/DataPrep/Service/test/test_StandardRawDigitPrepService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_StandardRawDigitPrepService.cxx @@ -395,7 +395,12 @@ int main(int argc, char* argv[]) { string sarg(argv[2]); useFclFile = sarg == "true" || sarg == "1"; } - return test_StandardRawDigitPrepService(useExistingFcl, useFclFile); + int rstat = test_StandardRawDigitPrepService(useExistingFcl, useFclFile); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Service/test/test_ToolBasedRawDigitPrepService.cxx b/dunedataprep/DataPrep/Service/test/test_ToolBasedRawDigitPrepService.cxx index e9f89350..9c772668 100644 --- a/dunedataprep/DataPrep/Service/test/test_ToolBasedRawDigitPrepService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_ToolBasedRawDigitPrepService.cxx @@ -328,7 +328,12 @@ int main(int argc, char* argv[]) { useExistingFcl = sarg == "true" || sarg == "1"; } TH1::AddDirectory(false); - return test_ToolBasedRawDigitPrepService(useExistingFcl); + int rstat = test_ToolBasedRawDigitPrepService(useExistingFcl); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Service/test/test_TpcToolBasedRawDigitPrepService.cxx b/dunedataprep/DataPrep/Service/test/test_TpcToolBasedRawDigitPrepService.cxx index 8dc2fc6a..6b5ed4bd 100644 --- a/dunedataprep/DataPrep/Service/test/test_TpcToolBasedRawDigitPrepService.cxx +++ b/dunedataprep/DataPrep/Service/test/test_TpcToolBasedRawDigitPrepService.cxx @@ -329,7 +329,12 @@ int main(int argc, char* argv[]) { useExistingFcl = sarg == "true" || sarg == "1"; } TH1::AddDirectory(false); - return test_TpcToolBasedRawDigitPrepService(useExistingFcl); + int rstat = test_TpcToolBasedRawDigitPrepService(useExistingFcl); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Tool/test/test_AcdWireReader.cxx b/dunedataprep/DataPrep/Tool/test/test_AcdWireReader.cxx index 64a4beda..45cad27f 100644 --- a/dunedataprep/DataPrep/Tool/test/test_AcdWireReader.cxx +++ b/dunedataprep/DataPrep/Tool/test/test_AcdWireReader.cxx @@ -165,7 +165,12 @@ int main(int argc, char* argv[]) { } useExistingFcl = sarg == "true" || sarg == "1"; } - return test_AcdWireReader(useExistingFcl); + int rstat = test_AcdWireReader(useExistingFcl); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //********************************************************************** diff --git a/dunedataprep/DataPrep/Tool/test/test_VintageDeconvoluter.cxx b/dunedataprep/DataPrep/Tool/test/test_VintageDeconvoluter.cxx index b4402b66..a3a5e39a 100644 --- a/dunedataprep/DataPrep/Tool/test/test_VintageDeconvoluter.cxx +++ b/dunedataprep/DataPrep/Tool/test/test_VintageDeconvoluter.cxx @@ -114,7 +114,12 @@ int main(int argc, char* argv[]) { } useExistingFcl = sarg == "true" || sarg == "1"; } - return test_VintageDeconvoluter(useExistingFcl); + int rstat = test_VintageDeconvoluter(useExistingFcl); + // Destroy the art services while ROOT/Cling is still alive; otherwise + // they are destroyed at program exit when the interpreter state they + // rely on may already be gone, causing a crash. + ArtServiceHelper::unload_services(); + return rstat; } //**********************************************************************