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"-*-
// Time-stamp: "2010-07-30 16:48:54" - OpenAccessCommon.h
// Time-stamp: "2010-08-02 17:50:42" - OpenAccessCommon.h
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | 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
*/
@ -287,14 +298,19 @@ namespace {
try{
cerr << "Overwriting cds.lib file begin " << endl;
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->isValid());
if(!oaLibDef::find(ldl, infos.first))
oaLibDef::create(ldl, infos.first, infos.second.c_str());
oaLibDef* toAdd = oaLibDef::find(ldl, infos.first);
if(!toAdd)
toAdd = oaLibDef::create(ldl, infos.first, infos.second.c_str());
ldl->save();
ldl->destroy();//claim memory
ldl = NULL;
cdsPath.clear();
cerr << "Overwrited cds.lib file end" << endl;
}catch(oaException& e){
cerr << "ERROR cds: " << e.getMsg() << endl;

View File

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

View File

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

View File

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