Changeset 799

Show
Ignore:
Timestamp:
08/09/08 21:44:20 (3 months ago)
Author:
liamstask
Message:

- a few tests for the Builder class: creating a Makefile properly and loading in the requisite libraries
- update the AinToServo? example's project file format

Location:
mcbuilder/trunk
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • mcbuilder/trunk/include/Builder.h

    r721 r799  
    2626#include "BuildLog.h" 
    2727 
     28#ifdef MCBUILDER_TEST_SUITE 
     29#include "TestBuilder.h" 
     30#endif 
     31 
    2832class MainWindow; 
    2933class ProjectInfo; 
     
    3236{ 
    3337  Q_OBJECT 
     38   
     39  #ifdef MCBUILDER_TEST_SUITE 
     40  friend class TestBuilder; 
     41  #endif 
     42   
    3443public: 
    35   Builder(MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog); 
     44  Builder( MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog ); 
    3645  void build(QString projectName); 
    3746  void clean(QString projectName); 
     
    6372  bool matchInFunction(QString msg); 
    6473  bool matchUndefinedRef(QString msg); 
    65   void ensureBuildDirExists(QString projPath); 
     74  QString ensureBuildDirExists(QString projPath); 
    6675  bool parseVersionNumber( int *maj, int *min, int *bld ); 
    67   void loadDependencies(QString project); 
     76  void loadDependencies(QString libsDir, QString project); 
    6877  void getLibrarySources(QString libdir, QStringList *thmb, QStringList *arm); 
    6978  QString filteredPath(QString path); 
  • mcbuilder/trunk/include/MainWindow.h

    r730 r799  
    3434#include "BuildLog.h" 
    3535#include "ProjectManager.h" 
     36 
     37#ifdef MCBUILDER_TEST_SUITE 
     38#include "TestBuilder.h" 
     39#endif 
    3640 
    3741class Preferences; 
     
    136140  void onUpdate(); 
    137141  void onVisitForum(); 
     142   
     143  #ifdef MCBUILDER_TEST_SUITE 
     144  friend class TestBuilder; 
     145  #endif 
    138146}; 
    139147 
  • mcbuilder/trunk/mcbuilder.pro

    r798 r799  
    9898 
    9999test_suite { 
    100   TARGET = mcbuilder_test 
    101   DEFINES += MCBUILDER_TEST_SUITE 
    102   CONFIG += qtestlib 
    103   CONFIG -= release # always, no matter what it's set to above 
    104   DESTDIR = tests 
     100  TARGET       = mcbuilder_test 
     101  DEFINES     += MCBUILDER_TEST_SUITE 
     102  CONFIG      += qtestlib 
     103  CONFIG      -= release # always, no matter what it's set to above 
     104  DESTDIR      = tests 
    105105  INCLUDEPATH += tests 
    106106   
    107   SOURCES -= src/main.cpp 
     107  SOURCES -=  src/main.cpp 
    108108   
    109109  SOURCES +=  tests/main.cpp \ 
  • mcbuilder/trunk/resources/examples/Input-Output/AinToServo/AinToServo.xml

    r728 r799  
    1616  Most normal files are THUMB, while ISRs and startup code are usually ARM.  --> 
    1717  <files> 
    18     <file type="thumb" >resources/cores/makecontroller/freertos/tasks.c</file> 
    19     <file type="thumb" >resources/cores/makecontroller/freertos/queue.c</file> 
    20     <file type="thumb" >resources/cores/makecontroller/freertos/list.c</file> 
    21     <file type="thumb" >resources/cores/makecontroller/freertos/portable/GCC/ARM7_AT91SAM7S/port.c</file> 
    22     <file type="thumb" >resources/cores/makecontroller/startup/extras.c</file> 
    23     <file type="thumb" >resources/cores/makecontroller/freertos/portable/MemMang/heap_2.c</file> 
    24     <file type="thumb" >resources/cores/makecontroller/makingthings/main.c</file> 
    25     <file type="thumb" >resources/cores/makecontroller/makingthings/eeprom.c</file> 
    26     <file type="thumb" >resources/cores/makecontroller/makingthings/analogin.c</file> 
    27     <file type="thumb" >resources/cores/makecontroller/makingthings/serial.c</file> 
    28     <file type="thumb" >resources/cores/makecontroller/makingthings/pwm.c</file> 
    29     <file type="thumb" >resources/cores/makecontroller/makingthings/spi.c</file> 
    30     <file type="thumb" >resources/cores/makecontroller/makingthings/USB-CDC.c</file> 
    31     <file type="thumb" >resources/cores/makecontroller/makingthings/rtos.c</file> 
    32     <file type="thumb" >resources/cores/makecontroller/makingthings/usb.c</file> 
    33     <file type="thumb" >resources/cores/makecontroller/makingthings/network.c</file> 
    34     <file type="thumb" >resources/cores/makecontroller/makingthings/system.c</file> 
    35     <file type="thumb" >resources/cores/makecontroller/makingthings/io.c</file> 
    36     <file type="thumb" >resources/cores/makecontroller/makingthings/led.c</file> 
    37     <file type="thumb" >resources/cores/makecontroller/makingthings/timer.c</file> 
    38     <file type="thumb" >resources/cores/makecontroller/makingthings/fasttimer.c</file> 
    39     <file type="thumb" >resources/cores/makecontroller/makingthings/debugosc.c</file> 
    40     <file type="thumb" >resources/cores/makecontroller/makingthings/can.c</file> 
    41     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/tcp_out.c</file> 
    42     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/inet.c</file> 
    43     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/mem.c</file> 
    44     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/memp.c</file> 
    45     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/netif.c</file> 
    46     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/pbuf.c</file> 
    47     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/raw.c</file> 
    48     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/stats.c</file> 
    49     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/sys.c</file> 
    50     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/tcp.c</file> 
    51     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/tcp_in.c</file> 
    52     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/ipv4/ip.c</file> 
    53     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/ipv4/ip_addr.c</file> 
    54     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/ipv4/icmp.c</file> 
    55     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/dhcp.c</file> 
    56     <file type="thumb" >resources/cores/makecontroller/lwip/src/api/tcpip.c</file> 
    57     <file type="thumb" >resources/cores/makecontroller/lwip/src/api/api_msg.c</file> 
    58     <file type="thumb" >resources/cores/makecontroller/lwip/src/api/err.c</file> 
    59     <file type="thumb" >resources/cores/makecontroller/lwip/src/api/api_lib.c</file> 
    60     <file type="thumb" >resources/cores/makecontroller/lwip/src/netif/etharp.c</file> 
    61     <file type="thumb" >resources/cores/makecontroller/lwip/contrib/port/FreeRTOS/AT91SAM7X/sys_arch.c</file> 
    62     <file type="thumb" >resources/cores/makecontroller/lwip/src/netif/ethernetif.c</file> 
    63     <file type="thumb" >resources/cores/makecontroller/makingthings/SAM7_EMAC.c</file> 
    64     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/udp.c</file> 
    65     <file type="thumb" >resources/cores/makecontroller/lwip/src/core/ipv4/ip_frag.c</file> 
    66     <file type="thumb" >resources/cores/makecontroller/makingthings/osc.c</file> 
    67     <file type="thumb" >resources/cores/makecontroller/makingthings/osc_patternmatch.c</file> 
    68     <file type="arm" >resources/cores/makecontroller/freertos/portable/GCC/ARM7_AT91SAM7S/portISR.c</file> 
    69     <file type="arm" >resources/cores/makecontroller/makingthings/SAM7_EMAC_ISR.c</file> 
    70     <file type="arm" >resources/cores/makecontroller/makingthings/USBIsr.c</file> 
    71     <file type="arm" >resources/cores/makecontroller/startup/Cstartup_SAM7.c</file> 
    72     <file type="arm" >resources/cores/makecontroller/makingthings/analogin_isr.c</file> 
    73     <file type="arm" >resources/cores/makecontroller/makingthings/fasttimer_isr.c</file> 
    74     <file type="arm" >resources/cores/makecontroller/makingthings/serial_isr.c</file> 
    75     <file type="arm" >resources/cores/makecontroller/makingthings/timer_isr.c</file> 
    76     <file type="arm" >resources/cores/makecontroller/makingthings/can_isr.c</file> 
     18    <file type="thumb" >cores/makecontroller/core/freertos/tasks.c</file> 
     19    <file type="thumb" >cores/makecontroller/core/freertos/queue.c</file> 
     20    <file type="thumb" >cores/makecontroller/core/freertos/list.c</file> 
     21    <file type="thumb" >cores/makecontroller/core/freertos/portable/GCC/ARM7_AT91SAM7S/port.c</file> 
     22    <file type="thumb" >cores/makecontroller/core/startup/extras.c</file> 
     23    <file type="thumb" >cores/makecontroller/core/freertos/portable/MemMang/heap_2.c</file> 
     24    <file type="thumb" >cores/makecontroller/core/makingthings/main.c</file> 
     25    <file type="thumb" >cores/makecontroller/core/makingthings/eeprom.c</file> 
     26    <file type="thumb" >cores/makecontroller/core/makingthings/analogin.c</file> 
     27    <file type="thumb" >cores/makecontroller/core/makingthings/serial.c</file> 
     28    <file type="thumb" >cores/makecontroller/core/makingthings/pwm.c</file> 
     29    <file type="thumb" >cores/makecontroller/core/makingthings/spi.c</file> 
     30    <file type="thumb" >cores/makecontroller/core/makingthings/USB-CDC.c</file> 
     31    <file type="thumb" >cores/makecontroller/core/makingthings/rtos.c</file> 
     32    <file type="thumb" >cores/makecontroller/core/makingthings/usb.c</file> 
     33    <file type="thumb" >cores/makecontroller/core/makingthings/network.c</file> 
     34    <file type="thumb" >cores/makecontroller/core/makingthings/system.c</file> 
     35    <file type="thumb" >cores/makecontroller/core/makingthings/io.c</file> 
     36    <file type="thumb" >cores/makecontroller/core/makingthings/led.c</file> 
     37    <file type="thumb" >cores/makecontroller/core/makingthings/timer.c</file> 
     38    <file type="thumb" >cores/makecontroller/core/makingthings/fasttimer.c</file> 
     39    <file type="thumb" >cores/makecontroller/core/makingthings/debugosc.c</file> 
     40    <file type="thumb" >cores/makecontroller/core/lwip/src/core/tcp_out.c</file> 
     41    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/inet.c</file> 
     42    <file type="thumb" >cores/makecontroller/core/lwip/src/core/mem.c</file> 
     43    <file type="thumb" >cores/makecontroller/core/lwip/src/core/memp.c</file> 
     44    <file type="thumb" >cores/makecontroller/core/lwip/src/core/netif.c</file> 
     45    <file type="thumb" >cores/makecontroller/core/lwip/src/core/pbuf.c</file> 
     46    <file type="thumb" >cores/makecontroller/core/lwip/src/core/raw.c</file> 
     47    <file type="thumb" >cores/makecontroller/core/lwip/src/core/stats.c</file> 
     48    <file type="thumb" >cores/makecontroller/core/lwip/src/core/sys.c</file> 
     49    <file type="thumb" >cores/makecontroller/core/lwip/src/core/tcp.c</file> 
     50    <file type="thumb" >cores/makecontroller/core/lwip/src/core/tcp_in.c</file> 
     51    <file type="thumb" >cores/makecontroller/core/lwip/src/core/init.c</file> 
     52    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/ip.c</file> 
     53    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/ip_addr.c</file> 
     54    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/icmp.c</file> 
     55    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/inet_chksum.c</file> 
     56    <file type="thumb" >cores/makecontroller/core/lwip/src/core/dhcp.c</file> 
     57    <file type="thumb" >cores/makecontroller/core/lwip/src/core/dns.c</file> 
     58    <file type="thumb" >cores/makecontroller/core/lwip/src/api/tcpip.c</file> 
     59    <file type="thumb" >cores/makecontroller/core/lwip/src/api/api_msg.c</file> 
     60    <file type="thumb" >cores/makecontroller/core/lwip/src/api/err.c</file> 
     61    <file type="thumb" >cores/makecontroller/core/lwip/src/api/api_lib.c</file> 
     62    <file type="thumb" >cores/makecontroller/core/lwip/src/netif/etharp.c</file> 
     63    <file type="thumb" >cores/makecontroller/core/lwip/contrib/port/FreeRTOS/AT91SAM7X/sys_arch.c</file> 
     64    <file type="thumb" >cores/makecontroller/core/lwip/src/netif/ethernetif.c</file> 
     65    <file type="thumb" >cores/makecontroller/core/makingthings/SAM7_EMAC.c</file> 
     66    <file type="thumb" >cores/makecontroller/core/lwip/src/core/udp.c</file> 
     67    <file type="thumb" >cores/makecontroller/core/lwip/src/core/ipv4/ip_frag.c</file> 
     68    <file type="thumb" >cores/makecontroller/core/makingthings/osc.c</file> 
     69    <file type="thumb" >cores/makecontroller/core/makingthings/osc_patternmatch.c</file> 
     70    <file type="arm" >cores/makecontroller/core/freertos/portable/GCC/ARM7_AT91SAM7S/portISR.c</file> 
     71    <file type="arm" >cores/makecontroller/core/makingthings/SAM7_EMAC_ISR.c</file> 
     72    <file type="arm" >cores/makecontroller/core/makingthings/USBIsr.c</file> 
     73    <file type="arm" >cores/makecontroller/core/startup/Cstartup_SAM7.c</file> 
     74    <file type="arm" >cores/makecontroller/core/makingthings/analogin_isr.c</file> 
     75    <file type="arm" >cores/makecontroller/core/makingthings/fasttimer_isr.c</file> 
     76    <file type="arm" >cores/makecontroller/core/makingthings/serial_isr.c</file> 
     77    <file type="arm" >cores/makecontroller/core/makingthings/timer_isr.c</file> 
    7778    <file type="thumb" >AinToServo.c</file> 
    7879  </files> 
    7980  <!-- Directories to include in the build process --> 
    8081  <include_dirs> 
    81     <dir>resources/cores/makecontroller/makingthings</dir> 
    82     <dir>resources/cores/makecontroller/lwip/src/include</dir> 
    83     <dir>resources/cores/makecontroller/lwip/contrib/port/FreeRTOS/AT91SAM7X</dir> 
    84     <dir>resources/cores/makecontroller/freertos/include</dir> 
    85     <dir>resources/cores/makecontroller/freertos/portable/GCC/ARM7_AT91SAM7S</dir> 
    86     <dir>resources/cores/makecontroller/lwip/src/include/ipv4</dir> 
     82    <dir>cores/makecontroller/core/makingthings</dir> 
     83    <dir>cores/makecontroller/core/lwip/src/include</dir> 
     84    <dir>cores/makecontroller/core/lwip/contrib/port/FreeRTOS/AT91SAM7X</dir> 
     85    <dir>cores/makecontroller/core/freertos/include</dir> 
     86    <dir>cores/makecontroller/core/freertos/portable/GCC/ARM7_AT91SAM7S</dir> 
     87    <dir>cores/makecontroller/core/lwip/src/include/ipv4</dir> 
    8788  </include_dirs> 
    8889</project> 
  • mcbuilder/trunk/src/Builder.cpp

    r797 r799  
    2323#include "ConsoleItem.h" 
    2424 
     25#define LIBRARIES_DIR "cores/makecontroller/libraries" 
     26 
    2527/* 
    2628  Builder takes a project and turns it into a binary executable. 
     
    2830  and Properties for this project. 
    2931*/ 
    30 Builder::Builder(MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog) : QProcess( 0 ) 
     32Builder::Builder( MainWindow *mainWindow, ProjectInfo *projInfo, BuildLog *buildLog ) : QProcess( 0 ) 
    3133{ 
    3234  this->mainWindow = mainWindow; 
    3335  this->projInfo = projInfo; 
    3436  this->buildLog = buildLog; 
     37   
    3538  connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(filterOutput())); 
    3639  connect(this, SIGNAL(readyReadStandardError()), this, SLOT(filterErrorOutput())); 
     
    5457  } 
    5558  currentProjectPath = projectName; 
    56   ensureBuildDirExists(currentProjectPath);  // make sure we have a build dir 
    5759  setWorkingDirectory(QDir(currentProjectPath).filePath("build")); 
    58   loadDependencies(currentProjectPath);      // this loads up the list of libraries this project depends on 
     60  loadDependencies(LIBRARIES_DIR, currentProjectPath);      // this loads up the list of libraries this project depends on 
    5961  createMakefile(currentProjectPath);        // create a Makefile for this project, given the dependencies 
    6062  createConfigFile(currentProjectPath);      // create a config file based on the Properties for this project 
     
    107109/* 
    108110  If there's no build directory within a project, create one. 
    109 */ 
    110 void Builder::ensureBuildDirExists(QString projPath) 
     111  Return the build dir's path. 
     112*/ 
     113QString Builder::ensureBuildDirExists(QString projPath) 
    111114{ 
    112115  QDir dir(projPath); 
    113116  if(!dir.exists("build")) 
    114117    dir.mkdir("build"); 
     118  return dir.filePath("build"); 
    115119} 
    116120 
     
    184188{ 
    185189  bool retval = true; 
    186   QDir buildDir(projectPath + "/build"); 
     190  QDir buildDir( ensureBuildDirExists(projectPath) ); 
    187191  QFile makefile(buildDir.filePath("Makefile")); 
    188192  if(makefile.open(QIODevice::WriteOnly | QFile::Text)) 
     
    250254           
    251255          // add in the directories for the required libraries 
    252           QDir libdir(QDir::current().filePath("cores/makecontroller/libraries")); 
     256          QDir libdir(QDir::current().filePath(LIBRARIES_DIR)); 
    253257          foreach(Library lib, libraries) 
    254258            tofile << "  -I" << filteredPath(libdir.filePath(lib.name)) << " \\" << endl; 
     
    484488      while(!outline.isNull()) 
    485489      { 
    486         qDebug("msg: %s", qPrintable(outline)); 
     490        //qDebug("msg: %s", qPrintable(outline)); 
    487491        QStringList sl = outline.split(" "); 
    488492        if(sl.first().endsWith("arm-elf-gcc") && sl.at(1) == "-c") 
     
    522526      while(!outline.isNull()) 
    523527      { 
    524         qDebug("err: %s", qPrintable(outline)); 
     528        //qDebug("err: %s", qPrintable(outline)); 
    525529        QString line = outline; 
    526530        outline = outstream.readLine(); 
     
    648652  Create a Library structure for each library and store it in our class member "libraries" 
    649653*/ 
    650 void Builder::loadDependencies(QString project) 
     654void Builder::loadDependencies(QString libsDir, QString project) 
    651655{ 
    652656  QDir projDir(project); 
    653657  QStringList srcFiles = projDir.entryList(QStringList() << "*.c" << "*.h"); 
    654   QDir libDir(QDir::current().filePath("cores/makecontroller/libraries")); 
     658  QDir libDir(QDir::current().filePath(libsDir)); 
    655659  QStringList libDirs = libDir.entryList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot); 
    656660   
  • mcbuilder/trunk/tests/TestBuilder.cpp

    r798 r799  
     1/********************************************************************************* 
    12 
     3 Copyright 2008 MakingThings 
     4 
     5 Licensed under the Apache License,  
     6 Version 2.0 (the "License"); you may not use this file except in compliance  
     7 with the License. You may obtain a copy of the License at 
     8 
     9 http://www.apache.org/licenses/LICENSE-2.0  
     10  
     11 Unless required by applicable law or agreed to in writing, software distributed 
     12 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
     13 CONDITIONS OF ANY KIND, either express or implied. See the License for 
     14 the specific language governing permissions and limitations under the License. 
     15 
     16*********************************************************************************/ 
    217 
    318#include "TestBuilder.h" 
     19#include "ProjectInfo.h" 
    420 
     21#define TEST_PROJECT "resources/examples/Input-Output/AinToServo" 
     22 
     23TestBuilder::TestBuilder( MainWindow* window ) 
     24{ 
     25  this->window = window; 
     26} 
     27 
     28/* 
     29 util - get the "current" project...just our test project. 
     30*/ 
     31QString TestBuilder::currentProjectPath() 
     32{ 
     33  QDir proj = QDir::current().filePath(TEST_PROJECT); 
     34  return proj.path(); 
     35} 
     36 
     37/* 
     38  This is run before any other tests. 
     39*/ 
    540void TestBuilder::initTestCase() 
    641{ 
     42  builder = window->builder; 
     43  builder->currentProjectPath = currentProjectPath(); 
     44} 
     45 
     46/* 
     47  Take an example project and load its libraries. 
     48  Make sure the appropriate libraries are loaded, no more, no less. 
     49*/ 
     50void TestBuilder::loadLibs() 
     51{ 
     52  // change the path to libraries if you need to for your setup...not sure how best to automatically do that 
     53  QDir libDir = QDir::current().filePath("build/Debug/cores/makecontroller/libraries"); 
     54  builder->loadDependencies(libDir.path(), currentProjectPath()); 
     55  QList<Builder::Library> libs = builder->libraries; 
     56  // the AinToServo example only pulls in one library, servo 
     57  QVERIFY(libs.size() == 1); 
     58  QVERIFY(libs.at(0).name == QString("servo")); 
     59  // only expect there to be one thumb src file - servo.c 
     60  QVERIFY(libs.at(0).thumb_src.size() == 1); 
     61  QVERIFY(libs.at(0).arm_src.size() == 0); 
     62} 
     63 
     64/* 
     65  Create a Makefile and verify that all the files in the project file are included, 
     66  the appropriate include dirs are there, taking into account any loaded libraries. 
     67*/ 
     68void TestBuilder::testMakefile() 
     69{ 
     70  builder->createMakefile(currentProjectPath()); 
     71  QDir projDir(currentProjectPath()); 
     72  QFile makefile(projDir.filePath("build/Makefile")); 
     73  QVERIFY(makefile.exists()); 
    774   
     75  QStringList projectFiles; // a list of all the files in the project file 
     76  QFile projectFile(projDir.filePath(projDir.dirName() + ".xml")); 
     77  QDomDocument projectDoc; 
     78  if(projectDoc.setContent(&projectFile)) // read the project file and extract all the file paths 
     79  { 
     80    QDomNodeList files = projectDoc.elementsByTagName("files").at(0).childNodes(); 
     81    for(int i = 0; i < files.count(); i++) 
     82      projectFiles.append(builder->filteredPath(files.at(i).toElement().text())); 
     83  } 
     84  QVERIFY(projectFiles.size()); // make sure we got something 
     85   
     86  QStringList makeFiles; // list of files in the Makefile 
     87  QVERIFY(makefile.open(QFile::ReadOnly | QFile::Text)); 
     88  QTextStream in(&makefile); 
     89  QString makeLine = in.readLine(); 
     90  static const int BEGIN = 0; 
     91  static const int FILES = 1; 
     92  int state = BEGIN; 
     93  while(!makeLine.isNull()) 
     94  { 
     95    switch(state) 
     96    { 
     97      case BEGIN: 
     98        if(makeLine.startsWith("THUMB_SRC") ) 
     99          state = FILES; 
     100        break; 
     101      case FILES: 
     102        if(makeLine.startsWith("INCLUDEDIRS")) 
     103          state = BEGIN; 
     104        else 
     105        { 
     106          if(!makeLine.isEmpty() && !makeLine.startsWith("ARM_SRC")) 
     107            makeFiles.append(makeLine.remove("\\").trimmed()); 
     108        } 
     109        break; 
     110    } 
     111    makeLine = in.readLine(); 
     112  } 
     113  QVERIFY(makeFiles.size()); // make sure we got something 
     114   
     115  // now, let's compare our lists 
     116  // it's possible (probable) that the list of files in the makefiles list will be 
     117  // longer since it will have libraries files added as part of the build process 
     118  // that are not included in the project file. 
     119  int matches = 0; 
     120  int libraryFiles = 0; 
     121  foreach(QString file, makeFiles) 
     122  { 
     123    if(projectFiles.contains(file)) 
     124      matches++; 
     125    else if(file.contains("cores/makecontroller/libraries")) 
     126      libraryFiles++; 
     127  } 
     128  //qDebug("makefiles: %d, projectfiles: %d, matches: %d", makeFiles.size(), projectFiles.size(), matches); 
     129  QVERIFY( matches == (makeFiles.size() - libraryFiles)); 
    8130} 
    9131 
    10132 
    11  
  • mcbuilder/trunk/tests/TestBuilder.h

    r798 r799  
     1/********************************************************************************* 
     2 
     3 Copyright 2008 MakingThings 
     4 
     5 Licensed under the Apache License,  
     6 Version 2.0 (the "License"); you may not use this file except in compliance  
     7 with the License. You may obtain a copy of the License at 
     8 
     9 http://www.apache.org/licenses/LICENSE-2.0  
     10  
     11 Unless required by applicable law or agreed to in writing, software distributed 
     12 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
     13 CONDITIONS OF ANY KIND, either express or implied. See the License for 
     14 the specific language governing permissions and limitations under the License. 
     15 
     16*********************************************************************************/ 
     17 
     18#ifndef TEST_BUILDER_H 
     19#define TEST_BUILDER_H 
    120 
    221#include <QtTest/QtTest> 
     22#include "MainWindow.h" 
    323#include "Builder.h" 
     24 
     25class Builder; 
    426 
    527/* 
     
    1032  Q_OBJECT 
    1133   
     34public: 
     35  TestBuilder( MainWindow* window ); 
     36  QString currentProjectPath(); 
     37   
    1238private: 
    1339  Builder* builder; 
     40  MainWindow* window; 
    1441 
    1542private slots: 
    1643  void initTestCase(); 
     44  void loadLibs(); 
     45  void testMakefile(); 
    1746}; 
     47 
     48#endif // TEST_BUILDER_H 
    1849 
    1950 
     
    2253 
    2354 
    24  
    25  
  • mcbuilder/trunk/tests/TestProjectManager.cpp

    r798 r799  
    1  
     1/********************************************************************************* 
     2 
     3 Copyright 2008 MakingThings 
     4 
     5 Licensed under the Apache License,  
     6 Version 2.0 (the "License"); you may not use this file except in compliance  
     7 with the License. You may obtain a copy of the License at 
     8 
     9 http://www.apache.org/licenses/LICENSE-2.0  
     10  
     11 Unless required by applicable law or agreed to in writing, software distributed 
     12 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
     13 CONDITIONS OF ANY KIND, either express or implied. See the License for 
     14 the specific language governing permissions and limitations under the License. 
     15 
     16*********************************************************************************/ 
    217 
    318#include "TestProjectManager.h" 
  • mcbuilder/trunk/tests/TestProjectManager.h

    r798 r799  
     1/********************************************************************************* 
    12 
     3 Copyright 2008 MakingThings 
     4 
     5 Licensed under the Apache License,  
     6 Version 2.0 (the "License"); you may not use this file except in compliance  
     7 with the License. You may obtain a copy of the License at 
     8 
     9 http://www.apache.org/licenses/LICENSE-2.0  
     10  
     11 Unless required by applicable law or agreed to in writing, software distributed 
     12 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
     13 CONDITIONS OF ANY KIND, either express or implied. See the License for 
     14 the specific language governing permissions and limitations under the License. 
     15 
     16*********************************************************************************/ 
     17 
     18#ifndef TEST_PROJECT_MANAGER_H 
     19#define TEST_PROJECT_MANAGER_H 
    220 
    321 
     
    3351}; 
    3452 
     53#endif // TEST_PROJECT_MANAGER_H 
    3554 
    3655 
  • mcbuilder/trunk/tests/main.cpp

    r798 r799  
     1/********************************************************************************* 
    12 
     3 Copyright 2008 MakingThings 
     4 
     5 Licensed under the Apache License,  
     6 Version 2.0 (the "License"); you may not use this file except in compliance  
     7 with the License. You may obtain a copy of the License at 
     8 
     9 http://www.apache.org/licenses/LICENSE-2.0  
     10  
     11 Unless required by applicable law or agreed to in writing, software distributed 
     12 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
     13 CONDITIONS OF ANY KIND, either express or implied. See the License for 
     14 the specific language governing permissions and limitations under the License. 
     15 
     16*********************************************************************************/ 
    217 
    318#include <QtTest/QtTest> 
     19#include <QApplication> 
     20#include "MainWindow.h" 
    421#include "TestProjectManager.h" 
    522#include "TestBuilder.h" 
    623 
    7 int main(int argc, char** argv) 
     24/* 
     25  A test suite that fires off each unit test in succession. 
     26*/ 
     27int main(int argc, char* argv[]) 
    828 
    929  (void)argc; 
    1030  (void)argv; 
     31  QApplication app(argc, argv); 
     32  MainWindow window; 
    1133   
    1234  TestProjectManager testProjectManager; 
    1335  QTest::qExec(&testProjectManager); 
    1436   
    15   TestBuilder testBuilder; 
     37  TestBuilder testBuilder(&window); 
    1638  QTest::qExec(&testBuilder); 
    1739}