Tighten up the config test success checking.
authorMichael Goddard <michael.goddard@nokia.com>
Mon, 25 Jul 2011 00:10:54 +0000 (10:10 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 26 Jul 2011 11:40:07 +0000 (13:40 +0200)
Try a lot harder to remove the old $TARGET output, since make
clean isn't sufficient.  Also fix a bug in program invocation
that was hidden because of the stale files.

Change-Id: I0a365409d81efb74c5836eaf9f129fd9b2cca77e
Reviewed-on: http://codereview.qt.nokia.com/2052
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
bin/qtmodule-configtests

index a5c5899..f6cc205 100755 (executable)
@@ -135,8 +135,7 @@ sub hashesAreDifferent {
 # Returns: The output.
 ######################################################################
 sub executeSomething {
-    my @args = @_;
-    my $program = $args[0];
+    my ($program, @args) = @_;
 
     my $pid = open(KID_TO_READ, "-|");
 
@@ -183,6 +182,10 @@ sub executeTest {
 
     my $testOutDir = catdir($out_basedir, 'config.tests', $testName);
 
+    # Since we might be cross compiling, look for barename (Linux) and .exe (Win32/Symbian)
+    my $testOutFile1 = catfile($testOutDir, "$testName.exe");
+    my $testOutFile2 = catfile($testOutDir, $testName);
+
     if (abs_path($basedir) eq abs_path($out_basedir)) {
         chdir $testOutDir or die "\nUnable to change to config test directory ($testOutDir): $!\n";
     } else { # shadow build
@@ -194,24 +197,24 @@ sub executeTest {
         push (@QMAKEARGS, catdir($basedir, 'config.tests', $testName));
     }
 
-    # Throw it all away
+    # First remove existing stuff (XXX this probably needs generator specific code, but hopefully
+    # the target removal below will suffice)
+    if (-e "Makefile") {
+        executeSomething($MAKE, 'distclean');
+    }
+
+    # and any targets that we might find that weren't distcleaned
+    unlink $testOutFile1, $testOutFile2;
+
+    # Run qmake && make
     executeSomething($QMAKE, @QMAKEARGS);
-    executeSomething($MAKE, 'clean');
     my $makeOutput = executeSomething(($MAKE));
 
     # If make prints "blah blah blah\nSkipped." we consider this a skipped test
     if ($makeOutput !~ qr(^Skipped\.$)ms) {
-
         # Check the test exists (can't reliably execute, especially for cross compilation)
-        if ($^O =~ /win32/i) {
-            # On windows look for $testName.exe
-            if (-e catfile($testOutDir, "$testName.exe")) {
-                $ret = 1;
-            }
-        } else {
-            if (-e catfile($testOutDir, $testName)) {
-                $ret = 1;
-            }
+        if (-e $testOutFile1 or -e $testOutFile2) {
+            $ret = 1;
         }
     } else {
         $ret = 2;