#include <iostream>#include <sstream>#include <string>#include "TROOT.h"#include "TSystem.h"#include "MessageService/MsgService.h"Go to the source code of this file.
Classes | |
| class | Vout |
| class | Verr |
Defines | |
| #define | STRBUF_LEN 256 |
Functions | |
| void | InitValidation () |
| string | GetDataDir () |
| string | GetDataDir (string filename) |
| string | GetDataFilePath (string filename) |
| string | GetTmpDataDir () |
| string | GetTmpDataFilePath (string filename) |
| bool | WriteOutTmpDataFile (string filename) |
| Msg::LogLevel_t | GetVldnLogLevel () |
| template<class TP> | |
| Vout & | operator<< (Vout &vo, const TP &t) |
| bool | IsVerbose () |
| bool | StrStrmCmp (string validstr, stringstream &outstrstrm, string packagename, string testname, string extrainfo="") |
Variables | |
| Vout | vout |
| Verr | verr |
|
|
Definition at line 28 of file Validate.h. |
|
|
Definition at line 221 of file Validate.h. References GetDataFilePath(), and gSystem(). 00222 {
00223 string dataDir = GetDataFilePath(filename);
00224
00225 if(dataDir == "")
00226 return "";
00227
00228 return gSystem->DirName(dataDir.c_str());
00229 }
|
|
|
Definition at line 183 of file Validate.h. References GetTmpDataDir(), and gSystem(). 00184 {
00185 const char* dDataDir = gSystem->Getenv("VALIDATION_DATA");
00186 if(dDataDir == 0) {
00187 cerr << "Error: environment variable $VALIDATION_DATA not set."
00188 << endl
00189 << "(This should point to the directory where test data resides)"
00190 << endl;
00191 return "";
00192 }
00193
00194 const char* testType = gSystem->Getenv("VALIDATION_TESTTYPE");
00195 if(testType == 0) {
00196 return string(dDataDir);
00197 }
00198
00199 string tDataDir = GetTmpDataDir();
00200 if(string(testType) == "DEPENDENT" && tDataDir != "") {
00201 return tDataDir;
00202 }
00203
00204
00205 // testType == "ISOLATED" or tmp/Validation is inaccesible
00206 return string(dDataDir);
00207 }
|
|
|
Definition at line 243 of file Validate.h. References GetTmpDataDir(), and gSystem(). Referenced by GetDataDir(). 00244 {
00245 const char* dDataDir = gSystem->Getenv("VALIDATION_DATA");
00246 if(dDataDir == 0) {
00247 cerr << "Error: environment variable $VALIDATION_DATA not set."
00248 << endl
00249 << "(This should point to the directory where test data resides)"
00250 << endl;
00251 return "";
00252 }
00253
00254 const char* testType = gSystem->Getenv("VALIDATION_TESTTYPE");
00255 if(testType == 0) {
00256 return string(dDataDir) + "/" + filename;
00257 }
00258
00259 // test if doing dependent testing
00260
00261 string tmpDataDir = GetTmpDataDir();
00262 string tmpFilePath = tmpDataDir + "/" + filename;
00263 bool tmpFileExists = !gSystem->AccessPathName(tmpFilePath.c_str());
00264 // AccessFilename returns 0 if file is accessible,
00265 // and 1 otherwise.
00266 if(string(testType) == "DEPENDENT" &&
00267 tmpDataDir != "" &&
00268 tmpFileExists ) {
00269
00270 return tmpFilePath;
00271 }
00272
00273 // testType == "ISOLATED" or the tmp data file was inaccessible
00274 string dataFilePath = string(dDataDir) + "/" + filename;
00275 bool dataFileExists = !gSystem->AccessPathName(dataFilePath.c_str());
00276 // AccessFilename returns 0 if file is accessible,
00277 // and 1 otherwise.
00278 if(dataFileExists)
00279 return dataFilePath;
00280
00281 //otherwise
00282 cerr << "Warning: '" << dataFilePath << "' cannot be accessed." << endl;
00283 return "";
00284 }
|
|
|
Definition at line 297 of file Validate.h. References gSystem(). Referenced by GetDataDir(), GetDataFilePath(), GetTmpDataFilePath(), and WriteOutTmpDataFile(). 00298 {
00299 const char* dTmpDataDir = gSystem->Getenv("VALIDATION_TMP_DATA");
00300 if(dTmpDataDir != 0) {
00301 string tmpDataDir(dTmpDataDir);
00302 if(tmpDataDir != "")
00303 return tmpDataDir;
00304 }
00305
00306
00307 if(gSystem->AccessPathName("tmp/Validation")) {
00308 gSystem->MakeDirectory("tmp");
00309 gSystem->MakeDirectory("tmp/Validation");
00310 }
00311
00312 if(gSystem->AccessPathName("tmp/Validation")) {
00313 cerr << "Cannot access temporary directory for output files." << endl;
00314 return "";
00315 }
00316 return "tmp/Validation";
00317 }
|
|
|
Definition at line 327 of file Validate.h. References GetTmpDataDir(). 00328 {
00329 string tmpFilePath = GetTmpDataDir() + "/" + filename;
00330 return tmpFilePath;
00331 /*
00332 bool tmpFileExists = !gSystem->AccessPathName(tmpFilePath.c_str());
00333 // AccessFilename returns 0 if file is accessible,
00334 // and 1 otherwise.
00335 if(tmpFileExists)
00336 return tmpFilePath;
00337
00338 //otherwise
00339 const char* dDataDir = gSystem->Getenv("VALIDATION_DATA");
00340 if(dDataDir == 0) {
00341 cerr << "Error: environment variable $VALIDATION_DATA not set."
00342 << endl
00343 << "(This should point to the directory where test data resides)"
00344 << endl;
00345 return "";
00346 }
00347
00348 string dataFilePath = string(dDataDir) + "/" + filename;
00349 bool dataFileExists = !gSystem->AccessPathName(dataFilePath.c_str());
00350 // AccessFilename returns 0 if file is accessible,
00351 // and 1 otherwise.
00352 if(dataFileExists)
00353 return dataFilePath;
00354
00355 //otherwise
00356 cerr << "Warning: '" << dataFilePath << "' cannot be accessed." << endl;
00357 return "";
00358 */
00359 }
|
|
|
Definition at line 115 of file Validate.h. References gSystem(). 00115 {
00116 const char* verbosity = gSystem -> Getenv("VALIDATION_VERBOSITY");
00117 if(verbosity != 0){
00118 if(strcasecmp(verbosity, "WARNING") == 0){
00119 return Msg::kWarning;
00120 }
00121 else if(strcasecmp(verbosity, "VERBOSE") == 0){
00122 return Msg::kVerbose;
00123 }
00124 else if(strcasecmp(verbosity, "DEBUG") == 0){
00125 return Msg::kDebug;
00126 }
00127 else if(strcasecmp(verbosity, "INFO") == 0){
00128 return Msg::kInfo;
00129 }
00130 else if(strcasecmp(verbosity, "ERROR") == 0){
00131 return Msg::kError;
00132 }
00133 else if(strcasecmp(verbosity, "FATAL") == 0){
00134 return Msg::kFatal;
00135 }
00136 }
00137 return Msg::kWarning;
00138 }
|
|
|
Definition at line 148 of file Validate.h. References MsgService::GetStream(), gSystem(), MsgService::Instance(), and MsgStream::SetLogLevel(). 00149 {
00150 MsgService::Instance()->GetStream("Pkg")->SetLogLevel(Msg::kWarning);
00151 const char* verbosity = gSystem -> Getenv("VALIDATION_VERBOSITY");
00152 if(verbosity != 0){
00153 if(strcasecmp(verbosity, "WARNING") == 0){
00154 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kWarning);
00155 }
00156 else if(strcasecmp(verbosity, "VERBOSE") == 0){
00157 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kVerbose);
00158 }
00159 else if(strcasecmp(verbosity, "DEBUG") == 0){
00160 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kDebug);
00161 }
00162 else if(strcasecmp(verbosity, "INFO") == 0){
00163 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kInfo);
00164 }
00165 else if(strcasecmp(verbosity, "ERROR") == 0){
00166 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kError);
00167 }
00168 else if(strcasecmp(verbosity, "FATAL") == 0){
00169 MsgService::Instance()->GetStream("Vldn")->SetLogLevel(Msg::kFatal);
00170 }
00171 }
00172 }
|
|
|
Definition at line 93 of file Validate.h. References gSystem(). 00093 {
00094 bool verbose = false;
00095
00096 const char* verbosity = gSystem -> Getenv("VALIDATION_VERBOSITY");
00097 if(verbosity != 0){
00098 if(string(verbosity) == "VERBOSE"){
00099 verbose = true;
00100 }
00101 }
00102
00103 return verbose;
00104 }
|
|
||||||||||||||||
|
Definition at line 75 of file Validate.h. References Vout::verbose. 00075 {
00076 if(vo.verbose) {
00077 cout << t;
00078 }
00079 return vo;
00080 }
|
|
||||||||||||||||||||||||
|
Definition at line 393 of file Validate.h. References STRBUF_LEN, verr, and vout. 00396 {
00397 string outstr;
00398
00399 //WARNING! may result in an over flow!
00400 // Use ROOT array or other structure for array.
00401 char strbuf[STRBUF_LEN];
00402
00403 outstrstrm.getline(strbuf, STRBUF_LEN-1);
00404 outstr = strbuf;
00405
00406 if(outstr == validstr) {
00407 vout << " " << packagename << " (" << testname << ") ok.\n";
00408 return true;
00409 }
00410
00411 // error in test.
00412 verr << "*** " << packagename << " (" << testname << ") error\n"
00413 << "\tvalid output: " << validstr << "\n"
00414 << "\tactual output: " << outstr << "\n";
00415
00416 if(extrainfo != "")
00417 verr << "\t" << extrainfo << "\n";
00418
00419 return false;
00420 }
|
|
|
Definition at line 370 of file Validate.h. References GetTmpDataDir(), and gSystem(). 00371 {
00372 string tmpDataDir = GetTmpDataDir();
00373 if(!gSystem->AccessPathName(tmpDataDir.c_str())) {
00374 cerr << "Warning: cannot access tmp directory: " << tmpDataDir << endl;
00375 return false;
00376 }
00377
00378 if(gSystem->CopyFile(filename.c_str(),
00379 (tmpDataDir+"/"+filename).c_str(),
00380 true ) != 0 ) {
00381 cerr << "Warning: unable to write '"<< filename << "' to "
00382 << tmpDataDir << endl;
00383 return false;
00384 }
00385
00386 return true;
00387 }
|
|
|
Referenced by StrStrmCmp(). |
|
|
Referenced by DCGraph< T >::AddClosestNode(), DCGraph< T >::Complement(), and StrStrmCmp(). |
1.3.9.1