import "EDA"
import "md5"
import "Project"
-import "PathBox"
+
+IDESettings ideSettings;
+
+IDESettingsContainer settingsContainer
+{
+ dataOwner = &ideSettings;
+ dataClass = class(IDESettings);
+};
+
+IDEConfigHolder ideConfig { };
Test dummy; // FIXME ugly hack
{Color {digest[9] , digest[10], digest[11]}, 0.6f},
{Color {digest[12], digest[13], digest[14]}, 0.8f},
{Color {digest[15], digest[0] , digest[1] }, 1.0f}};
-
+
surface.Gradient(keys, 6, 0, horizontal, x+1, y+1, x+34, y+14);
surface.Rectangle(x+1,y+1,x+34,y+14);
}
{
channel.ReadData(digest,16);
}
- property TestRun
+ property TestRun
{
set {
TempFile hashTemp { };
uint size;
MD5_CTX ctx;
MD5Init(&ctx);
- size = hashTemp.GetSize();
+ size = (uint)hashTemp.GetSize();
MD5Update(&ctx, hashTemp.buffer, size);
MD5Final(digest, &ctx);
}
delete files;
}
// TOFIX: When this is commented out, no warning at conversion but conversion not acting as such!!
- get { }
+ get { return 0; }
}
};
bool valid = true;
char* configName = null;//"release";
- defaultCompiler = MakeDefaultCompiler("Default", true);
+ if(false) //noGlobalSettings)
+ {
+ defaultCompiler = MakeDefaultCompiler("Default", true);
+ delete ideSettings;
+ }
+ else
+ {
+ const char * compiler = getenv("COMPILER");
+ if(!compiler) compiler = "Default";
+
+// TODO: Command line option to choose between the two
+// or a command line option to not use global settings
+//defaultCompiler = MakeDefaultCompiler();
+ defaultCompiler = ideConfig.compilers.GetCompilerConfig(compiler);
+// possible TODO: use the workspace to select the active compiler
+// TODO: option to specify compiler name when using global settings
+ }
defaultCompiler.eccCommand = "ecc -nolinenumbers";
if(FileExists(epjPath).isFile)
strlwr(extension);
if(!strcmp(extension, ProjectExtension))
{
- project = LoadProject(epjPath);
+ project = LoadProject(epjPath, "Debug");
if(project)
{
ProjectConfig defaultConfig = null;
if(!releaseConfig)
{
- printf("Error: There are no Project configurations.\n", configName);
+ printf("Error: There are no Project configurations.\n");
valid = false;
- // we don't need to create a config to compile a config-less project, do we?
+ // we don't need to create a config to compile a config-less project, do we?
/*
char targetName[MAX_FILENAME];
GetLastDirectory(epjPath, targetName);
}
}
if(valid)
- project.GenerateMakefile(makePath, false, "");
+ {
+ project.GenerateCrossPlatformMk(null);
+ project.GenerateCompilerCf(defaultCompiler, true);
+ project.GenerateMakefile(makePath, false, null, project.config);
+ }
delete defaultConfig;
delete project;
{
TestRun id "id";
File makeOutput "makeOutput";
- bool makeReturnValue "makeReturnValue";
+ int makeReturnValue "makeReturnValue";
Test test "test";
TimeStamp time "time";
bool save "save";
{
Array<TestRun> runs { };
Row tRow { tbl = dbindex("Runs",testAndTime) };
- for(tRow.Find(dbfield("Runs",test),middle,nil,t); !tRow.nil; tRow.Next())
+ for(tRow.Find(dbfield("Runs",test),middle,nil,t); !tRow.nil; tRow.Find(dbfield("Runs", test), next, nil, t)) //Next())
runs.Add(tRow.sysID);
delete tRow;
return runs;
{
Array<OutputFile> files { };
RowOutputFiles tRow { tbl = dbindex("OutputFiles",run) };
- for(tRow.Find(dbfield("OutputFiles",run),middle,nil,t); !tRow.nil; tRow.Next())
+ for(tRow.Find(dbfield("OutputFiles",run),middle,nil,t); !tRow.nil; tRow.Find(dbfield("OutputFiles", run), next, nil, t)) //tRow.Next())
{
if(t != tRow.run)
break;
}
}
-class TestSuiteApp : GuiApplication
-{
- DataSource ds { driver = /*"SQLite"*/"EDB" };
- TestSuiteApp()
- {
- db = database_open(ds, "TestSuite");
- }
- ~TestSuiteApp()
- {
- Array<OutputFile> files;
- Array<TestRun> runs;
- RowTests tests { };
- RowRuns rRuns { };
- RowOutputFiles rFiles { };
- while(tests.Next())
- {
- Test t = (Test)tests.id;
- runs = AccessMacros::allTestRuns(t);
- for(run : runs)
- {
- if(!run.save)
- {
- if(t.reference == run)
- {
- t.reference = null;
- }
- files = AccessMacros::allOutputFiles(run);
- for(file : files)
- {
- rFiles.sysID=file;
- rFiles.Delete();
- }
- rRuns.sysID=run;
- rRuns.Delete();
- }
- }
- }
- delete tests;
- delete rRuns;
- delete rFiles;
- delete db;
- delete ds;
- }
-}
-
class TestSuiteGlobalSettings : GlobalAppSettings
{
settingsName = "testSuite";
{
Load();
}
- void Load()
+ public SettingsIOResult Load()
{
- if(GlobalAppSettings::Load())
+ SettingsIOResult result = GlobalAppSettings::Load();
+ if(result == success)
{
delete diffTool;
delete testDB_file;
GetGlobalValue("Tools","diff", singleString, &diffTool);
- GetGlobalValue("Tests","list", singleString, $testDB_file);
+ GetGlobalValue("Tests","list", singleString, &testDB_file);
CloseAndMonitor();
}
+ return result;
}
- void Save()
+
+ public SettingsIOResult Save()
{
- if(GlobalAppSettings::Save())
+ SettingsIOResult result = GlobalAppSettings::Save();
+ if(result == success)
{
PutGlobalValue("Tools","diff", singleString, diffTool);
PutGlobalValue("Tests","list", singleString, testDB_file);
CloseAndMonitor();
}
+ return result;
}
}
{
char origDir[MAX_LOCATION];
char newDir[MAX_LOCATION];
-
+
uint Main()
{
DualPipe diff;
{
DeleteFile(flOrig.path);
}
- rmdir(origDir);
+ RemoveDir(origDir);
while(flNew.Find())
{
DeleteFile(flNew.path);
}
- rmdir(newDir);
+ RemoveDir(newDir);
delete diff;
return 0;
}
{
//char origDir[MAX_LOCATION];
//char newDir[MAX_LOCATION];
- char tmpname[MAX_LOCATION];
-
CreateTemporaryDir(origDir, "TestSuiteOrigDir");
CreateTemporaryDir(newDir,"TestSuiteNewDir");
{
int GenerateMakefile(Test t)
{
- DualPipe epj2makePipe;
+ //DualPipe epj2makePipe;
char testFolder[MAX_LOCATION];
char makefileOut[MAX_LOCATION];
char epjName[MAX_LOCATION];
char * filePath = t.filePath;
-
+
+ /*
StripLastDirectory(filePath, testFolder);
PathCat(testFolder, "release");
MakeDir(testFolder);
-
+ */
+
StripLastDirectory(filePath, testFolder);
GetLastDirectory(filePath, epjName);
strcpy(makefileOut, testFolder);
- PathCat(makefileOut, "makefile.test");
-
+ PathCat(makefileOut, "project-testingSuite.Makefile");
+
// epj2makePipe = DualPipeOpenf({ output = true },"epj2make -l /usr/ecere/lib -o %s %s > /dev/null", makefileOut, t.filePath);
//epj2makePipe = DualPipeOpenf({ output = true },"epj2make -cpp cpp -l /usr/ecere/lib -o %s %s", makefileOut, filePath);
//epj2makePipe.Wait();
//return epj2makePipe.GetExitCode();
return 0;
}
-
+
char* Copy2Temp(File f, String tmpPath)
{
File tmp;
tmp = CreateTemporaryFile(tmpFilename, tmpPath);
CopyFile(f, tmp);
tmp.Flush();
- return tmpFilename;
+ return CopyString(tmpFilename);
}
-
+
int BuildTest(TestRun run)
{
DualPipe makePipe;
- int makeSuccess;
+ int makeSuccess = -1;
char makefileOut[MAX_LOCATION];
char * filePath = run.test.filePath;
char oldDir[MAX_LOCATION];
GetWorkingDir(oldDir, sizeof(oldDir));
ChangeWorkingDir(makefileOut);
- PathCat(makefileOut, "makefile.test");
-
+ PathCat(makefileOut, "project-testingSuite.Makefile");
+
//Execute("make -f %s clean", makefileOut);
- makePipe = DualPipeOpenf({ output = true },"make -f %s clean", makefileOut);
+ makePipe = DualPipeOpenf({ output = true },"%s -f %s clean", defaultCompiler.makeCommand, makefileOut);
+ if(makePipe)
{
TempFile f { };
char makeBuffer[1024];
- int size=1024;
uint count;
while(!makePipe.Eof())
{
f.Write(makeBuffer, 1, count);
}
run.makeOutput = f;
+ delete makePipe;
}
- delete makePipe;
- makePipe = DualPipeOpenf({ output = true },"make -f %s", makefileOut);
+ makePipe = DualPipeOpenf({ output = true },"%s -f %s", defaultCompiler.makeCommand, makefileOut);
+ if(makePipe)
{
TempFile f { };
char makeBuffer[1024];
- int size=1024;
uint count;
while(!makePipe.Eof())
{
f.Write(makeBuffer, 1, count);
}
run.makeOutput = f;
+ //makePipe.Wait();
+ ChangeWorkingDir(oldDir);
+ makeSuccess = makePipe.GetExitCode();
+ run.makeReturnValue = makeSuccess;
+ delete makePipe;
}
- //makePipe.Wait();
- ChangeWorkingDir(oldDir);
- makeSuccess = makePipe.GetExitCode();
- run.makeReturnValue = makeSuccess;
return makeSuccess;
}
void AddOutputFiles(TestRun run)
FileListing fl;
char * filePath = run.test.filePath;
StripLastDirectory(filePath, testFolder);
- PathCat(testFolder, "release");
-
+
+ // TODO: Get from config
+ PathCat(testFolder, "obj/release.win32");
+
fl = { testFolder, extensions = "c, ec, sym, imp" }; // ["c", "ec", "sym", "imp"] perhaps?
while(fl.Find())
{
char extension[MAX_LOCATION];
DateTime rightNow { };
f = FileOpen(fl.path, read);
-
+
of.Add();
of.id = of.sysID;
of.outputFile = f;
uint count = input.Read(buffer, 1, sizeof(buffer));
if(count)
{
- int yo = output.Write(buffer, 1, count);
+ output.Write(buffer, 1, count);
}
}
}
class RelativeTimeStamp : TimeStamp
{
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
int64 count;
int days;
- String units;
+ const String units;
DateTime dt { };
TimeStamp rightNow;
dt.GetLocalTime();
success, failure;
void OnDisplay(Surface surface,
int x, int y, int width,
- TrumpDialog trumpDialog,
+ void * unused,
Alignment alignment,
DataDisplayFlags flags)
{
BitmapResource makeSuccess { ":check.png" , window = this };
BitmapResource makeFailure { ":x.png", window = this };
-
+
TestSuiteWindow()
{
testListBox.AddField(fieldName);
testListBox.AddField(fieldActive);
-
+
runsListBox.AddField(fieldBuildStatus);
runsListBox.AddField(fieldAuraColor);
runsListBox.AddField(fieldRun);
}
};
- void NewTest(RowTests tRow, char* testName, char* testFilePath)
+ void NewTest(RowTests tRow, const char * testName, const char * testFilePath)
{
tRow.Add();
tRow.id = tRow.sysID;
{
// do we also delete all runs and files associated with this test?
RowTests tRow { };
- tRow.sysID=row.tag;
+ tRow.sysID=(uint)row.tag;
tRow.Delete();
delete tRow; // won't be needed in the (distant?) future :-)
testListBox.DeleteRow(row);
}
delete tRow;
}
-
+
DataField fieldName { width = 140, header = "Name" , dataType = class(char*), editable = true };
DataField fieldActive { width = 40, header = "Active", dataType = class(bool) };
bool NotifyChanged(ListBox testListBox, DataRow row)
{
RowTests tRow { };
- tRow.sysID=row.tag;
+ tRow.sysID=(uint)row.tag;
tRow.name = row.GetData(fieldName);
tRow.active = row.GetData(fieldActive);
delete tRow;
{ // show test runs
Test t;
Array<TestRun> runs;
- AccessMacros amacs{ };
t = (Test)row.tag;
- runs = amacs.allTestRuns(t);
+ runs = AccessMacros::allTestRuns(t);
runsListBox.Clear();
for(tr : runs)
{
return true;
}
};
-
+
DataField fieldBuildStatus { width = 40, dataType = class(BuildStatus), header = "Make" };
DataField fieldAuraColor { width = 40, dataType = class(MD5Digest), header = "Aura" };
DataField fieldRun { width = 120, dataType = class(RelativeTimeStamp), header = "Run" };
{
testListBox.SelectRow(row);
}
- }
+ }
}
delete f;
//Refocus();
else
{
BuildTool bt { };
- DiffThread dt { };
DateTime rightNow { };
RowRuns runs { };
TestRun run;
dt.DiffDir(outputsReference, outputsLatest);
}
}
- testListBox.NotifySelect(this, testListBox, testListBox.currentRow, mods);
+ testListBox.NotifySelect(this, testListBox, testListBox.currentRow, mods);
}
return true;
}
}
return true;
}
- }
+ };
+
bool OnCreate()
{
globalSettings.Load();
TestSuiteWindow theTestSuiteWindow { };
TestSuiteGlobalSettings theGlobalSettings { };
+
+class TestSuiteApp : GuiApplication
+{
+ DataSource ds { driver = /*"SQLite" */"EDB" };
+ TestSuiteApp()
+ {
+ //File f { };
+ //f.OnSerialize(0);
+ db = database_open(ds, "TestSuite");
+ }
+ ~TestSuiteApp()
+ {
+ Array<OutputFile> files;
+ Array<TestRun> runs;
+ RowTests tests { };
+ RowRuns rRuns { };
+ RowOutputFiles rFiles { };
+ while(tests.Next())
+ {
+ Test t = (Test)tests.id;
+ runs = AccessMacros::allTestRuns(t);
+ for(run : runs)
+ {
+ if(!run.save)
+ {
+ if(t.reference == run)
+ t.reference = 0;
+ files = AccessMacros::allOutputFiles(run);
+ for(file : files)
+ {
+ rFiles.sysID=file;
+ rFiles.Delete();
+ }
+ rRuns.sysID=run;
+ rRuns.Delete();
+ }
+ }
+ }
+ delete tests;
+ delete rRuns;
+ delete rFiles;
+ delete db;
+ delete ds;
+ }
+
+ bool Init()
+ {
+ settingsContainer.Load();
+ ideConfig.compilers.read(settingsContainer);
+ delete settingsContainer;
+ return true;
+ }
+}