I would like to add a new automated step to the Mu2e software validation suite. I would like to load a gdml file using root and programatically verify that it loads without error. I can do this but only by parsing printed output. I would like to know if there is a way to do this by asking the TGeoManager object for status information. Any advice?
Here is the macro I am now using:
void gdmlCheck( char const* gdmlFilename ){
TGeoManager* geom = TGeoManager::Import(gdmlFilename);
unsigned status{0.}; // I would like to add a status check here.
exit(status);
}
It can be invoked with:
root -l gdmlCheck.C\(\"mu2e_good.gdml\"\) 2> good_err.log 1> good_out.log
root -l gdmlCheck.C\(\"mu2e_bad.gdml\"\) 2> bad_err.log 1> bad_out.log
The signature of an error is the caseblind string “error” in the x_err.log file or more than 2 lines in the x_out.log. That feels fragile and, over time, likely to produce both false positives and false negatives. Does anyone see a better way? Ideally I would like to ask the TGeoManager object about the status of the import and return an exit code that reflects the status.
Thanks,
Rob
ROOT Version: 6.22.08
Platform: SL7
Compiler: g++ 9.3.0