verilator regression fix missing fclose #46
This commit is contained in:
parent
eca54585b0
commit
68fdbe60cc
|
@ -106,6 +106,7 @@ void loadHexImpl(string path,Memory* mem) {
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
char* content = new char[size];
|
char* content = new char[size];
|
||||||
fread(content, 1, size, fp);
|
fread(content, 1, size, fp);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
char* line = content;
|
char* line = content;
|
||||||
|
@ -2104,15 +2105,19 @@ public:
|
||||||
fseek(refFile, 0, SEEK_SET);
|
fseek(refFile, 0, SEEK_SET);
|
||||||
char* ref = new char[refSize];
|
char* ref = new char[refSize];
|
||||||
fread(ref, 1, refSize, refFile);
|
fread(ref, 1, refSize, refFile);
|
||||||
|
fclose(refFile);
|
||||||
|
|
||||||
|
|
||||||
logTraces.flush();
|
logTraces.flush();
|
||||||
|
logTraces.close();
|
||||||
|
|
||||||
FILE *logFile = fopen((name + ".logTrace").c_str(), "r");
|
FILE *logFile = fopen((name + ".logTrace").c_str(), "r");
|
||||||
fseek(logFile, 0, SEEK_END);
|
fseek(logFile, 0, SEEK_END);
|
||||||
uint32_t logSize = ftell(logFile);
|
uint32_t logSize = ftell(logFile);
|
||||||
fseek(logFile, 0, SEEK_SET);
|
fseek(logFile, 0, SEEK_SET);
|
||||||
char* log = new char[logSize];
|
char* log = new char[logSize];
|
||||||
fread(log, 1, logSize, logFile);
|
fread(log, 1, logSize, logFile);
|
||||||
|
fclose(logFile);
|
||||||
|
|
||||||
if(refSize > logSize || memcmp(log,ref,refSize))
|
if(refSize > logSize || memcmp(log,ref,refSize))
|
||||||
fail();
|
fail();
|
||||||
|
@ -2157,15 +2162,19 @@ public:
|
||||||
fseek(refFile, 0, SEEK_SET);
|
fseek(refFile, 0, SEEK_SET);
|
||||||
char* ref = new char[refSize];
|
char* ref = new char[refSize];
|
||||||
fread(ref, 1, refSize, refFile);
|
fread(ref, 1, refSize, refFile);
|
||||||
|
fclose(refFile);
|
||||||
|
|
||||||
|
|
||||||
out32.flush();
|
out32.flush();
|
||||||
|
out32.close();
|
||||||
|
|
||||||
FILE *logFile = fopen((name + ".out32").c_str(), "r");
|
FILE *logFile = fopen((name + ".out32").c_str(), "r");
|
||||||
fseek(logFile, 0, SEEK_END);
|
fseek(logFile, 0, SEEK_END);
|
||||||
uint32_t logSize = ftell(logFile);
|
uint32_t logSize = ftell(logFile);
|
||||||
fseek(logFile, 0, SEEK_SET);
|
fseek(logFile, 0, SEEK_SET);
|
||||||
char* log = new char[logSize];
|
char* log = new char[logSize];
|
||||||
fread(log, 1, logSize, logFile);
|
fread(log, 1, logSize, logFile);
|
||||||
|
fclose(logFile);
|
||||||
|
|
||||||
if(refSize > logSize || memcmp(log,ref,refSize))
|
if(refSize > logSize || memcmp(log,ref,refSize))
|
||||||
fail();
|
fail();
|
||||||
|
|
Loading…
Reference in New Issue