Commit abe2b02f authored by Janne Anttila's avatar Janne Anttila Committed by The Qt Project
Browse files

Fix qtqa autotest for mingw build.

Skip autotest in 41-print_calling_makefile.t if MinGW is used.
This script is a workaround for nmake's lack of any equivalent
to GNU make's $(MAKEFILE_LIST), thus there is no need to test
it with MinGW builds.

Pass correct make command for testplanner.pl and testscheduler.t,
in respective test cases. Without '--make' argument, the scripts
default to `nmake' on Windows and `make' everywhere else.

Change preprocessor macro used in pass.cpp, so that file compiles
for both Visual Studio and MinGW. According to MS docs
http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx


is always defined for Windows applications (both 32 and 64-bit).

Change-Id: I3a63a8c44b4bb0d0c066d8dc21a6559d54cfdb98
Reviewed-by: default avatarSergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: default avatarSimo Fält <simo.falt@digia.com>
Reviewed-by: default avatarSamuli Piippo <samuli.piippo@digia.com>
Reviewed-by: default avatarTony Sarajärvi <tony.sarajarvi@digia.com>
Reviewed-by: default avatarJanne Anttila <janne.anttila@digia.com>
parent ce4b2943
Branches
Tags
No related merge requests found
Showing with 50 additions and 17 deletions
...@@ -51,6 +51,20 @@ sub test_testplanner_on_testdata ...@@ -51,6 +51,20 @@ sub test_testplanner_on_testdata
"$testplan", "$testplan",
); );
if ($OSNAME =~ m{win32}i) {
if (!system( 'where', "/Q", "nmake" )) {
push @cmd, (
'--make',
'nmake',
);
} elsif (!system( 'where', "/Q", "mingw32-make" )) {
push @cmd, (
'--make',
'mingw32-make',
);
} # else - use default
} # else - use default
my $status = system( @cmd ); my $status = system( @cmd );
is( $status, 0, 'testplanner exit code OK' ); is( $status, 0, 'testplanner exit code OK' );
......
...@@ -40,21 +40,25 @@ sub test_cmd ...@@ -40,21 +40,25 @@ sub test_cmd
sub run sub run
{ {
SKIP: { my $should_skip = 1;
skip( 'Win32-specific test', 1 ) if ($OSNAME !~ m{win32}i); if ($OSNAME =~ m{win32}i) {
# Skip this test case also on Windows if nmake is not in path
local $CWD = $TESTDATA_DIR; $should_skip = system( 'where', "/Q", "nmake" );
}
for my $makefile ('basic-makefile', 'makefile with spaces') { plan 'skip_all', "This test is relevant only on Win32 and nmake" if ($should_skip != 0);
ok( test_cmd( [qw(nmake -C -S -F), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S /F), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S -f), $makefile], $makefile ) ); local $CWD = $TESTDATA_DIR;
ok( test_cmd( [qw(nmake -C -S /f), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "-F$makefile"], $makefile ) ); for my $makefile ('basic-makefile', 'makefile with spaces') {
ok( test_cmd( [qw(nmake -C -S), "/F$makefile"], $makefile ) ); ok( test_cmd( [qw(nmake -C -S -F), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "-f$makefile"], $makefile ) ); ok( test_cmd( [qw(nmake -C -S /F), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "/f$makefile"], $makefile ) ); ok( test_cmd( [qw(nmake -C -S -f), $makefile], $makefile ) );
} ok( test_cmd( [qw(nmake -C -S /f), $makefile], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "-F$makefile"], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "/F$makefile"], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "-f$makefile"], $makefile ) );
ok( test_cmd( [qw(nmake -C -S), "/f$makefile"], $makefile ) );
} }
done_testing; done_testing;
......
...@@ -99,9 +99,24 @@ sub make_testplan_from_directory ...@@ -99,9 +99,24 @@ sub make_testplan_from_directory
$directory, $directory,
'--output', '--output',
"$testplan", "$testplan",
@args,
); );
if ($OSNAME =~ m{win32}i) {
if (!system( 'where', "/Q", "nmake" )) {
push @cmd, (
'--make',
'nmake',
);
} elsif (!system( 'where', "/Q", "mingw32-make" )) {
push @cmd, (
'--make',
'mingw32-make',
);
} # else - use default
} # else - use default
push (@cmd, @args);
my $status = system( @cmd ); my $status = system( @cmd );
is( $status, 0, 'testplanner exit code OK' ); is( $status, 0, 'testplanner exit code OK' );
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <stdio.h> #include <stdio.h>
#ifdef _MSC_VER #ifdef _WIN32
# include <windows.h> # include <windows.h>
# define sleep(x) Sleep(x*1000) # define sleep(x) Sleep(x*1000)
#else #else
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment