00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #include <stdio.h>
00101 #include <stdlib.h>
00102
00103 #include "Getline.h"
00104 #include "TChain.h"
00105 #include "TFile.h"
00106 #include "TFileCollection.h"
00107 #include "TFileInfo.h"
00108 #include "TH1F.h"
00109 #include "TH2F.h"
00110 #include "TList.h"
00111 #include "TMacro.h"
00112 #include "TMap.h"
00113 #include "TMath.h"
00114 #include "TNamed.h"
00115 #include "TParameter.h"
00116 #include "TProof.h"
00117 #include "TProofLog.h"
00118 #include "TProofMgr.h"
00119 #include "TQueryResult.h"
00120 #include "TStopwatch.h"
00121 #include "TString.h"
00122 #include "TSystem.h"
00123 #include "TROOT.h"
00124
00125 #include "../tutorials/proof/getProof.C"
00126
00127 static const char *urldef = "proof://localhost:40000";
00128 static TString gtutdir;
00129 static TString gsandbox;
00130 static Int_t gverbose = 1;
00131 static TString glogfile;
00132 static Int_t gpoints = 0;
00133 static Int_t totpoints = 53;
00134 static RedirectHandle_t gRH;
00135 static RedirectHandle_t gRHAdmin;
00136 static Double_t gH1Time = 0;
00137 static Double_t gSimpleTime = 0;
00138 static Int_t gH1Cnt = 0;
00139 static Int_t gSimpleCnt = 0;
00140 static TStopwatch gTimer;
00141 static Bool_t gTimedOut = kFALSE;
00142 static Bool_t gDynamicStartup = kFALSE;
00143 static Bool_t gSkipDataSetTest = kTRUE;
00144 static Bool_t gUseParallelUnzip = kFALSE;
00145 static TString gh1src("http://root.cern.ch/files/h1");
00146 static Bool_t gh1ok = kTRUE;
00147 static const char *gh1file[] = { "dstarmb.root", "dstarp1a.root", "dstarp1b.root", "dstarp2.root" };
00148
00149
00150 static TList gSelectors;
00151 static TString gH1Sel("$ROOTSYS/tutorials/tree/h1analysis.C");
00152 static TString gEventSel("$ROOTSYS/tutorials/proof/ProofEvent.C");
00153 static TString gSimpleSel("$ROOTSYS/tutorials/proof/ProofSimple.C");
00154 static TString gTestsSel("$ROOTSYS/tutorials/proof/ProofTests.C");
00155
00156 void stressProof(const char *url = "proof://localhost:40000",
00157 Int_t nwrks = -1, Int_t verbose = 1,
00158 const char *logfile = 0, Bool_t dyn = kFALSE,
00159 Bool_t skipds = kTRUE, Int_t test = -1,
00160 const char *h1pfx = 0);
00161
00162
00163 #ifndef __CINT__
00164 int main(int argc,const char *argv[])
00165 {
00166
00167
00168 if (argc > 1 && !strcmp(argv[1],"-h")) {
00169 printf(" \n");
00170 printf(" PROOF test suite\n");
00171 printf(" \n");
00172 printf(" Usage:\n");
00173 printf(" \n");
00174 printf(" $ ./stressProof [-h] [-n <wrks>] [-v[v[v]]] [-l logfile] [-dyn] [-ds] [-t testnum] [-h1 h1src] [master]\n");
00175 printf(" \n");
00176 printf(" Optional arguments:\n");
00177 printf(" -h prints this menu\n");
00178 printf(" master entry point of the cluster where to run the test\n");
00179 printf(" in the form '[user@]host.domain[:port]'; default 'localhost:40000'\n");
00180 printf(" -n wrks number of workers to be started when running on the local host;\n");
00181 printf(" default is the nuber of local cores\n");
00182 printf(" -d level verbosity level [1]\n");
00183 printf(" -l logfile file where to redirect the processing logs; must be writable;\n");
00184 printf(" default is a temporary file deleted at the end of the test\n");
00185 printf(" in case of success\n");
00186 printf(" -dyn run the test in dynamicStartup mode\n");
00187 printf(" -ds force the dataset test if skipped by default\n");
00188 printf(" -t testnum run only test 'testnum' and the tests from which it depends\n");
00189 printf(" -h1 h1src specify a location for the H1 files; use h1src=\"download\" to download\n");
00190 printf(" to a temporary location; by default the files are read directly from the\n");
00191 printf(" ROOT http server; however this may give failures if the connection is slow\n");
00192 printf(" -punzip use parallel unzipping for data-driven processing.\n");
00193 printf(" \n");
00194 gSystem->Exit(0);
00195 }
00196
00197
00198 const char *url = 0;
00199 Int_t nWrks = -1;
00200 Int_t verbose = 1;
00201 Int_t test = -1;
00202 const char *logfile = 0;
00203 const char *h1src = 0;
00204 Int_t i = 1;
00205 while (i < argc) {
00206 if (!strcmp(argv[i],"-h")) {
00207
00208 i++;
00209 } else if (!strcmp(argv[i],"-n")) {
00210 if (i+1 == argc || argv[i+1][0] == '-') {
00211 printf(" -n should be followed by the number of workers: ignoring \n");
00212 i++;
00213 } else {
00214 nWrks = atoi(argv[i+1]);
00215 i += 2;
00216 }
00217 } else if (!strcmp(argv[i],"-d")) {
00218 if (i+1 == argc || argv[i+1][0] == '-') {
00219 printf(" -d should be followed by the debug level: ignoring \n");
00220 i++;
00221 } else {
00222 verbose = atoi(argv[i+1]);
00223 i += 2;
00224 }
00225 } else if (!strcmp(argv[i],"-l")) {
00226 if (i+1 == argc || argv[i+1][0] == '-') {
00227 printf(" -l should be followed by a path: ignoring \n");
00228 i++;
00229 } else {
00230 logfile = argv[i+1];
00231 i += 2;
00232 }
00233 } else if (!strncmp(argv[i],"-v",2)) {
00234
00235 if (!strcmp(argv[i],"-v")) verbose = 1;
00236 if (!strncmp(argv[i],"-vv",3)) verbose = 2;
00237 i++;
00238 } else if (!strncmp(argv[i],"-dyn",4)) {
00239 gDynamicStartup = kTRUE;
00240 i++;
00241 } else if (!strncmp(argv[i],"-ds",3)) {
00242 gSkipDataSetTest = kFALSE;
00243 i++;
00244 } else if (!strncmp(argv[i],"-punzip",7)) {
00245 gUseParallelUnzip = kTRUE;
00246 i++;
00247 } else if (!strcmp(argv[i],"-t")) {
00248 if (i+1 == argc || argv[i+1][0] == '-') {
00249 printf(" -t should be followed by a number: ignoring \n");
00250 i++;
00251 } else {
00252 test = atoi(argv[i+1]);
00253 i += 2;
00254 }
00255 } else if (!strcmp(argv[i],"-h1")) {
00256 if (i+1 == argc || argv[i+1][0] == '-') {
00257 printf(" -h1 should be followed by a prefix: ignoring \n");
00258 i++;
00259 } else {
00260 h1src = argv[i+1];
00261 i += 2;
00262 }
00263 } else {
00264 url = argv[i];
00265 i++;
00266 }
00267 }
00268
00269 if (!url) url = urldef;
00270
00271 stressProof(url, nWrks, verbose, logfile, gDynamicStartup, gSkipDataSetTest, test, h1src);
00272
00273 gSystem->Exit(0);
00274 }
00275 #endif
00276
00277
00278 Int_t PutPoint()
00279 {
00280
00281 printf(".");
00282 return ++gpoints;
00283 }
00284
00285
00286 void PrintStressProgress(Long64_t total, Long64_t processed, Float_t, Long64_t)
00287 {
00288
00289
00290 gSystem->RedirectOutput(0, 0, &gRH);
00291
00292 char pc[2] = { '.', ':'};
00293 static int lstpc = 1;
00294
00295 int ns = 0;
00296 if (processed < total) {
00297 ns += 6;
00298 fprintf(stderr, "%c %2.0f %%", pc[(lstpc++)%2],
00299 (total ? ((100.0*processed)/total) : 100.0));
00300 }
00301 while (ns--) fprintf(stderr, "\b");
00302
00303 gSystem->RedirectOutput(glogfile, "a", &gRH);
00304 }
00305
00306
00307 void CleanupSelector(const char *selpath)
00308 {
00309
00310
00311 if (!selpath) return;
00312
00313 TString dirpath(gSystem->DirName(selpath));
00314 if (gSystem->AccessPathName(dirpath)) return;
00315 TString selname(gSystem->BaseName(selpath));
00316 selname.ReplaceAll(".C", "_C");
00317 void *dirp = gSystem->OpenDirectory(dirpath);
00318 if (!dirp) return;
00319 TString fn;
00320 const char *e = 0;
00321 while ((e = gSystem->GetDirEntry(dirp))) {
00322 if (!strncmp(e, selname.Data(), selname.Length())) {
00323
00324 fn.Form("%s/%s", dirpath.Data(), e);
00325 gSystem->Unlink(fn);
00326 }
00327 }
00328 }
00329
00330
00331 void AssertParallelUnzip()
00332 {
00333
00334
00335 if (gUseParallelUnzip) {
00336 gProof->SetParameter("PROOF_UseParallelUnzip", (Int_t)1);
00337 } else {
00338 gProof->SetParameter("PROOF_UseParallelUnzip", (Int_t)0);
00339 }
00340 }
00341
00342
00343
00344
00345 typedef Int_t (*ProofTestFun_t)(void *);
00346 class ProofTest : public TNamed {
00347 private:
00348 Int_t fSeq;
00349 ProofTestFun_t fFun;
00350 void *fArgs;
00351 TString fDeps;
00352 TString fSels;
00353 Int_t fDepFrom;
00354 Int_t fSelFrom;
00355 Bool_t fEnabled;
00356
00357 public:
00358 ProofTest(const char *n, Int_t seq, ProofTestFun_t f, void *a = 0, const char *d = "", const char *sel = "")
00359 : TNamed(n,""), fSeq(seq), fFun(f), fArgs(a),
00360 fDeps(d), fSels(sel), fDepFrom(0), fSelFrom(0), fEnabled(kTRUE) { }
00361 virtual ~ProofTest() { }
00362
00363 void Disable() { fEnabled = kFALSE; }
00364 void Enable() { fEnabled = kTRUE; }
00365 Bool_t IsEnabled() const { return fEnabled; }
00366
00367 Int_t NextDep(Bool_t reset = kFALSE);
00368 Int_t NextSel(TString &sel, Bool_t reset = kFALSE);
00369 Int_t Num() const { return fSeq; }
00370
00371 Int_t Run();
00372 };
00373
00374
00375
00376
00377 class TTimeOutTimer : public TTimer {
00378 public:
00379 TTimeOutTimer(Long_t ms);
00380 Bool_t Notify();
00381 };
00382
00383 TTimeOutTimer::TTimeOutTimer(Long_t ms)
00384 : TTimer(ms, kTRUE)
00385 {
00386
00387 gSystem->AddTimer(this);
00388 }
00389
00390 Bool_t TTimeOutTimer::Notify()
00391 {
00392
00393 gTimedOut = kTRUE;
00394 Remove();
00395 return kTRUE;
00396 }
00397
00398
00399 Int_t ProofTest::NextDep(Bool_t reset)
00400 {
00401
00402
00403
00404 if (reset) fDepFrom = 0;
00405
00406 TString tkn;
00407 if (fDeps.Tokenize(tkn, fDepFrom, ",")) {
00408 if (tkn.IsDigit()) return tkn.Atoi();
00409 }
00410
00411 return -1;
00412 }
00413
00414 Int_t ProofTest::NextSel(TString &sel, Bool_t reset)
00415 {
00416
00417
00418
00419 if (reset) fSelFrom = 0;
00420 if (fSels.Tokenize(sel, fSelFrom, ",")) {
00421 if (!sel.IsNull()) return 0;
00422 }
00423
00424 return -1;
00425 }
00426
00427
00428 Int_t ProofTest::Run()
00429 {
00430
00431
00432 gpoints = 0;
00433 printf(" Test %2d : %s ", fSeq, GetName());
00434 PutPoint();
00435 gSystem->RedirectOutput(glogfile, "a", &gRH);
00436 Int_t rc = (*fFun)(fArgs);
00437 gSystem->RedirectOutput(0, 0, &gRH);
00438 if (rc == 0) {
00439 Int_t np = totpoints - strlen(GetName()) - strlen(" OK *");
00440 while (np--) { printf("."); }
00441 printf(" OK *\n");
00442 } else if (rc == 1) {
00443 Int_t np = totpoints - strlen(GetName()) - strlen(" SKIPPED *");
00444 while (np--) { printf("."); }
00445 printf(" SKIPPED *\n");
00446 } else {
00447 Int_t np = totpoints - strlen(GetName()) - strlen(" FAILED *");
00448 while (np--) { printf("."); }
00449 printf(" FAILED *\n");
00450 gSystem->ShowOutput(&gRH);
00451 }
00452
00453 return rc;
00454 }
00455
00456
00457 Int_t PT_Open(void *);
00458 Int_t PT_GetLogs(void *);
00459 Int_t PT_Simple(void *smg = 0);
00460 Int_t PT_H1Http(void *);
00461 Int_t PT_H1FileCollection(void *);
00462 Int_t PT_H1DataSet(void *);
00463 Int_t PT_H1MultiDataSet(void *);
00464 Int_t PT_H1MultiDSetEntryList(void *);
00465 Int_t PT_DataSets(void *);
00466 Int_t PT_Packages(void *);
00467 Int_t PT_Event(void *);
00468 Int_t PT_InputData(void *);
00469 Int_t PT_H1SimpleAsync(void *arg);
00470 Int_t PT_AdminFunc(void *arg);
00471 Int_t PT_PackageArguments(void *);
00472
00473
00474 typedef struct {
00475 const char *url;
00476 Int_t nwrks;
00477 } PT_Open_Args_t;
00478
00479
00480 typedef struct {
00481 const char *fName;
00482 Int_t fType;
00483 } PT_Packetizer_t;
00484
00485 static PT_Packetizer_t gStd_Old = { "TPacketizer", 0 };
00486
00487
00488 void stressProof(const char *url, Int_t nwrks, Int_t verbose, const char *logfile,
00489 Bool_t dyn, Bool_t skipds, Int_t test, const char *h1src)
00490 {
00491 printf("******************************************************************\n");
00492 printf("* Starting P R O O F - S T R E S S suite *\n");
00493 printf("******************************************************************\n");
00494
00495
00496 gDynamicStartup = (!strcmp(url,"lite")) ? kFALSE : dyn;
00497
00498
00499 gverbose = verbose;
00500
00501
00502 TUrl uu(url), udef(urldef);
00503 Bool_t extcluster = (strcmp(uu.GetHost(), udef.GetHost()) ||
00504 (uu.GetPort() != udef.GetPort())) ? kTRUE : kFALSE;
00505 if (gDynamicStartup && gverbose > 0) {
00506
00507 if (extcluster) {
00508 printf("* WARNING: request to run a test with per-job scheduling on *\n");
00509 printf("* an external cluster: %s .\n", url);
00510 printf("* Make sure the dynamic option is set. *\n");
00511 printf("******************************************************************\n");
00512 gDynamicStartup = kFALSE;
00513 } else {
00514 printf("* Runnning in dynamic mode (per-job scheduling) *\n");
00515 printf("******************************************************************\n");
00516 }
00517 }
00518
00519
00520 if (!skipds) {
00521 gSkipDataSetTest = kFALSE;
00522 } else {
00523 gSkipDataSetTest = (!extcluster || !strcmp(url, "lite")) ? kFALSE : kTRUE;
00524 }
00525
00526
00527 Bool_t usedeflog = kTRUE;
00528 FILE *flog = 0;
00529 if (logfile && strlen(logfile) > 0) {
00530 usedeflog = kFALSE;
00531 glogfile = logfile;
00532 if (glogfile.Contains("<tmpdir>"))
00533 glogfile.ReplaceAll("<tmpdir>", gSystem->TempDirectory());
00534 if (!gSystem->AccessPathName(glogfile, kFileExists)) {
00535 if (!gSystem->AccessPathName(glogfile, kWritePermission)) {
00536 printf(" >>> Cannot write to log file %s - ignore file request\n", logfile);
00537 usedeflog = kTRUE;
00538 }
00539 } else {
00540
00541 if (!(flog = fopen(logfile, "w"))) {
00542 printf(" >>> Cannot create log file %s - ignore file request\n", logfile);
00543 usedeflog = kTRUE;
00544 }
00545 }
00546 }
00547 if (usedeflog) {
00548 glogfile = "ProofStress_";
00549 if (!(flog = gSystem->TempFileName(glogfile, gSystem->TempDirectory()))) {
00550 printf(" >>> Cannot create a temporary log file on %s - exit\n", gSystem->TempDirectory());
00551 return;
00552 }
00553 fclose(flog);
00554 if (gverbose > 0) {
00555 printf("* Log file: %s\n", glogfile.Data());
00556 printf("******************************************************************\n");
00557 }
00558 }
00559
00560 if (gSkipDataSetTest && gverbose > 0) {
00561 printf("* Test for dataset handling (#4, #8-10) skipped **\n");
00562 printf("******************************************************************\n");
00563 }
00564 if (gUseParallelUnzip && gverbose > 0) {
00565 printf("* Using parallel unzip where relevant **\n");
00566 printf("******************************************************************\n");
00567 }
00568 if (!strcmp(url,"lite") && gverbose > 0) {
00569 printf("* PROOF-Lite session (tests #15 and #16 skipped) **\n");
00570 printf("******************************************************************\n");
00571 }
00572 if (test > 0 && gverbose > 0) {
00573 if (test < 16) {
00574 printf("* Running only test %2d (and related tests) **\n", test);
00575 printf("******************************************************************\n");
00576 } else {
00577 printf("* Request for unknown test %2d : ignore **\n", test);
00578 printf("******************************************************************\n");
00579 test = -1;
00580 }
00581 }
00582 if (h1src && strlen(h1src) && gverbose > 0) {
00583 if (!strcmp(h1src, "download") && extcluster) {
00584 printf("* External clusters: ignoring download request of H1 files\n");
00585 printf("******************************************************************\n");
00586 } else if (!gh1src.BeginsWith(h1src)) {
00587 printf("* Taking H1 files from: %s\n", h1src);
00588 printf("******************************************************************\n");
00589 gh1src = h1src;
00590 gh1ok = kFALSE;
00591 }
00592 }
00593
00594
00595 gEnv->SetValue("Proof.DataSetManager","");
00596
00597
00598
00599
00600 TList *testList = new TList;
00601
00602 PT_Open_Args_t PToa = { url, nwrks };
00603 testList->Add(new ProofTest("Open a session", 1, &PT_Open, (void *)&PToa));
00604
00605 testList->Add(new ProofTest("Get session logs", 2, &PT_GetLogs, (void *)&PToa, "1"));
00606
00607 testList->Add(new ProofTest("Simple random number generation", 3, &PT_Simple, 0, "1", "ProofSimple"));
00608
00609 testList->Add(new ProofTest("Dataset handling with H1 files", 4, &PT_DataSets, 0, "1"));
00610
00611 testList->Add(new ProofTest("H1: chain processing", 5, &PT_H1Http, 0, "1", "h1analysis"));
00612
00613 testList->Add(new ProofTest("H1: file collection processing", 6, &PT_H1FileCollection, 0, "1", "h1analysis"));
00614
00615 testList->Add(new ProofTest("H1: file collection, TPacketizer", 7, &PT_H1FileCollection, (void *)&gStd_Old, "1", "h1analysis"));
00616
00617 testList->Add(new ProofTest("H1: by-name processing", 8, &PT_H1DataSet, 0, "1,4", "h1analysis"));
00618
00619 testList->Add(new ProofTest("H1: multi dataset processing", 9, &PT_H1MultiDataSet, 0, "1,4", "h1analysis"));
00620
00621 testList->Add(new ProofTest("H1: multi dataset and entry list", 10, &PT_H1MultiDSetEntryList, 0, "1,4", "h1analysis"));
00622
00623 testList->Add(new ProofTest("Package management with 'event'", 11, &PT_Packages, 0, "1"));
00624
00625 testList->Add(new ProofTest("Package argument passing", 12, &PT_PackageArguments, 0, "1", "ProofTests"));
00626
00627 testList->Add(new ProofTest("Simple 'event' generation", 13, &PT_Event, 0, "1", "ProofEvent"));
00628
00629 testList->Add(new ProofTest("Input data propagation", 14, &PT_InputData, 0, "1", "ProofTests"));
00630
00631 testList->Add(new ProofTest("H1, Simple: async mode", 15, &PT_H1SimpleAsync, 0, "1,3,5", "h1analysis,ProofSimple"));
00632
00633 testList->Add(new ProofTest("Admin functionality", 16, &PT_AdminFunc, 0, "1"));
00634
00635 Bool_t useMergers = kTRUE;
00636 testList->Add(new ProofTest("Dynamic sub-mergers functionality", 17, &PT_Simple, (void *)&useMergers, "1", "ProofSimple"));
00637
00638
00639 gSystem->ExpandPathName(gH1Sel);
00640 gSystem->ExpandPathName(gEventSel);
00641 gSystem->ExpandPathName(gSimpleSel);
00642 gSystem->ExpandPathName(gTestsSel);
00643 gSelectors.Add(new TNamed("h1analysis", gH1Sel.Data()));
00644 gSelectors.Add(new TNamed("ProofEvent", gEventSel.Data()));
00645 gSelectors.Add(new TNamed("ProofSimple", gSimpleSel.Data()));
00646 gSelectors.Add(new TNamed("ProofTests", gTestsSel.Data()));
00647 if (gverbose > 0) printf("* Cleaning all non-source files associated to:\n");
00648
00649
00650 ProofTest *t = 0, *treq = 0;
00651 TIter nxt(testList);
00652 if (test > 0) {
00653
00654 while ((t = (ProofTest *)nxt())) {
00655 t->Disable();
00656 if (t->Num() == test) treq = t;
00657 }
00658 if (!treq) {
00659 printf("* Test %2d not found among the registered tests - exiting **\n", test);
00660 printf("******************************************************************\n");
00661 return;
00662 }
00663
00664 Int_t tn = -1;
00665 while ((tn = treq->NextDep()) > 0) {
00666 nxt.Reset();
00667 while ((t = (ProofTest *)nxt())) {
00668 if (t->Num() == tn) {
00669 t->Enable();
00670 break;
00671 }
00672 }
00673 }
00674
00675 TString sel;
00676 while ((treq->NextSel(sel)) == 0) {
00677 TNamed *nm = (TNamed *) gSelectors.FindObject(sel.Data());
00678 if (nm) {
00679 CleanupSelector(nm->GetTitle());
00680 if (gverbose > 0)
00681 printf("* %s \t in %s\n", nm->GetName(), gSystem->DirName(nm->GetTitle()));
00682 }
00683 }
00684
00685 treq->Enable();
00686 } else {
00687
00688 TIter nxs(&gSelectors);
00689 TNamed *nm = 0;
00690 while ((nm = (TNamed *)nxs())) {
00691 CleanupSelector(nm->GetTitle());
00692 if (gverbose > 0)
00693 printf("* %s \t in %s\n", nm->GetName(), gSystem->DirName(nm->GetTitle()));
00694 }
00695 }
00696 if (gverbose > 0)
00697 printf("******************************************************************\n");
00698
00699
00700 gH1Sel += "+";
00701 gEventSel += "+";
00702 gSimpleSel += "+";
00703 gTestsSel += "+";
00704
00705
00706
00707
00708 Bool_t failed = kFALSE;
00709 nxt.Reset();
00710 while ((t = (ProofTest *)nxt()))
00711 if (t->IsEnabled()) {
00712 if (t->Run() < 0) {
00713 failed = kTRUE;
00714 break;
00715 }
00716 }
00717
00718
00719 if (failed) {
00720 Bool_t kept = kTRUE;
00721 if (usedeflog && !gROOT->IsBatch()) {
00722 char *answer = Getline(" Some tests failed: would you like to keep the log file (N,Y)? [Y] ");
00723 if (answer && (answer[0] == 'N' || answer[0] == 'n')) {
00724
00725 gSystem->Unlink(glogfile);
00726 kept = kFALSE;
00727 }
00728 }
00729 if (kept)
00730 printf("* Log file kept at %s\n", glogfile.Data());
00731 } else {
00732 printf("* All registered tests have been passed :-) *\n");
00733
00734 if (usedeflog)
00735 gSystem->Unlink(glogfile);
00736 }
00737
00738 printf("******************************************************************\n");
00739 if (gProof) {
00740 gProof->GetStatistics((verbose > 0));
00741
00742
00743 const double reftime = 21.060;
00744 double rootmarks = (gProof->GetCpuTime() > 0) ? 1000 * reftime / gProof->GetCpuTime() : -1;
00745 printf(" ROOTMARKS = %.2f ROOT version: %s\t%s@%d\n", rootmarks, gROOT->GetVersion(),
00746 gROOT->GetSvnBranch(), gROOT->GetSvnRevision());
00747 printf("******************************************************************\n");
00748 }
00749
00750
00751 if (gProof && !gProof->IsLite() && !extcluster) {
00752
00753 gProof->Close("S");
00754 delete gProof;
00755
00756 if (killXrootdAt(uu.GetPort()+1, "xpdtut") != 0) {
00757 printf("+++ Warning: test daemon probably still running!\n");
00758 }
00759 }
00760 }
00761
00762
00763 Int_t PT_H1AssertFiles(const char *h1src)
00764 {
00765
00766
00767
00768 if (!h1src || strlen(h1src) <= 0) {
00769 printf("\n >>> Test failure: src dir undefined\n");
00770 return -1;
00771 }
00772
00773
00774 if (!strcmp(h1src,"download")) {
00775 gh1src = TString::Format("%s/h1", gtutdir.Data());
00776 if (gSystem->AccessPathName(gh1src)) {
00777 if (gSystem->MakeDirectory(gh1src) != 0) {
00778 printf("\n >>> Test failure: could not create dir %s\n", gh1src.Data());
00779 return -1;
00780 }
00781 }
00782
00783 Int_t i = 0;
00784 for (i = 0; i < 4; i++) {
00785 TString src = TString::Format("http://root.cern.ch/files/h1/%s", gh1file[i]);
00786 TString dst = TString::Format("%s/%s", gh1src.Data(), gh1file[i]);
00787 if (!TFile::Cp(src, dst)) {
00788 printf("\n >>> Test failure: problems retrieving %s\n", src.Data());
00789 return -1;
00790 }
00791 gSystem->RedirectOutput(0, 0, &gRH);
00792 printf("%d\b", i);
00793 gSystem->RedirectOutput(glogfile, "a", &gRH);
00794 }
00795
00796 gh1ok = kTRUE;
00797 return 0;
00798 }
00799
00800
00801 Int_t i = 0;
00802 for (i = 0; i < 4; i++) {
00803 TString src = TString::Format("%s/%s", h1src, gh1file[i]);
00804 if (gSystem->AccessPathName(src)) {
00805 printf("\n >>> Test failure: file %s does not exist\n", src.Data());
00806 return -1;
00807 }
00808 gSystem->RedirectOutput(0, 0, &gRH);
00809 printf("%d\b", i);
00810 gSystem->RedirectOutput(glogfile, "a", &gRH);
00811 }
00812 gh1src = h1src;
00813
00814
00815 gh1ok = kTRUE;
00816 return 0;
00817 }
00818
00819
00820 Int_t PT_CheckSimple(TQueryResult *qr, Long64_t nevt, Int_t nhist)
00821 {
00822
00823
00824 if (!qr) {
00825 printf("\n >>> Test failure: query result not found\n");
00826 return -1;
00827 }
00828
00829
00830 PutPoint();
00831 if (qr->GetEntries() != nevt) {
00832 printf("\n >>> Test failure: wrong number of entries processed: %lld (expected %lld)\n",
00833 qr->GetEntries(), nevt);
00834 return -1;
00835 }
00836
00837
00838 PutPoint();
00839 TList *out = qr->GetOutputList();
00840 if (!out) {
00841 printf("\n >>> Test failure: output list not found\n");
00842 return -1;
00843 }
00844
00845
00846 PutPoint();
00847 TH1F **hist = new TH1F*[nhist];
00848 for (Int_t i=0; i < nhist; i++) {
00849 hist[i] = dynamic_cast<TH1F *>(out->FindObject(Form("h%d",i)));
00850 if (!hist[i]) {
00851 printf("\n >>> Test failure: 'h%d' histo not found\n", i);
00852 return -1;
00853 }
00854 }
00855
00856
00857 PutPoint();
00858 for (Int_t i=0; i < nhist; i++) {
00859 Double_t ave = hist[i]->GetMean();
00860 Double_t rms = hist[i]->GetRMS();
00861 if (TMath::Abs(ave) > 5 * rms / TMath::Sqrt(hist[i]->GetEntries())) {
00862 printf("\n >>> Test failure: 'h%d' histo: mean > 5 * RMS/Sqrt(N)\n", i);
00863 return -1;
00864 }
00865 }
00866
00867
00868 PutPoint();
00869 return 0;
00870 }
00871
00872
00873 Int_t PT_CheckH1(TQueryResult *qr, Int_t irun = 0)
00874 {
00875
00876
00877 if (!qr) {
00878 printf("\n >>> Test failure: output list not found\n");
00879 return -1;
00880 }
00881
00882
00883 PutPoint();
00884 Long64_t runEntries[2] = {283813, 7525};
00885 if (qr->GetEntries() != runEntries[irun]) {
00886 printf("\n >>> Test failure: wrong number of entries processed: %lld (expected 283813)\n", qr->GetEntries());
00887 return -1;
00888 }
00889
00890
00891 PutPoint();
00892 TList *out = qr->GetOutputList();
00893 if (!out) {
00894 printf("\n >>> Test failure: output list not found\n");
00895 return -1;
00896 }
00897
00898
00899 PutPoint();
00900 TH1F *hdmd = dynamic_cast<TH1F*>(out->FindObject("hdmd"));
00901 if (!hdmd) {
00902 printf("\n >>> Test failure: 'hdmd' histo not found\n");
00903 return -1;
00904 }
00905 if ((Int_t)(hdmd->GetEntries()) != 7525) {
00906 printf("\n >>> Test failure: 'hdmd' histo: wrong number"
00907 " of entries (%d: expected 7525) \n",(Int_t)(hdmd->GetEntries()));
00908 return -1;
00909 }
00910 if (TMath::Abs((hdmd->GetMean() - 0.15512023) / 0.15512023) > 0.001) {
00911 printf("\n >>> Test failure: 'hdmd' histo: wrong mean"
00912 " (%f: expected 0.15512023) \n", hdmd->GetMean());
00913 return -1;
00914 }
00915
00916 PutPoint();
00917 TH2F *h2 = dynamic_cast<TH2F*>(out->FindObject("h2"));
00918 if (!h2) {
00919 printf("\n >>> Test failure: 'h2' histo not found\n");
00920 return -1;
00921 }
00922 if ((Int_t)(h2->GetEntries()) != 7525) {
00923 printf("\n >>> Test failure: 'h2' histo: wrong number"
00924 " of entries (%d: expected 7525) \n",(Int_t)(h2->GetEntries()));
00925 return -1;
00926 }
00927 if (TMath::Abs((h2->GetMean() - 0.15245688) / 0.15245688) > 0.001) {
00928 printf("\n >>> Test failure: 'h2' histo: wrong mean"
00929 " (%f: expected 0.15245688) \n", h2->GetMean());
00930 return -1;
00931 }
00932
00933
00934 PutPoint();
00935 return 0;
00936 }
00937
00938
00939 Int_t PT_Open(void *args)
00940 {
00941
00942
00943
00944 PutPoint();
00945 PT_Open_Args_t *PToa = (PT_Open_Args_t *)args;
00946 if (!PToa) {
00947 printf("\n >>> Test failure: invalid arguments: %p\n", args);
00948 return -1;
00949 }
00950
00951
00952 PutPoint();
00953 TString tmpdir(gSystem->TempDirectory()), us;
00954 #if !defined(R__MACOSX)
00955 if (!tmpdir.EndsWith(us.Data())) {
00956 UserGroup_t *ug = gSystem->GetUserInfo(gSystem->GetUid());
00957 if (ug) {
00958 us.Form("/%s", ug->fUser.Data());
00959 tmpdir += us;
00960 delete ug;
00961 } else {
00962 printf("\n >>> Test failure: could not get user info");
00963 return -1;
00964 }
00965 }
00966 gtutdir.Form("%s/.proof-tutorial", tmpdir.Data());
00967 #else
00968 gtutdir.Form("%s/.proof", tmpdir.Data());
00969 #endif
00970 if (gSystem->AccessPathName(gtutdir)) {
00971 if (gSystem->mkdir(gtutdir, kTRUE) != 0) {
00972 printf("\n >>> Test failure: could not assert/create the temporary directory"
00973 " for the tutorial (%s)", gtutdir.Data());
00974 return -1;
00975 }
00976 }
00977
00978
00979 TString dsetmgrstr;
00980 dsetmgrstr.Form("file dir:%s/datasets opt:-Cq:As:Sb:", gtutdir.Data());
00981 gEnv->SetValue("Proof.DataSetManager", dsetmgrstr.Data());
00982
00983
00984 TString packdir;
00985 packdir.Form("%s/packages", gtutdir.Data());
00986 gEnv->SetValue("Proof.PackageDir", packdir.Data());
00987
00988
00989 PutPoint();
00990 TProof *p = getProof(PToa->url, PToa->nwrks, gtutdir.Data(), "force", gDynamicStartup, kTRUE);
00991 if (!p || !(p->IsValid())) {
00992 printf("\n >>> Test failure: could not start the session\n");
00993 return -1;
00994 }
00995
00996 PutPoint();
00997 if (PToa->nwrks > 0 && p->GetParallel() != PToa->nwrks) {
00998 printf("\n >>> Test failure: number of workers different from requested\n");
00999 return -1;
01000 }
01001
01002
01003 p->ClearCache();
01004
01005
01006 gSystem->RedirectOutput(0, 0, &gRH);
01007 TString testPrint(TString::Format("%s/testPrint.log", gtutdir.Data()));
01008 gSystem->RedirectOutput(testPrint, "w", &gRHAdmin);
01009 gProof->Print();
01010 gSystem->RedirectOutput(0, 0, &gRHAdmin);
01011 gSystem->RedirectOutput(glogfile, "a", &gRH);
01012 TMacro macroPrint(testPrint);
01013 TObjString *os = macroPrint.GetLineWith("Working directory:");
01014 if (!os) {
01015 printf("\n >>> Test failure: problem parsing output from Print()\n");
01016 return -1;
01017 }
01018 Int_t from = strlen("Working directory:") + 1;
01019 if (!os->GetString().Tokenize(gsandbox, from, " ")) {
01020 printf("\n >>> Test failure: no sandbox dir found\n");
01021 return -1;
01022 }
01023 gsandbox = gSystem->DirName(gsandbox);
01024 gsandbox = gSystem->DirName(gsandbox);
01025 PutPoint();
01026
01027
01028 PutPoint();
01029 return 0;
01030 }
01031
01032
01033 Int_t PT_GetLogs(void *args)
01034 {
01035
01036
01037
01038 PutPoint();
01039 PT_Open_Args_t *PToa = (PT_Open_Args_t *)args;
01040 if (!PToa) {
01041 printf("\n >>> Test failure: invalid arguments: %p\n", args);
01042 return -1;
01043 }
01044
01045 PutPoint();
01046 TProofLog *pl = TProof::Mgr(PToa->url)->GetSessionLogs();
01047 if (!pl) {
01048 printf("\n >>> Test failure: could not get the logs from last session\n");
01049 return -1;
01050 }
01051
01052 PutPoint();
01053 if (PToa->nwrks > 0 && pl->GetListOfLogs()->GetSize() != (PToa->nwrks + 1)) {
01054 printf("\n >>> Test failure: number of logs different from workers of workers + 1\n");
01055 return -1;
01056 }
01057
01058
01059 PutPoint();
01060 return 0;
01061 }
01062
01063
01064 Int_t PT_Simple(void *submergers)
01065 {
01066
01067
01068
01069 PutPoint();
01070 if (!gProof) {
01071 printf("\n >>> Test failure: no PROOF session found\n");
01072 return -1;
01073 }
01074
01075
01076 if (submergers) {
01077 gProof->SetParameter("PROOF_UseMergers", 0);
01078 }
01079
01080
01081 Long64_t nevt = 1000000;
01082 Int_t nhist = 16;
01083
01084 gProof->SetParameter("ProofSimple_NHist", (Long_t)nhist);
01085
01086
01087 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01088
01089
01090 PutPoint();
01091 gProof->SetPrintProgress(&PrintStressProgress);
01092 gTimer.Start();
01093 gProof->Process(gSimpleSel.Data(), nevt);
01094 gTimer.Stop();
01095 gProof->SetPrintProgress(0);
01096
01097
01098 gSimpleCnt++;
01099 gSimpleTime += gTimer.RealTime();
01100
01101
01102 gProof->DeleteParameters("PROOF_UseMergers");
01103
01104
01105 PutPoint();
01106 return PT_CheckSimple(gProof->GetQueryResult(), nevt, nhist);
01107 }
01108
01109
01110 Int_t PT_H1Http(void *)
01111 {
01112
01113
01114
01115 PutPoint();
01116 if (!gProof) {
01117 printf("\n >>> Test failure: no PROOF session found\n");
01118 return -1;
01119 }
01120
01121
01122 AssertParallelUnzip();
01123
01124
01125 PutPoint();
01126 TChain *chain = new TChain("h42");
01127
01128
01129 if (!gh1ok) {
01130 if (PT_H1AssertFiles(gh1src.Data()) != 0) {
01131 gProof->SetPrintProgress(0);
01132 printf("\n >>> Test failure: could not assert the H1 files\n");
01133 return -1;
01134 }
01135 }
01136 Int_t i = 0;
01137 for (i = 0; i < 4; i++) {
01138 chain->Add(TString::Format("%s/%s", gh1src.Data(), gh1file[i]));
01139 }
01140
01141
01142 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01143
01144
01145 PutPoint();
01146 chain->SetProof();
01147 PutPoint();
01148 gProof->SetPrintProgress(&PrintStressProgress);
01149 gTimer.Start();
01150 chain->Process(gH1Sel.Data());
01151 gTimer.Stop();
01152 gProof->SetPrintProgress(0);
01153 gProof->RemoveChain(chain);
01154
01155
01156 gH1Cnt++;
01157 gH1Time += gTimer.RealTime();
01158
01159
01160 PutPoint();
01161 return PT_CheckH1(gProof->GetQueryResult());
01162 }
01163
01164
01165 Int_t PT_H1FileCollection(void *arg)
01166 {
01167
01168
01169
01170 PutPoint();
01171 if (!gProof) {
01172 printf("\n >>> Test failure: no PROOF session found\n");
01173 return -1;
01174 }
01175
01176
01177 AssertParallelUnzip();
01178
01179
01180 if (arg) {
01181 PT_Packetizer_t *strategy = (PT_Packetizer_t *)arg;
01182 if (strcmp(strategy->fName, "TPacketizerAdaptive")) {
01183 gProof->SetParameter("PROOF_Packetizer", strategy->fName);
01184 } else {
01185 if (strategy->fType != 1)
01186 gProof->SetParameter("PROOF_PacketizerStrategy", strategy->fType);
01187 }
01188 }
01189
01190
01191 PutPoint();
01192 TFileCollection *fc = new TFileCollection("h42");
01193
01194
01195 if (!gh1ok) {
01196 if (PT_H1AssertFiles(gh1src.Data()) != 0) {
01197 printf("\n >>> Test failure: could not assert the H1 files\n");
01198 return -1;
01199 }
01200 }
01201 Int_t i = 0;
01202 for (i = 0; i < 4; i++) {
01203 fc->Add(new TFileInfo(TString::Format("%s/%s", gh1src.Data(), gh1file[i])));
01204 }
01205
01206
01207 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01208
01209
01210 PutPoint();
01211 gProof->SetPrintProgress(&PrintStressProgress);
01212 gTimer.Start();
01213 gProof->Process(fc, gH1Sel.Data());
01214 gTimer.Stop();
01215 gProof->SetPrintProgress(0);
01216
01217
01218 gProof->DeleteParameters("PROOF_Packetizer");
01219 gProof->DeleteParameters("PROOF_PacketizerStrategy");
01220
01221
01222 gH1Cnt++;
01223 gH1Time += gTimer.RealTime();
01224
01225
01226 PutPoint();
01227 return PT_CheckH1(gProof->GetQueryResult());
01228 }
01229
01230
01231 Int_t PT_H1DataSet(void *)
01232 {
01233
01234
01235
01236 if (!gProof) {
01237 printf("\n >>> Test failure: no PROOF session found\n");
01238 return -1;
01239 }
01240
01241 if (gSkipDataSetTest) {
01242 return 1;
01243 }
01244 PutPoint();
01245
01246
01247 AssertParallelUnzip();
01248
01249
01250 const char *dsname = "h1dset";
01251
01252
01253 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01254
01255
01256 PutPoint();
01257 gProof->SetPrintProgress(&PrintStressProgress);
01258 gTimer.Start();
01259 gProof->Process(dsname, gH1Sel.Data());
01260 gTimer.Stop();
01261 gProof->SetPrintProgress(0);
01262
01263
01264 gH1Cnt++;
01265 gH1Time += gTimer.RealTime();
01266
01267
01268 PutPoint();
01269 return PT_CheckH1(gProof->GetQueryResult());
01270 }
01271
01272
01273 Int_t PT_H1MultiDataSet(void *)
01274 {
01275
01276
01277
01278 if (!gProof) {
01279 printf("\n >>> Test failure: no PROOF session found\n");
01280 return -1;
01281 }
01282
01283 if (gSkipDataSetTest) {
01284 return 1;
01285 }
01286 PutPoint();
01287
01288
01289 AssertParallelUnzip();
01290
01291
01292 const char *dsname = "h1dseta h1dsetb";
01293
01294
01295 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01296
01297
01298 PutPoint();
01299 gProof->SetPrintProgress(&PrintStressProgress);
01300 gTimer.Start();
01301 gProof->Process(dsname, gH1Sel.Data());
01302 gTimer.Stop();
01303 gProof->SetPrintProgress(0);
01304
01305
01306 gH1Cnt++;
01307 gH1Time += gTimer.RealTime();
01308
01309
01310 PutPoint();
01311 return PT_CheckH1(gProof->GetQueryResult());
01312 }
01313
01314
01315 Int_t PT_H1MultiDSetEntryList(void *)
01316 {
01317
01318
01319
01320
01321 if (!gProof) {
01322 printf("\n >>> Test failure: no PROOF session found\n");
01323 return -1;
01324 }
01325
01326 if (gSkipDataSetTest) {
01327 return 1;
01328 }
01329 PutPoint();
01330
01331
01332 AssertParallelUnzip();
01333
01334
01335 TString dsname("h1dseta|h1dsetb");
01336
01337
01338 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01339
01340
01341 PutPoint();
01342 gProof->SetPrintProgress(&PrintStressProgress);
01343 gTimer.Start();
01344 gProof->Process(dsname, gH1Sel.Data(), "fillList=elist.root");
01345 gTimer.Stop();
01346 gProof->SetPrintProgress(0);
01347
01348 TIter nxi(gProof->GetInputList());
01349 TObject *o = 0;
01350 while ((o = nxi())) {
01351 if (!strncmp(o->GetName(), "elist", 6) || !strcmp(o->GetName(), "fillList")) {
01352 gProof->GetInputList()->Remove(o);
01353 delete o;
01354 }
01355 }
01356
01357
01358 gH1Cnt++;
01359 gH1Time += gTimer.RealTime();
01360
01361
01362 dsname = "h1dseta<<elist.root h1dsetb?enl=elist.root";
01363 PutPoint();
01364 gProof->SetPrintProgress(&PrintStressProgress);
01365 gTimer.Start();
01366 gProof->Process(dsname, gH1Sel.Data());
01367 gTimer.Stop();
01368 gProof->SetPrintProgress(0);
01369
01370
01371 gSystem->Unlink("elist.root");
01372
01373 nxi.Reset();
01374 while ((o = nxi())) {
01375 if (!strncmp(o->GetName(), "elist", 6)) {
01376 gProof->GetInputList()->Remove(o);
01377 delete o;
01378 }
01379 }
01380
01381
01382 PutPoint();
01383 return PT_CheckH1(gProof->GetQueryResult(), 1);
01384 }
01385
01386
01387 Int_t PT_DataSets(void *)
01388 {
01389
01390
01391
01392
01393 if (!gProof) {
01394 printf("\n >>> Test failure: no PROOF session found\n");
01395 return -1;
01396 }
01397
01398 if (gSkipDataSetTest) {
01399 return 1;
01400 }
01401 PutPoint();
01402
01403
01404 PutPoint();
01405 TMap *dsm = gProof->GetDataSets();
01406 if (!dsm) {
01407 printf("\n >>> Test failure: could not retrieve map of datasets (even empty)!\n");
01408 return -1;
01409 }
01410 if (dsm->GetSize() > 0) {
01411
01412 TIter nxd(dsm);
01413 TObjString *os = 0;
01414 while ((os = (TObjString *)nxd())) {
01415 gProof->RemoveDataSet(os->GetName());
01416 }
01417
01418 delete dsm;
01419 dsm = gProof->GetDataSets();
01420 if (!dsm || dsm->GetSize() > 0) {
01421 printf("\n >>> Test failure: could not cleanup the dataset area! (%p)\n", dsm);
01422 delete dsm;
01423 return -1;
01424 }
01425 }
01426 delete dsm;
01427
01428
01429 PutPoint();
01430 TFileCollection *fc = new TFileCollection();
01431 TFileCollection *fca = new TFileCollection();
01432 TFileCollection *fcb = new TFileCollection();
01433
01434
01435 if (!gh1ok) {
01436 if (PT_H1AssertFiles(gh1src.Data()) != 0) {
01437 printf("\n >>> Test failure: could not assert the H1 files\n");
01438 return -1;
01439 }
01440 }
01441 Int_t i = 0;
01442 for (i = 0; i < 4; i++) {
01443 fc->Add(new TFileInfo(TString::Format("%s/%s", gh1src.Data(), gh1file[i])));
01444 if (i < 2) {
01445 fca->Add(new TFileInfo(TString::Format("%s/%s", gh1src.Data(), gh1file[i])));
01446 } else {
01447 fcb->Add(new TFileInfo(TString::Format("%s/%s", gh1src.Data(), gh1file[i])));
01448 }
01449 }
01450 fc->Update();
01451 fca->Update();
01452 fcb->Update();
01453
01454
01455 const char *dsname = "h1dset";
01456 const char *dsnamea = "h1dseta";
01457 const char *dsnameb = "h1dsetb";
01458
01459
01460 PutPoint();
01461 gProof->RegisterDataSet(dsname, fc);
01462 gProof->RegisterDataSet(dsnamea, fca);
01463 gProof->RegisterDataSet(dsnameb, fcb);
01464
01465 dsm = gProof->GetDataSets();
01466 if (!dsm || dsm->GetSize() != 3) {
01467 printf("\n >>> Test failure: could not register '%s,%s,%s' (%p)\n",
01468 dsname, dsnamea, dsnameb, dsm);
01469 delete dsm;
01470 return -1;
01471 }
01472 delete dsm;
01473
01474
01475 PutPoint();
01476 gProof->RemoveDataSet(dsname);
01477 gProof->RemoveDataSet(dsnamea);
01478 gProof->RemoveDataSet(dsnameb);
01479
01480 dsm = gProof->GetDataSets();
01481 if (!dsm || dsm->GetSize() != 0) {
01482 printf("\n >>> Test failure: could not cleanup '%s,%s,%s' (%p)\n",
01483 dsname, dsnamea, dsnameb, dsm);
01484 delete dsm;
01485 return -1;
01486 }
01487 delete dsm;
01488
01489
01490 PutPoint();
01491 gProof->RegisterDataSet(dsname, fc);
01492 gProof->RegisterDataSet(dsnamea, fca);
01493 gProof->RegisterDataSet(dsnameb, fcb);
01494
01495 dsm = gProof->GetDataSets();
01496 if (!dsm || dsm->GetSize() != 3) {
01497 printf("\n >>> Test failure: could not re-register '%s,%s,%s' (%p)\n",
01498 dsname, dsnamea, dsnameb, dsm);
01499 delete dsm;
01500 return -1;
01501 }
01502 delete dsm;
01503
01504
01505 PutPoint();
01506 if (gProof->VerifyDataSet(dsname) != 0) {
01507 printf("\n >>> Test failure: could not verify '%s'!\n", dsname);
01508 return -1;
01509 }
01510 if (gProof->VerifyDataSet(dsnamea) != 0) {
01511 printf("\n >>> Test failure: could not verify '%s'!\n", dsnamea);
01512 return -1;
01513 }
01514 if (gProof->VerifyDataSet(dsnameb) != 0) {
01515 printf("\n >>> Test failure: could not verify '%s'!\n", dsnameb);
01516 return -1;
01517 }
01518 gProof->ShowDataSets();
01519
01520
01521 delete fc;
01522 delete fca;
01523 delete fcb;
01524
01525
01526 PutPoint();
01527 return 0;
01528 }
01529
01530
01531 Int_t PT_Packages(void *)
01532 {
01533
01534
01535
01536
01537 PutPoint();
01538 if (!gProof) {
01539 printf("\n >>> Test failure: no PROOF session found\n");
01540 return -1;
01541 }
01542
01543
01544 PutPoint();
01545 TList *packs = gProof->GetListOfPackages();
01546 if (!packs) {
01547 printf("\n >>> Test failure: could not retrieve list of packages (even empty)!\n");
01548 return -1;
01549 }
01550 if (packs->GetSize() > 0) {
01551
01552 gProof->ClearPackages();
01553
01554 packs = gProof->GetListOfPackages();
01555 if (!packs || packs->GetSize() > 0) {
01556 printf("\n >>> Test failure: could not cleanup the package area!\n");
01557 return -1;
01558 }
01559 }
01560
01561
01562 const char *pack = "event";
01563 TString packpath("$ROOTSYS/tutorials/proof/event.par");
01564 gSystem->ExpandPathName(packpath);
01565
01566
01567 PutPoint();
01568 gProof->UploadPackage(packpath);
01569
01570 packs = gProof->GetListOfPackages();
01571 if (!packs || packs->GetSize() != 1) {
01572 printf("\n >>> Test failure: could not upload '%s'!\n", packpath.Data());
01573 return -1;
01574 }
01575
01576
01577 PutPoint();
01578 gProof->ClearPackage(pack);
01579
01580 packs = gProof->GetListOfPackages();
01581 if (!packs || packs->GetSize() != 0) {
01582 printf("\n >>> Test failure: could not cleanup '%s'!\n", pack);
01583 return -1;
01584 }
01585
01586
01587 PutPoint();
01588 gProof->UploadPackage(packpath);
01589
01590 packs = gProof->GetListOfPackages();
01591 if (!packs || packs->GetSize() != 1) {
01592 printf("\n >>> Test failure: could not re-upload '%s'!\n", packpath.Data());
01593 return -1;
01594 }
01595
01596
01597 PutPoint();
01598 gProof->EnablePackage(pack);
01599
01600 packs = gProof->GetListOfEnabledPackages();
01601 if (!packs || packs->GetSize() != 1) {
01602 printf("\n >>> Test failure: could not enable '%s'!\n", pack);
01603 return -1;
01604 }
01605
01606
01607 PutPoint();
01608 return 0;
01609 }
01610
01611
01612 Int_t PT_Event(void *)
01613 {
01614
01615
01616
01617 PutPoint();
01618 if (!gProof) {
01619 printf("\n >>> Test failure: no PROOF session found\n");
01620 return -1;
01621 }
01622
01623
01624 Long64_t nevt = 100000;
01625
01626
01627 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01628
01629
01630 PutPoint();
01631 gProof->SetPrintProgress(&PrintStressProgress);
01632 gProof->Process(gEventSel.Data(), nevt);
01633 gProof->SetPrintProgress(0);
01634
01635
01636 PutPoint();
01637 TQueryResult *qr = 0;
01638 if (!(qr = gProof->GetQueryResult())) {
01639 printf("\n >>> Test failure: query result not found\n");
01640 return -1;
01641 }
01642
01643
01644 PutPoint();
01645 if (qr->GetEntries() != nevt) {
01646 printf("\n >>> Test failure: wrong number of entries processed: %lld (expected %lld)\n",
01647 qr->GetEntries(), nevt);
01648 return -1;
01649 }
01650
01651
01652 PutPoint();
01653 if (!(gProof->GetOutputList())) {
01654 printf("\n >>> Test failure: output list not found\n");
01655 return -1;
01656 }
01657
01658
01659 PutPoint();
01660 TH1F *histo = dynamic_cast<TH1F*>(gProof->GetOutputList()->FindObject("histo"));
01661 if (!histo) {
01662 printf("\n >>> Test failure: 'histo' not found\n");
01663 return -1;
01664 }
01665
01666
01667 Double_t ave = histo->GetMean();
01668 Double_t rms = histo->GetRMS();
01669 if (TMath::Abs(ave - 50) > 10 * rms / TMath::Sqrt(histo->GetEntries())) {
01670 printf("\n >>> Test failure: 'histo': mean > 5 * RMS/Sqrt(N)\n");
01671 return -1;
01672 }
01673
01674
01675 PutPoint();
01676 return 0;
01677 }
01678
01679
01680 Int_t PT_InputData(void *)
01681 {
01682
01683
01684
01685 if (!gProof) {
01686 printf("\n >>> Test failure: no PROOF session found\n");
01687 return -1;
01688 }
01689 PutPoint();
01690
01691
01692 TH1F *h1 = new TH1F("h1data","Input data from file",100,-5.,5.);
01693 h1->FillRandom("gaus", 1000);
01694 TList *h1list = new TList;
01695 h1list->SetName("h1list");
01696 h1list->SetOwner(kTRUE);
01697 h1list->Add(h1);
01698 h1list->Add(new TParameter<Double_t>("h1avg", h1->GetMean()));
01699 h1list->Add(new TParameter<Double_t>("h1rms", h1->GetRMS()));
01700 TString datafile = glogfile;
01701 datafile += ("_h1data.root");
01702 TFile *f = TFile::Open(datafile, "RECREATE");
01703 if (!f) {
01704 printf("\n >>> Test failure: could not open file for input data\n");
01705 return -1;
01706 }
01707 f->cd();
01708 h1list->Write(0, TObject::kSingleKey, 0);
01709 f->Close();
01710 gProof->SetInputDataFile(datafile.Data());
01711
01712
01713 TH1F *h2 = new TH1F("h2data","Input data from memory",100,-5.,5.);
01714 h2->FillRandom("gaus", 1000);
01715 TList *h2list = new TList;
01716 h2list->SetName("h2list");
01717 h2list->SetOwner(kTRUE);
01718 h2list->Add(h2);
01719 h2list->Add(new TParameter<Double_t>("h2avg", h2->GetMean()));
01720 h2list->Add(new TParameter<Double_t>("h2rms", h2->GetRMS()));
01721 gProof->AddInputData(h2list);
01722
01723
01724 gProof->AddInput(new TNamed("InputObject", glogfile.Data()));
01725
01726
01727 gProof->AddInput(new TNamed("ProofTests_Type", "InputData"));
01728
01729
01730 Long64_t nevt = 1;
01731
01732
01733 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01734
01735
01736 PutPoint();
01737 gProof->SetPrintProgress(&PrintStressProgress);
01738 gProof->Process(gTestsSel.Data(), nevt);
01739 gProof->SetPrintProgress(0);
01740
01741
01742 gSystem->Unlink(datafile.Data());
01743 gProof->ClearInputData(h1list);
01744 gProof->ClearInputData(h2list);
01745 delete h1list;
01746 delete h2list;
01747
01748
01749 PutPoint();
01750 TQueryResult *qr = 0;
01751 if (!(qr = gProof->GetQueryResult())) {
01752 printf("\n >>> Test failure: query result not found\n");
01753 return -1;
01754 }
01755
01756
01757 PutPoint();
01758 if (!(gProof->GetOutputList())) {
01759 printf("\n >>> Test failure: output list not found\n");
01760 return -1;
01761 }
01762
01763
01764 PutPoint();
01765 TH1I *stat = dynamic_cast<TH1I*>(gProof->GetOutputList()->FindObject("TestStat"));
01766 if (!stat) {
01767 printf("\n >>> Test failure: 'TestStat' histo not found\n");
01768 return -1;
01769 }
01770
01771
01772 Int_t nw = (Int_t) stat->GetBinContent(1);
01773 PutPoint();
01774
01775 if (TMath::Abs(stat->GetBinContent(2) - nw) > .1) {
01776 printf("\n >>> Test failure: histo 'h1' not correctly received on all workers (%.0f/%d)\n",
01777 stat->GetBinContent(2), nw);
01778 return -1;
01779 }
01780 if (TMath::Abs(stat->GetBinContent(3) - nw) > .1) {
01781 printf("\n >>> Test failure: histo 'h2' not correctly received on all workers (%.0f/%d)\n",
01782 stat->GetBinContent(3), nw);
01783 return -1;
01784 }
01785 if (TMath::Abs(stat->GetBinContent(4) - nw) > .1) {
01786 printf("\n >>> Test failure: test input object not correctly received on all workers (%.0f/%d)\n",
01787 stat->GetBinContent(4), nw);
01788 return -1;
01789 }
01790
01791
01792 PutPoint();
01793 return 0;
01794 }
01795
01796
01797 Int_t PT_PackageArguments(void *)
01798 {
01799
01800
01801
01802 if (!gProof) {
01803 printf("\n >>> Test failure: no PROOF session found\n");
01804 return -1;
01805 }
01806 PutPoint();
01807
01808
01809 const char *pack1 = "packtest1";
01810 TString pack1path("$ROOTSYS/tutorials/proof/packtest1.par");
01811 gSystem->ExpandPathName(pack1path);
01812 PutPoint();
01813 gProof->UploadPackage(pack1path);
01814
01815 TList *packs = gProof->GetListOfPackages();
01816 if (!packs || !packs->FindObject(pack1)) {
01817 printf("\n >>> Test failure: could not upload '%s'!\n", pack1path.Data());
01818 return -1;
01819 }
01820
01821 TString arg("ProofTest.ConstChar");
01822 if (gProof->EnablePackage(pack1, arg) != 0) {
01823 printf("\n >>> Test failure: could not enable '%s' with argument: '%s'!\n", pack1path.Data(), arg.Data());
01824 return -1;
01825 }
01826
01827
01828 gProof->SetParameter("ProofTests_Type", "PackTest1");
01829
01830
01831 Long64_t nevt = 1;
01832
01833
01834 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01835
01836
01837 gProof->SetParameter("testenv", arg.Data());
01838
01839
01840 PutPoint();
01841 gProof->SetPrintProgress(&PrintStressProgress);
01842 gProof->Process(gTestsSel.Data(), nevt);
01843 gProof->SetPrintProgress(0);
01844
01845
01846 gProof->ClearPackage(pack1);
01847 gProof->DeleteParameters("ProofTests_Type");
01848 gProof->DeleteParameters("testenv");
01849
01850
01851 PutPoint();
01852 TQueryResult *qr = 0;
01853 if (!(qr = gProof->GetQueryResult())) {
01854 printf("\n >>> Test failure: query result not found\n");
01855 return -1;
01856 }
01857
01858
01859 PutPoint();
01860 if (!(gProof->GetOutputList())) {
01861 printf("\n >>> Test failure: output list not found\n");
01862 return -1;
01863 }
01864
01865
01866 PutPoint();
01867 TH1I *stat = dynamic_cast<TH1I*>(gProof->GetOutputList()->FindObject("TestStat"));
01868 if (!stat) {
01869 printf("\n >>> Test failure: 'TestStat' histo not found\n");
01870 return -1;
01871 }
01872
01873
01874 Int_t nw = (Int_t) stat->GetBinContent(1);
01875 PutPoint();
01876
01877 if (TMath::Abs(stat->GetBinContent(2) - nw) > .1) {
01878 printf("\n >>> Test failure: var '%s' not correctly set on all workers (%.0f/%d)\n",
01879 arg.Data(), stat->GetBinContent(2), nw);
01880 return -1;
01881 }
01882
01883
01884 const char *pack2 = "packtest2";
01885 TString pack2path("$ROOTSYS/tutorials/proof/packtest2.par");
01886 gSystem->ExpandPathName(pack2path);
01887 PutPoint();
01888 gProof->UploadPackage(pack2path);
01889
01890 packs = gProof->GetListOfPackages();
01891 if (!packs || !packs->FindObject(pack2)) {
01892 printf("\n >>> Test failure: could not upload '%s'!\n", pack2path.Data());
01893 return -1;
01894 }
01895
01896 TList *argls = new TList;
01897 argls->Add(new TNamed("ProofTest.ArgOne", "2."));
01898 argls->Add(new TNamed("ProofTest.ArgTwo", "3."));
01899 argls->Add(new TNamed("ProofTest.ArgThree", "4."));
01900
01901 if (gProof->EnablePackage(pack2, argls) != 0) {
01902 printf("\n >>> Test failure: could not enable '%s' with argument: '%s'!\n", pack2path.Data(), arg.Data());
01903 return -1;
01904 }
01905
01906
01907 gProof->SetParameter("ProofTests_Type", "PackTest2");
01908
01909
01910 if (gProof->GetQueryResults()) gProof->GetQueryResults()->Clear();
01911
01912
01913 TString envs("ProofTest.ArgOne,ProofTest.ArgTwo,ProofTest.ArgThree");
01914 gProof->SetParameter("testenv", envs.Data());
01915
01916
01917 PutPoint();
01918 gProof->SetPrintProgress(&PrintStressProgress);
01919 gProof->Process(gTestsSel.Data(), nevt);
01920 gProof->SetPrintProgress(0);
01921
01922
01923 gProof->ClearPackage(pack2);
01924 gProof->DeleteParameters("ProofTests_Type");
01925 gProof->DeleteParameters("testenv");
01926
01927
01928 PutPoint();
01929 qr = 0;
01930 if (!(qr = gProof->GetQueryResult())) {
01931 printf("\n >>> Test failure: query result not found\n");
01932 return -1;
01933 }
01934
01935
01936 PutPoint();
01937 if (!(gProof->GetOutputList())) {
01938 printf("\n >>> Test failure: output list not found\n");
01939 return -1;
01940 }
01941
01942
01943 PutPoint();
01944 if (!(stat = dynamic_cast<TH1I*>(gProof->GetOutputList()->FindObject("TestStat")))) {
01945 printf("\n >>> Test failure: 'TestStat' histo not found\n");
01946 return -1;
01947 }
01948
01949
01950 nw = (Int_t) stat->GetBinContent(1);
01951 PutPoint();
01952
01953 if (TMath::Abs(stat->GetBinContent(2) - nw) > .1) {
01954 printf("\n >>> Test failure: var 'ProofTest.ArgOne' not correctly set on all workers (%.0f/%d)\n",
01955 stat->GetBinContent(2), nw);
01956 return -1;
01957 }
01958
01959 if (TMath::Abs(stat->GetBinContent(3) - nw) > .1) {
01960 printf("\n >>> Test failure: var 'ProofTest.ArgTwo' not correctly set on all workers (%.0f/%d)\n",
01961 stat->GetBinContent(3), nw);
01962 return -1;
01963 }
01964
01965 if (TMath::Abs(stat->GetBinContent(4) - nw) > .1) {
01966 printf("\n >>> Test failure: var 'ProofTest.ArgThree' not correctly set on all workers (%.0f/%d)\n",
01967 stat->GetBinContent(4), nw);
01968 return -1;
01969 }
01970
01971
01972 PutPoint();
01973 return 0;
01974 }
01975
01976
01977 Int_t PT_H1SimpleAsync(void *arg)
01978 {
01979
01980
01981
01982 if (!gProof) {
01983 printf("\n >>> Test failure: no PROOF session found\n");
01984 return -1;
01985 }
01986
01987 if (gProof->IsLite()) {
01988 return 1;
01989 }
01990 PutPoint();
01991
01992
01993 AssertParallelUnzip();
01994
01995
01996 if (arg) {
01997 PT_Packetizer_t *strategy = (PT_Packetizer_t *)arg;
01998 if (strcmp(strategy->fName, "TPacketizerAdaptive")) {
01999 gProof->SetParameter("PROOF_Packetizer", strategy->fName);
02000 } else {
02001 if (strategy->fType != 1)
02002 gProof->SetParameter("PROOF_PacketizerStrategy", strategy->fType);
02003 }
02004 }
02005
02006
02007 PutPoint();
02008 TFileCollection *fc = new TFileCollection("h42");
02009
02010
02011 if (!gh1ok) {
02012 if (PT_H1AssertFiles(gh1src.Data()) != 0) {
02013 printf("\n >>> Test failure: could not assert the H1 files\n");
02014 return -1;
02015 }
02016 }
02017 Int_t i = 0;
02018 for (i = 0; i < 4; i++) {
02019 fc->Add(new TFileInfo(TString::Format("%s/%s", gh1src.Data(), gh1file[i])));
02020 }
02021
02022
02023 PutPoint();
02024 if (gProof->GetQueryResults()) {
02025 gProof->GetQueryResults()->Clear();
02026 gProof->Remove("cleanupdir");
02027 }
02028
02029
02030 PutPoint();
02031 gProof->SetPrintProgress(&PrintStressProgress);
02032 gProof->Process(fc, gH1Sel.Data(), "ASYN");
02033
02034
02035 Long64_t nevt = 1000000;
02036 Int_t nhist = 16;
02037
02038 gProof->SetParameter("ProofSimple_NHist", (Long_t)nhist);
02039 gProof->Process(gSimpleSel.Data(), nevt, "ASYN");
02040
02041
02042 Double_t dtw = 10;
02043 if (gH1Cnt > 0 && gSimpleTime > 0) {
02044 dtw = gH1Time / gH1Cnt + gSimpleTime / gSimpleCnt + 1;
02045 if (dtw < 10) dtw = 10;
02046 }
02047 Int_t tw = (Int_t) (5 * dtw);
02048
02049 gTimedOut = kFALSE;
02050 TTimeOutTimer t(tw*1000);
02051
02052
02053 while (!gProof->IsIdle() && !gTimedOut)
02054 gSystem->InnerLoop();
02055
02056 gProof->SetPrintProgress(0);
02057 PutPoint();
02058
02059
02060 TList *ql = gProof->GetQueryResults();
02061 if (ql && ql->GetSize() > 0) {
02062 ql->Print();
02063 }
02064
02065 TString ref;
02066 TIter nxq(ql, kIterBackward);
02067 Int_t nd = 2;
02068 TQueryResult *qr = 0;
02069 while ((qr = (TQueryResult *)nxq()) && nd > 0) {
02070 ref.Form("%s:%s", qr->GetTitle(), qr->GetName());
02071 gProof->Retrieve(ref);
02072 qr = gProof->GetQueryResult(ref);
02073 if (qr && qr->GetSelecImp()) {
02074 if (!strcmp(qr->GetSelecImp()->GetTitle(), "h1analysis")) {
02075 PutPoint();
02076 if (PT_CheckH1(qr) != 0) return -1;
02077 nd--;
02078 } else if (!strcmp(qr->GetSelecImp()->GetTitle(), "ProofSimple")) {
02079 PutPoint();
02080 if (PT_CheckSimple(qr, nevt, nhist) != 0) return -1;
02081 nd--;
02082 } else {
02083 printf("\n >>> Test failure: query with unexpected selector '%s'\n", qr->GetSelecImp()->GetTitle());
02084 return -1;
02085 }
02086 } else {
02087 printf("\n >>> Test failure: query undefined (%p) or with empty selector macro ('%s')\n", qr, ref.Data());
02088 return -1;
02089 }
02090 }
02091
02092
02093 PutPoint();
02094 return 0;
02095 }
02096
02097
02098 Int_t PT_AdminFunc(void *)
02099 {
02100
02101
02102
02103 if (!gProof) {
02104 printf("\n >>> Test failure: no PROOF session found\n");
02105 return -1;
02106 }
02107
02108 if (gProof->IsLite()) {
02109 return 1;
02110 }
02111 PutPoint();
02112
02113 TProofMgr *mgr = gProof->GetManager();
02114 if (!mgr) {
02115 printf("\n >>> Test failure: no PROOF manager found\n");
02116 return -1;
02117 }
02118 PutPoint();
02119
02120 TString testDir(TString::Format("%s/stressProof-Admin", gtutdir.Data()));
02121 if (gSystem->AccessPathName(testDir)) {
02122
02123 if (gSystem->MakeDirectory(testDir)) {
02124 printf("\n >>> Test failure: cannot create %s\n", testDir.Data());
02125 return -1;
02126 }
02127 }
02128
02129 TMacro testMacro;
02130 testMacro.AddLine("// Test macro");
02131 testMacro.AddLine("#include \"TSystem.h\"");
02132 testMacro.AddLine("void testMacro(Int_t opt = 1)");
02133 testMacro.AddLine("{");
02134 testMacro.AddLine(" if (opt == 1) {");
02135 testMacro.AddLine(" Printf(\"Pid: \", gSystem->GetPid());");
02136 testMacro.AddLine(" }");
02137 testMacro.AddLine("}");
02138
02139 TString testFile(TString::Format("%s/testMacro.C", testDir.Data()));
02140 if (!gSystem->AccessPathName(testFile)) {
02141
02142 if (gSystem->Unlink(testFile)) {
02143 printf("\n >>> Test failure: cannot unlink %s\n", testFile.Data());
02144 return -1;
02145 }
02146 }
02147 testMacro.SaveSource(testFile);
02148 FileStat_t stloc;
02149 if (gSystem->GetPathInfo(testFile, stloc) != 0) {
02150
02151 printf("\n >>> Test failure: file %s was not created\n", testFile.Data());
02152 return -1;
02153 }
02154
02155 TMD5 *testMacroMd5 = testMacro.Checksum();
02156 if (!testMacroMd5) {
02157
02158 printf("\n >>> Test failure: could not calculate the md5 sum of the test macro\n");
02159 return -1;
02160 }
02161 PutPoint();
02162
02163
02164 if (mgr->PutFile(testFile, "~/", "force") != 0) {
02165
02166 printf("\n >>> Test failure: problems sending file to master sandbox\n");
02167 return -1;
02168 }
02169 PutPoint();
02170
02171 TString testFile1(TString::Format("%s/testMacro.cxx", testDir.Data()));
02172 if (mgr->GetFile("~/testMacro.C", testFile1, "force") != 0) {
02173
02174 printf("\n >>> Test failure: problems retrieving file from the master sandbox\n");
02175 return -1;
02176 }
02177 PutPoint();
02178
02179
02180 gSystem->RedirectOutput(0, 0, &gRH);
02181 TString testLs(TString::Format("%s/testLs.log", testDir.Data()));
02182 gSystem->RedirectOutput(testLs, "w", &gRHAdmin);
02183 mgr->Ls("~/testMacro.C");
02184 gSystem->RedirectOutput(0, 0, &gRHAdmin);
02185 gSystem->RedirectOutput(glogfile, "a", &gRH);
02186 TMacro macroLs(testLs);
02187 TString testLsLine = TString::Format("%s/testMacro.C", gsandbox.Data());
02188 testLsLine.Remove(0, testLsLine.Index(".proof-tutorial"));
02189 if (!macroLs.GetLineWith(testLsLine)) {
02190 printf("\n >>> Test failure: Ls: output not consistent (line: '%s')\n", testLsLine.Data());
02191 return -1;
02192 }
02193 PutPoint();
02194
02195
02196 gSystem->RedirectOutput(0, 0, &gRH);
02197 TString testMore(TString::Format("%s/testMore.log", testDir.Data()));
02198 gSystem->RedirectOutput(testMore, "w", &gRHAdmin);
02199 mgr->More("~/testMacro.C");
02200 gSystem->RedirectOutput(0, 0, &gRHAdmin);
02201 gSystem->RedirectOutput(glogfile, "a", &gRH);
02202 TMacro macroMore(testMore);
02203 if (macroMore.GetListOfLines()->GetSize() < 2) {
02204 printf("\n >>> Test failure: More output not too short: %d lines\n",
02205 macroMore.GetListOfLines()->GetSize());
02206 return -1;
02207 }
02208 macroMore.GetListOfLines()->Remove(macroMore.GetListOfLines()->First());
02209 macroMore.GetListOfLines()->Remove(macroMore.GetListOfLines()->First());
02210 TMD5 *testMoreMd5 = macroMore.Checksum();
02211 if (!testMoreMd5) {
02212
02213 printf("\n >>> Test failure: could not calculate the md5 sum of the 'more' result\n");
02214 return -1;
02215 }
02216 if (strcmp(testMacroMd5->AsString(), testMoreMd5->AsString())) {
02217 printf("\n >>> Test failure: More: result not consistent with reference: {%s, %s}\n",
02218 testMacroMd5->AsString(), testMoreMd5->AsString());
02219 return -1;
02220 }
02221 PutPoint();
02222
02223
02224 FileStat_t strem;
02225 if (mgr->Stat("~/testMacro.C", strem) != 0) {
02226
02227 printf("\n >>> Test failure: could not stat remotely the test file\n");
02228 return -1;
02229 }
02230 if (strem.fSize != stloc.fSize) {
02231
02232 printf("\n >>> Test failure: stat sizes inconsistent: %lld vs %lld (bytes)\n", strem.fSize, stloc.fSize);
02233 return -1;
02234 }
02235 PutPoint();
02236
02237
02238 if (mgr->Cp("http://root.cern.ch/files/h1/dstarmb.root", "~/") != 0) {
02239
02240 printf("\n >>> Test failure: could not retrieve remotely dstarmb.root from the Root Web server\n");
02241 return -1;
02242 }
02243 TString sum;
02244 if (mgr->Md5sum("~/dstarmb.root", sum) != 0) {
02245
02246 printf("\n >>> Test failure: calculating the md5sum of dstarmb.root\n");
02247 return -1;
02248 }
02249 if (sum != "0a60055370e16d954f90fb50c2d1a801") {
02250
02251 printf("\n >>> Test failure: wrong value for md5sum of dstarmb.root: %s\n", sum.Data());
02252 return -1;
02253 }
02254 PutPoint();
02255
02256
02257 SafeDelete(testMoreMd5);
02258 SafeDelete(testMacroMd5);
02259
02260
02261 PutPoint();
02262 return 0;
02263
02264 }