TestingSuite: Brought up to date with latest project generation modifications
authorJerome St-Louis <jerome@ecere.com>
Sat, 16 Feb 2013 06:07:00 +0000 (01:07 -0500)
committerJerome St-Louis <jerome@ecere.com>
Sat, 16 Feb 2013 06:07:41 +0000 (01:07 -0500)
testSuite.ec
testSuite.epj

index 4f08ac1..d678b95 100644 (file)
@@ -2,7 +2,6 @@ import "ecere"
 import "EDA"
 import "md5"
 import "Project"
-import "PathBox"
 
 Test dummy; // FIXME ugly hack
 
@@ -82,7 +81,23 @@ void CreateMakefile(String epjPath, String makePath)
    bool valid = true;
    char* configName = null;//"release";
 
-   defaultCompiler = MakeDefaultCompiler("Default", true);
+   if(false) //noGlobalSettings)
+   {
+      defaultCompiler = MakeDefaultCompiler("Default", true);
+      delete ideSettings;
+   }
+   else
+   {
+      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 = ideSettings.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)
@@ -92,7 +107,7 @@ void CreateMakefile(String epjPath, String makePath)
       strlwr(extension);
       if(!strcmp(extension, ProjectExtension))
       {
-         project = LoadProject(epjPath);
+         project = LoadProject(epjPath, "Debug");
          if(project)
          {
             ProjectConfig defaultConfig = null;
@@ -165,7 +180,11 @@ void CreateMakefile(String epjPath, String makePath)
                }
             }
             if(valid)
-               project.GenerateMakefile(makePath, false, "");
+            {
+               project.GenerateCrossPlatformMk();
+               project.GenerateCompilerCf(defaultCompiler);
+               project.GenerateMakefile(makePath, false, null, project.config);
+            }
 
             delete defaultConfig;
             delete project;
@@ -231,7 +250,7 @@ class AccessMacros
    {
       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;
@@ -240,7 +259,7 @@ class AccessMacros
    {
       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;
@@ -251,51 +270,6 @@ class AccessMacros
    }
 }
 
-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";
@@ -317,7 +291,7 @@ class TestSuiteGlobalSettings : GlobalAppSettings
          delete diffTool;
          delete testDB_file;
          GetGlobalValue("Tools","diff", singleString, &diffTool);
-         GetGlobalValue("Tests","list", singleString, $testDB_file);
+         GetGlobalValue("Tests","list", singleString, &testDB_file);
          CloseAndMonitor();
       }
    }
@@ -407,14 +381,16 @@ class BuildTool
       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);
@@ -439,7 +415,7 @@ class BuildTool
    int BuildTest(TestRun run)
    {
       DualPipe makePipe;
-      int makeSuccess;
+      int makeSuccess = -1;
       char makefileOut[MAX_LOCATION];
       char * filePath = run.test.filePath;
       char oldDir[MAX_LOCATION];
@@ -447,11 +423,12 @@ class BuildTool
 
       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];
@@ -463,10 +440,11 @@ class BuildTool
             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];
@@ -478,11 +456,12 @@ class BuildTool
             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)
@@ -491,7 +470,9 @@ class BuildTool
       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())
@@ -932,7 +913,7 @@ class TestSuiteWindow : Window
                   dt.DiffDir(outputsReference, outputsLatest);
                }
             }
-         testListBox.NotifySelect(this, testListBox, testListBox.currentRow, mods);
+            testListBox.NotifySelect(this, testListBox, testListBox.currentRow, mods);
          }
          return true;
       }
@@ -981,3 +962,57 @@ class TestSuiteWindow : Window
 
 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 = 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;
+   }
+
+   bool Init()
+   {
+      settingsContainer.Load();
+      delete settingsContainer;
+      return true;
+   }
+}
index 1b9e69d..c87dd35 100644 (file)
                ]
             },
             "/sdk/extras/md5.ec",
-            "../sdk/ide/src/IDESettings.ec",
-            "../sdk/extras/gui/controls/PathBox.ec",
-            "../sdk/extras/gui/controls/StringsBox.ec",
-            "../sdk/ide/src/OldIDESettings.ec"
+            "../../sdk/ide/src/IDESettings.ec",
+            "../../sdk/extras/gui/controls/StringsBox.ec",
+            "../../sdk/ide/src/OldIDESettings.ec",
+            "../../sdk/extras/types/DynamicString.ec"
          ]
       },
       "testSuite.ec",
@@ -58,6 +58,7 @@
    "ResourcesPath" : "",
    "Resources" : [
       "res/check.png",
-      "res/x.png"
+      "res/x.png",
+      "../../sdk/crossplatform.mk"
    ]
-}
\ No newline at end of file
+}