Changeset 803

Show
Ignore:
Timestamp:
08/10/08 14:55:36 (3 months ago)
Author:
liamstask
Message:

- test the build process

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • mcbuilder/trunk/tests/TestBuilder.cpp

    r802 r803  
    191191  builder->clean(currentProjectPath()); 
    192192  while(builder->state() != QProcess::NotRunning) // wait until the clean is complete 
    193     QTest::qWait(10); 
     193    QTest::qWait(100); 
    194194   
    195195  QVERIFY( errorSpy.count() == 0); // make sure we didn't get any errors 
     
    199199    int exitstatus = finishedSpy.at(i).at(1).toInt(); 
    200200    if( exitcode != 0 || exitstatus != QProcess::NormalExit ) 
    201       QFAIL("clean exited unhappily."); 
    202   } 
     201      QFAIL("make/clean exited unhappily."); 
     202  } 
     203   
     204  QDir projDir(currentProjectPath()); 
     205  QString shortname = projDir.dirName().toLower(); 
     206  projDir.cd("build"); 
     207  QVERIFY(!projDir.exists(shortname + ".bin")); 
     208  QVERIFY(!projDir.exists(shortname + ".elf")); 
     209  QVERIFY(!projDir.exists(shortname + "_o.map")); 
    203210} 
    204211 
    205212void TestBuilder::testBuild( ) 
    206213{ 
    207    
    208 } 
    209  
    210  
     214  QSignalSpy finishedSpy(builder, SIGNAL(finished(int, QProcess::ExitStatus))); 
     215  QSignalSpy errorSpy(builder, SIGNAL(error(QProcess::ProcessError))); 
     216   
     217  builder->build(currentProjectPath()); 
     218  while(builder->state() != QProcess::NotRunning) // wait until the build is complete 
     219    QTest::qWait(100); 
     220   
     221  QVERIFY( errorSpy.count() == 0); // make sure we didn't get any errors 
     222  for( int i = 0; i < finishedSpy.count(); i++ ) 
     223  { 
     224    int exitcode = finishedSpy.at(i).at(0).toInt(); 
     225    int exitstatus = finishedSpy.at(i).at(1).toInt(); 
     226    if( exitcode != 0 || exitstatus != QProcess::NormalExit ) 
     227    { 
     228      qWarning("exit code: %d, exit status: %d", exitcode, exitstatus); 
     229      QFAIL("make/build exited unhappily."); 
     230    } 
     231  } 
     232   
     233  // now let's make sure our .bin and friends are where we expect them 
     234  QDir projDir(currentProjectPath()); 
     235  QString shortname = projDir.dirName().toLower(); 
     236  projDir.cd("build"); 
     237  QVERIFY(projDir.exists(shortname + ".bin")); 
     238  QVERIFY(projDir.exists(shortname + ".elf")); 
     239  QVERIFY(projDir.exists(shortname + "_o.map")); 
     240} 
     241 
     242