o the path where to save the OA database can be relative :)

o memory cheching with valgrind
This commit is contained in:
Jean-Manuel Caba 2010-08-02 16:11:06 +00:00
parent 1693eb500e
commit 3aefb415f2
4 changed files with 77 additions and 46 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-07-30 16:48:54" - OpenAccessCommon.h // Time-stamp: "2010-08-02 17:50:42" - OpenAccessCommon.h
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. | // | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved | // | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -251,6 +251,17 @@ namespace {
} }
} }
/**
handling realpath with string intead of char*
*/
inline string realPath(const string& path){
char* buffer = (char*) calloc(PATH_MAX+1,sizeof(char));
realpath(path.c_str(), buffer);
string res(buffer);
free(buffer);
return res;
}
/** /**
generate info from library name generate info from library name
*/ */
@ -287,14 +298,19 @@ namespace {
try{ try{
cerr << "Overwriting cds.lib file begin " << endl; cerr << "Overwriting cds.lib file begin " << endl;
string cdsPath = path + "/cds.lib"; string cdsPath = path + "/cds.lib";
oaLibDefList* ldl = oaLibDefList::get( cdsPath.c_str(), 'a'); oaString oaCDSPath = oaString(cdsPath.c_str());
oaLibDefList* ldl = oaLibDefList::find(oaCDSPath);
if(!ldl)
ldl = oaLibDefList::get(oaCDSPath, 'a');
assert(ldl); assert(ldl);
assert(ldl->isValid()); assert(ldl->isValid());
if(!oaLibDef::find(ldl, infos.first)) oaLibDef* toAdd = oaLibDef::find(ldl, infos.first);
oaLibDef::create(ldl, infos.first, infos.second.c_str()); if(!toAdd)
toAdd = oaLibDef::create(ldl, infos.first, infos.second.c_str());
ldl->save(); ldl->save();
ldl->destroy();//claim memory ldl->destroy();//claim memory
ldl = NULL; ldl = NULL;
cdsPath.clear();
cerr << "Overwrited cds.lib file end" << endl; cerr << "Overwrited cds.lib file end" << endl;
}catch(oaException& e){ }catch(oaException& e){
cerr << "ERROR cds: " << e.getMsg() << endl; cerr << "ERROR cds: " << e.getMsg() << endl;

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*- // -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-02 14:58:55" - OpenAccessDriver.cpp // Time-stamp: "2010-08-02 16:54:01" - OpenAccessDriver.cpp
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. | // | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved | // | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -64,7 +64,7 @@ namespace {
Technology* _technology; Technology* _technology;
public: public:
OADriver(const string& path) : OADriver(const string& path) :
_path(path), _path(realPath(path)),
_oaTech(NULL), _oaTech(NULL),
_library2OALib(), _library2OALib(),
_cell2OADesign4Netlist(), _cell2OADesign4Netlist(),
@ -96,15 +96,20 @@ namespace {
_oaTech->save(); _oaTech->save();
_oaTech->close(); _oaTech->close();
saveDesignsInMap(_cell2OADesign4Netlist); saveDesignsInMap(_cell2OADesign4Netlist);
_cell2OADesign4Netlist.clear();
saveDesignsInMap(_cell2OADesign4Schematic); saveDesignsInMap(_cell2OADesign4Schematic);
_cell2OADesign4Schematic.clear();
saveDesignsInMap(_cell2OADesign4Symbolic); saveDesignsInMap(_cell2OADesign4Symbolic);
_cell2OADesign4Symbolic.clear();
saveDesignsInMap(_cell2OADesign4Layout); saveDesignsInMap(_cell2OADesign4Layout);
_cell2OADesign4Layout.clear();
for (Library2OALibMap::iterator it = _library2OALib.begin(); for (Library2OALibMap::iterator it = _library2OALib.begin();
it != _library2OALib.end(); it != _library2OALib.end();
++it) { ++it) {
oaLib* lib = it->second; oaLib* lib = it->second;
lib->close(); lib->close();
} }
_path.clear();
cerr << "ALL SAVED" << endl; cerr << "ALL SAVED" << endl;
} }
@ -140,6 +145,7 @@ namespace {
#endif #endif
// 4) create, update library list file // 4) create, update library list file
createCDS(infos,_path); createCDS(infos,_path);
infos.second.clear();
return lib; return lib;
} }

View File

@ -1,21 +1,30 @@
all: TESTDIR= ./testOA
TECHNOFILE= /asim/chams/etc/chams/config.freePDK45.xml
compile:
./compile.sh ./compile.sh
run: run: compile
./x86_64/usr/local/bin/testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml /tmp/testOA 2>&1 | tee err.log ./x86_64/usr/local/bin/testOAWrapper $(TECHNOFILE) $(TESTDIR) 2>&1 | tee $@.log
debug: debug: compile
gdb -args ./x86_64/usr/local/bin/testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml /tmp/testOA gdb -args ./x86_64/usr/local/bin/testOAWrapper $(TECHNOFILE) $(TESTDIR)
ddd: ddd: compile
ddd -args ./x86_64/usr/local/bin/testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml /tmp/testOA ddd -args ./x86_64/usr/local/bin/testOAWrapper $(TECHNOFILE) $(TESTDIR)
valgrind: valgrind_simple: compile
valgrind ./x86_64/usr/local/bin/testOAWrapper /asim/chams/etc/chams/config.freePDK45.xml /tmp/testOA valgrind ./x86_64/usr/local/bin/testOAWrapper $(TECHNOFILE) $(TESTDIR) 2>&1 | tee $@.log
rmtmp: valgrind_full: compile
rm -rf /tmp/* valgrind -v --leak-check=full --show-reachable=yes ./x86_64/usr/local/bin/testOAWrapper $(TECHNOFILE) $(TESTDIR) 2>&1 | tee $@.log
mrproper: clean
rm -rf $(TESTDIR) *.log
clean: clean:
rm -rf x86_64 rm -rf x86_64
.PHONY: clean mrproper valgrind ddd debug run compile

View File

@ -8,6 +8,7 @@
// x-----------------------------------------------------------------x // x-----------------------------------------------------------------x
#include <iostream> #include <iostream>
#include <memory>
#include <assert.h> #include <assert.h>
using namespace std; using namespace std;
@ -44,7 +45,6 @@ void testCell(Cell* dev,char* pathToTest){
cerr << "Cell not created" << endl; cerr << "Cell not created" << endl;
return; return;
} }
system((string("mkdir -p ") + string(pathToTest)).c_str());
cerr << "driving GDS" << endl; cerr << "driving GDS" << endl;
GdsDriver(dev).save(string(pathToTest) + "/" + getString(dev->getName()) + ".gds"); GdsDriver(dev).save(string(pathToTest) + "/" + getString(dev->getName()) + ".gds");
@ -57,7 +57,7 @@ void testCell(Cell* dev,char* pathToTest){
} }
void testAnalog(char* pathToConf,char* pathToTest){ void testAnalog(char* pathToConf,char* pathToTest){
AnalogEnv::create(pathToConf);//create Database ... auto_ptr<AnalogEnv> aenv(AnalogEnv::create(pathToConf));//create Database ...
cerr << "analog environment loaded and database created" << endl; cerr << "analog environment loaded and database created" << endl;
DataBase* db = DataBase::getDB(); DataBase* db = DataBase::getDB();
assert(db != NULL); assert(db != NULL);
@ -93,9 +93,8 @@ void testAnalog(char* pathToConf,char* pathToTest){
void testNum(char* pathToConf,char* pathToTest,char* cellName){ void testNum(char* pathToConf,char* pathToTest,char* cellName){
cerr << "creating cell from sxlib " << cellName << endl; cerr << "creating cell from sxlib " << cellName << endl;
DataBase* db = DataBase::getDB(); DataBase* db = DataBase::getDB();
AllianceFramework* af = AllianceFramework::get(); AllianceFramework* af =AllianceFramework::get();
Cell* cell = NULL; Cell* cell = af->getCell(cellName, Catalog::State::Views );
cell = af->getCell(cellName, Catalog::State::Views );
cerr << "testing cell from sxlib "<< cellName << endl; cerr << "testing cell from sxlib "<< cellName << endl;
testCell(cell,pathToTest); testCell(cell,pathToTest);
} }
@ -202,6 +201,7 @@ int main(int argc,char** argv) {
testNum(argv[1],argv[2],"xr2_x4"); testNum(argv[1],argv[2],"xr2_x4");
testNum(argv[1],argv[2],"zero_x0"); testNum(argv[1],argv[2],"zero_x0");
DataBase::getDB()->destroy();
cerr << "ending normally" << endl; cerr << "ending normally" << endl;
return 0; return 0;
} }