Revert "Fixed qtmodule-configtests on Windows"

This reverts commit bb4caf3c4937418ca0e33d60cf0b25d6cfc3ea95

Change-Id: I25a9e45c9fa0953bdfe1bc112bf45341802c020d
Reviewed-by: Jyri Tahtela <jyri.tahtela@nokia.com>
This commit is contained in:
Kalle Lehtonen 2012-01-13 02:44:25 +01:00 committed by Qt by Nokia
parent fa07815892
commit 1c53694a17

View File

@ -76,9 +76,7 @@ my $generator = $ARGV[3];
our %configtests; our %configtests;
my $absOutDir = abs_path($out_basedir); my $qmakeCachePath = catfile($out_basedir, ".qmake.cache");
my $qmakeCachePath = catfile($absOutDir, '.qmake.cache');
my $configLogPath = catfile($absOutDir, 'config.log');
my $QMAKE = catfile($qtbasedir, "bin", ($^O =~ /win32/i) ? 'qmake.exe' : 'qmake'); my $QMAKE = catfile($qtbasedir, "bin", ($^O =~ /win32/i) ? 'qmake.exe' : 'qmake');
if (!-x $QMAKE) { if (!-x $QMAKE) {
@ -164,36 +162,36 @@ sub hashesAreDifferent {
} }
} }
###################################################################### ######################################################################
# Syntax: executeLoggedCommand() # Syntax: executeSomething
# Params: path to executable, arguments # Params: A list of things.
# #
# This function is equivalent to system(), except that the command # Purpose: Executes the first arg, passing the list.
# details and output is placed in the configure log (only). # stderr is redirected to stdout, and the output is captured.
# # Returns: The output.
# Purpose: run a command and log the output
# Returns: exit status (as returned by system())
###################################################################### ######################################################################
sub executeLoggedCommand { sub executeSomething {
my (@command_with_args) = @_; my ($program, @args) = @_;
# Redirect all stdout, stderr into the config.log my $pid = open(KID_TO_READ, "-|");
my ($save_stdout, $save_stderr);
open($save_stdout, '>&', STDOUT) || die "save STDOUT: $!";
open($save_stderr, '>&', STDERR) || die "save STDERR: $!";
open(STDOUT, '>>', $configLogPath) || die "open $configLogPath: $!";
open(STDERR, '>&', STDOUT) || die "redirect STDERR to STDOUT: $!";
my $output;
print "+ @command_with_args\n"; if ($pid) { # parent
my $out = system(@command_with_args); while (<KID_TO_READ>) {
$output = $output . $_;
}
close(KID_TO_READ) || $! == 0 || warn "\nFailed to execute $program: exited $?";
} else {
# redirect STDERR to STDOUT
open STDERR, ">&STDOUT";
# Put them back. # Exec something
open(STDOUT, '>&', $save_stdout) || die "restoring STDOUT: $!"; exec ($program, @args) || die "\nCan't exec $program: $!\n";
open(STDERR, '>&', $save_stderr) || die "restoring STDERR: $!"; # NOTREACHED
}
return $out; return $output;
} }
###################################################################### ######################################################################
@ -213,18 +211,12 @@ sub executeLoggedCommand {
sub executeTest { sub executeTest {
my ($testName) = @_; my ($testName) = @_;
{
my $fh;
open($fh, '>>', $configLogPath) || die "open $configLogPath: $!";
print $fh "executing config test $testName:\n";
}
my $oldWorkingDir = getcwd(); my $oldWorkingDir = getcwd();
my $ret; my $ret = 0;
my @QMAKEARGS = ('CONFIG-=debug_and_release', 'CONFIG-=app_bundle'); my @QMAKEARGS = ('CONFIG-=debug_and_release', 'CONFIG-=app_bundle');
my $testOutDir = abs_path(catdir($out_basedir, 'config.tests', $testName)); my $testOutDir = catdir($out_basedir, 'config.tests', $testName);
# Since we might be cross compiling, look for barename (Linux) and .exe (Win32/Symbian) # Since we might be cross compiling, look for barename (Linux) and .exe (Win32/Symbian)
my $testOutFile1 = catfile($testOutDir, "$testName.exe"); my $testOutFile1 = catfile($testOutDir, "$testName.exe");
@ -244,31 +236,26 @@ sub executeTest {
# First remove existing stuff (XXX this probably needs generator specific code, but hopefully # First remove existing stuff (XXX this probably needs generator specific code, but hopefully
# the target removal below will suffice) # the target removal below will suffice)
if (-e "Makefile") { if (-e "Makefile") {
executeLoggedCommand($MAKE, 'distclean'); executeSomething($MAKE, 'distclean');
} }
# and any targets that we might find that weren't distcleaned # and any targets that we might find that weren't distcleaned
unlink $testOutFile1, $testOutFile2; unlink $testOutFile1, $testOutFile2;
# Run qmake && make # Run qmake && make
if (executeLoggedCommand($QMAKE, @QMAKEARGS)) { executeSomething($QMAKE, @QMAKEARGS);
# qmake failed -> config test failed my $makeOutput = executeSomething(($MAKE));
$ret = 0;
} elsif (executeLoggedCommand($MAKE)) { # If make prints "blah blah blah\nSkipped." we consider this a skipped test
# make failed -> config test failed if ($makeOutput !~ qr(^Skipped\.$)ms) {
$ret = 0; # Check the test exists (can't reliably execute, especially for cross compilation)
} elsif (-e $testOutFile1 or -e $testOutFile2) { if (-e $testOutFile1 or -e $testOutFile2) {
# qmake, make passed, output file exists -> success $ret = 1;
$ret = 1; }
} else { } else {
# qmake, make passed, output file doesn't exist -> skipped
$ret = 2; $ret = 2;
} }
my $fh;
open($fh, '>>', $configLogPath) || die "open $configLogPath: $!";
print $fh "config test $testName completed with result $ret\n";
chdir $oldWorkingDir or die "\nUnable to restore working directory: $!\n"; chdir $oldWorkingDir or die "\nUnable to restore working directory: $!\n";
return $ret; return $ret;
} }
@ -310,11 +297,6 @@ if (abs_path($out_basedir) ne abs_path($qtbasedir)) {
# Turn off buffering # Turn off buffering
$| = 1; $| = 1;
# Remove existing config.log
if (-e $configLogPath) {
unlink($configLogPath) || die "unlink $configLogPath: $!";
}
# Now run the configuration tests # Now run the configuration tests
print "Configuration tests:\n" if (%configtests); print "Configuration tests:\n" if (%configtests);