From 36e97d8ae8a0d8e8a6895862115f53567926c5a7 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 1 Feb 2012 05:44:36 +0000 Subject: [PATCH] Adding new test macro (Mihai) --- EVE/test-macros/compileEveMacros.C | 93 ++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 EVE/test-macros/compileEveMacros.C diff --git a/EVE/test-macros/compileEveMacros.C b/EVE/test-macros/compileEveMacros.C new file mode 100644 index 00000000000..09a173c6b92 --- /dev/null +++ b/EVE/test-macros/compileEveMacros.C @@ -0,0 +1,93 @@ +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * + * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * + * full copyright notice. * + **************************************************************************/ + +//************************************************************************ +// Author: Mihai Niculescu (mihai.niculescu@cern.ch) +// Jan 31 2012 +//************************************************************************ + +#if !defined(__CINT__) || defined(__MAKECINT__) +#include +#include +#include +#include +#include +#include +#include +#endif + +/* Compiles all AliEve macros + * + * Usage: + * 1. Launch alieve from terminal + * 2. ROOT command prompt from terminal execute this script: .x compileEveMacros.C + * 3. Wait for compilation to finish + * + * NOTE: + * At the end of compilation,you might get a list + * with all macros that failed compilation + * + * Parameters: + * macDir - absolute directory path where to find the macros + * opt - compilation options (See: TSystem::CompileMacro) + * + * Default: + * - compiles all macros from AliRoot installation dir ($ALICE_ROOT/EVE/alice-macros) + * - options for compilation (- k f c) + */ + +void compileEveMacros( const char * macDir="", Option_t *opt="") +{ + if(macDir == "") + macDir = Form("%s/EVE/alice-macros", gSystem->Getenv("ALICE_ROOT") ); + + if(opt == "") + opt = "-kfc"; // compilation options + + TObjString *mac; + TList * listOfFailedMacros = new TList; // list of macros that failed compilation + + TSystemDirectory *curDir = new TSystemDirectory(macDir, macDir); + TSystemFile *curFile = 0; + + TList* listOfMacros = curDir->GetListOfFiles(); + TListIter next(listOfMacros); + + TPMERegexp regex("\\.C$"); + + printf("Files found in macro directory: %d\n", listOfMacros->GetSize() ); + + Int_t nMacros = 0; + + while( (curFile = static_cast(next())) ) + { + mac = new TObjString(curFile->GetName()); + + if( regex.Match(mac->String().Data() ) > 0 ) + { + nMacros++; + + printf("Macro %s\n", mac->String().Data() ); + TEveUtil::CheckMacro(mac->String().Data() ); + if(!gSystem->CompileMacro(mac->String().Data(), opt, mac->String().Data(), macDir) ) + listOfFailedMacros->Add(mac); + } + + } + + printf("\n\nTotal Macros:%d \tFailed:%d \n", nMacros, listOfFailedMacros->GetSize() ); + + printf("\nFollowing macros failed compilation: \n"); + TListIter failed(listOfFailedMacros); + while( (mac = static_cast(failed())) ) + { + printf( "%s\n", mac->String().Data() ); + } + + delete listOfFailedMacros; + delete listOfMacros; + delete curDir; +} \ No newline at end of file -- 2.39.3