##// END OF EJS Templates
Move scripts to tools folder
Jani Honkonen -
r1203:5bd91523463d
parent child
Show More
1 NO CONTENT: file renamed from tests/scripts/Jobs.pm to tools/Jobs.pm
NO CONTENT: file renamed from tests/scripts/Jobs.pm to tools/Jobs.pm
1 NO CONTENT: file renamed from tests/scripts/Tiny.pm to tools/Tiny.pm
NO CONTENT: file renamed from tests/scripts/Tiny.pm to tools/Tiny.pm
@@ -1,97 +1,97
1 use File::Basename;
1 use File::Basename;
2 use feature "switch";
2 use feature "switch";
3 use lib 'test/scripts';
3 use lib 'tools';
4 use Jobs;
4 use Jobs;
5
5
6 # read command line params
6 # read command line params
7 my $jobname = shift;
7 my $jobname = shift;
8
8
9 # get script directory
9 # get script directory
10 my $scriptdir = File::Basename::dirname($0);
10 my $scriptdir = File::Basename::dirname($0);
11
11
12 # read ini file
12 # read ini file
13 my $inifile = $scriptdir . "/jobs.ini";
13 my $inifile = $scriptdir . "/jobs.ini";
14 my %job = Jobs::get($inifile, $jobname);
14 my %job = Jobs::get($inifile, $jobname);
15
15
16 # examine the platform
16 # examine the platform
17 given ($job{'Platform'}) {
17 given ($job{'Platform'}) {
18
18
19 when ("Win7") {
19 when ("Win7") {
20
20
21 $scriptdir =~ s/\//\\/g; # replace / -> \
21 $scriptdir =~ s/\//\\/g; # replace / -> \
22
22
23 # construct a build command
23 # construct a build command
24 if ($job{'ToolChain'} eq "mingw") {
24 if ($job{'ToolChain'} eq "mingw") {
25 run($scriptdir . "\\build_win_mingw.bat", $job{'QtDir'}, $job{'Config'}, $job{'MinGWDir'});
25 run($scriptdir . "\\build_win_mingw.bat", $job{'QtDir'}, $job{'Config'}, $job{'MinGWDir'});
26 }
26 }
27 elsif ($job{'ToolChain'} eq "vs2005") {
27 elsif ($job{'ToolChain'} eq "vs2005") {
28 run($scriptdir . "\\build_win_vs2005.bat", $job{'QtDir'}, $job{'Config'});
28 run($scriptdir . "\\build_win_vs2005.bat", $job{'QtDir'}, $job{'Config'});
29 }
29 }
30 elsif ($job{'ToolChain'} eq "vs2008") {
30 elsif ($job{'ToolChain'} eq "vs2008") {
31 run($scriptdir . "\\build_win_vs2008.bat", $job{'QtDir'}, $job{'Config'});
31 run($scriptdir . "\\build_win_vs2008.bat", $job{'QtDir'}, $job{'Config'});
32 }
32 }
33 elsif ($job{'ToolChain'} eq "vs2010") {
33 elsif ($job{'ToolChain'} eq "vs2010") {
34 run($scriptdir . "\\build_win_vs2010.bat", $job{'QtDir'}, $job{'Config'});
34 run($scriptdir . "\\build_win_vs2010.bat", $job{'QtDir'}, $job{'Config'});
35 }
35 }
36 elsif ($job{'ToolChain'} eq "vs2010-64bit") {
36 elsif ($job{'ToolChain'} eq "vs2010-64bit") {
37 run($scriptdir . "\\build_win_vs2010_64bit.bat", $job{'QtDir'}, $job{'Config'});
37 run($scriptdir . "\\build_win_vs2010_64bit.bat", $job{'QtDir'}, $job{'Config'});
38 }
38 }
39 else {
39 else {
40 die "Unknown toolchain!";
40 die "Unknown toolchain!";
41 }
41 }
42 }
42 }
43
43
44 when ("Mac") {
44 when ("Mac") {
45
45
46 # setup build environment
46 # setup build environment
47 $ENV{'QTDIR'} = $job{'QtDir'};
47 $ENV{'QTDIR'} = $job{'QtDir'};
48 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
48 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
49
49
50 # run qmake
50 # run qmake
51 my $cmd;
51 my $cmd;
52 if ($job{'ToolChain'} eq "clang") {
52 if ($job{'ToolChain'} eq "clang") {
53 run("qmake -r -spec unsupported/macx-clang CONFIG+=" . $job{'Config'});
53 run("qmake -r -spec unsupported/macx-clang CONFIG+=" . $job{'Config'});
54 }
54 }
55 elsif ($job{'ToolChain'} eq "gcc") {
55 elsif ($job{'ToolChain'} eq "gcc") {
56 run("qmake -r CONFIG+=" . $job{'Config'});
56 run("qmake -r CONFIG+=" . $job{'Config'});
57 }
57 }
58 else {
58 else {
59 die "Unknown toolchain!";
59 die "Unknown toolchain!";
60 }
60 }
61
61
62 # run make
62 # run make
63 run("make");
63 run("make");
64 }
64 }
65
65
66 when ("Linux") {
66 when ("Linux") {
67
67
68 # setup build environment
68 # setup build environment
69 $ENV{'QTDIR'} = $job{'QtDir'};
69 $ENV{'QTDIR'} = $job{'QtDir'};
70 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
70 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
71
71
72 # run qmake
72 # run qmake
73 my $cmd;
73 my $cmd;
74 if ($job{'ToolChain'} eq "gcc") {
74 if ($job{'ToolChain'} eq "gcc") {
75 run("qmake -r CONFIG+=" . $job{'Config'});
75 run("qmake -r CONFIG+=" . $job{'Config'});
76 }
76 }
77 else {
77 else {
78 die "Unknown toolchain!";
78 die "Unknown toolchain!";
79 }
79 }
80
80
81 # run make
81 # run make
82 run("make -j 4");
82 run("make -j 4");
83 }
83 }
84
84
85 default {
85 default {
86 die "Unknown platform " . $job{'Platform'};
86 die "Unknown platform " . $job{'Platform'};
87 }
87 }
88 }
88 }
89
89
90 sub run {
90 sub run {
91 my $cmd;
91 my $cmd;
92 foreach (@_) {
92 foreach (@_) {
93 $cmd .= "$_ ";
93 $cmd .= "$_ ";
94 }
94 }
95 print "running : $cmd\n";
95 print "running : $cmd\n";
96 system(@_) == 0 or die "system \"$cmd\" failed: $?";
96 system(@_) == 0 or die "system \"$cmd\" failed: $?";
97 } No newline at end of file
97 }
1 NO CONTENT: file renamed from tests/scripts/build_win_mingw.bat to tools/build_win_mingw.bat
NO CONTENT: file renamed from tests/scripts/build_win_mingw.bat to tools/build_win_mingw.bat
1 NO CONTENT: file renamed from tests/scripts/build_win_vs2005.bat to tools/build_win_vs2005.bat
NO CONTENT: file renamed from tests/scripts/build_win_vs2005.bat to tools/build_win_vs2005.bat
1 NO CONTENT: file renamed from tests/scripts/build_win_vs2008.bat to tools/build_win_vs2008.bat
NO CONTENT: file renamed from tests/scripts/build_win_vs2008.bat to tools/build_win_vs2008.bat
1 NO CONTENT: file renamed from tests/scripts/build_win_vs2010.bat to tools/build_win_vs2010.bat
NO CONTENT: file renamed from tests/scripts/build_win_vs2010.bat to tools/build_win_vs2010.bat
1 NO CONTENT: file renamed from tests/scripts/build_win_vs2010_64bit.bat to tools/build_win_vs2010_64bit.bat
NO CONTENT: file renamed from tests/scripts/build_win_vs2010_64bit.bat to tools/build_win_vs2010_64bit.bat
1 NO CONTENT: file renamed from tests/scripts/jobs.ini to tools/jobs.ini
NO CONTENT: file renamed from tests/scripts/jobs.ini to tools/jobs.ini
@@ -1,90 +1,90
1 use Cwd;
1 use Cwd;
2 use Cwd 'abs_path';
2 use Cwd 'abs_path';
3 use File::Basename;
3 use File::Basename;
4 use File::Copy;
4 use File::Copy;
5 use feature "switch";
5 use feature "switch";
6 use lib 'test/scripts';
6 use lib 'tools';
7 use Jobs;
7 use Jobs;
8
8
9 # read command line params
9 # read command line params
10 my $jobname = shift;
10 my $jobname = shift;
11
11
12 # read ini file
12 # read ini file
13 my $inifile = File::Basename::dirname($0) . "/jobs.ini";
13 my $inifile = File::Basename::dirname($0) . "/jobs.ini";
14 my %job = Jobs::get($inifile, $jobname);
14 my %job = Jobs::get($inifile, $jobname);
15
15
16 # set/get paths
16 # set/get paths
17 my $root_path = abs_path();
17 my $root_path = abs_path();
18 my $bin_path = "$root_path/bin/";
18 my $bin_path = "$root_path/bin/";
19 my $reports_path = "test-reports";
19 my $reports_path = "test-reports";
20
20
21 # create reports path
21 # create reports path
22 mkdir $reports_path;
22 mkdir $reports_path;
23
23
24 # setup environment for running tests
24 # setup environment for running tests
25 given ($job{'Platform'}) {
25 given ($job{'Platform'}) {
26
26
27 when ("Win7") {
27 when ("Win7") {
28 # Add qtdir to path
28 # Add qtdir to path
29 $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin";
29 $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin";
30
30
31 # replace / -> \
31 # replace / -> \
32 $ENV{'PATH'} =~ s/\//\\/g;
32 $ENV{'PATH'} =~ s/\//\\/g;
33 }
33 }
34
34
35 when ("Linux") {
35 when ("Linux") {
36 # Add qtdir to path
36 # Add qtdir to path
37 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
37 $ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
38
38
39 # If this is not set we get "cannot connect to X server" errors
39 # If this is not set we get "cannot connect to X server" errors
40 $ENV{'DISPLAY'} = ":0.0";
40 $ENV{'DISPLAY'} = ":0.0";
41 }
41 }
42 }
42 }
43
43
44 # Go through all the files in the test folder
44 # Go through all the files in the test folder
45 # autotest is an executable beginning with "tst_"
45 # autotest is an executable beginning with "tst_"
46 my $script_exit_status = 0;
46 my $script_exit_status = 0;
47 opendir (TESTAPPDIR, "$bin_path") or die "Couldn't open test app dir";
47 opendir (TESTAPPDIR, "$bin_path") or die "Couldn't open test app dir";
48 @files = <TESTAPPDIR>;
48 @files = <TESTAPPDIR>;
49 while ($testapp = readdir TESTAPPDIR) {
49 while ($testapp = readdir TESTAPPDIR) {
50 if (index($testapp, "tst_") == 0) {
50 if (index($testapp, "tst_") == 0) {
51 if (-x "$bin_path$testapp") {
51 if (-x "$bin_path$testapp") {
52 my $status = executeTestApp($testapp);
52 my $status = executeTestApp($testapp);
53 if ($status != 0) {
53 if ($status != 0) {
54 $script_exit_status = $status;
54 $script_exit_status = $status;
55 }
55 }
56 } else {
56 } else {
57 #print "file $testapp not executable\n";
57 #print "file $testapp not executable\n";
58 }
58 }
59 }
59 }
60 }
60 }
61 closedir TESTAPPDIR;
61 closedir TESTAPPDIR;
62
62
63 print "\n*** script exit status : $script_exit_status ***\n\n";
63 print "\n*** script exit status : $script_exit_status ***\n\n";
64 exit($script_exit_status);
64 exit($script_exit_status);
65
65
66
66
67 sub executeTestApp($) {
67 sub executeTestApp($) {
68 my $testapp = $_[0];
68 my $testapp = $_[0];
69
69
70 # On OSX the actual test binary is in a sub folder
70 # On OSX the actual test binary is in a sub folder
71 my $cmd_postfix = "";
71 my $cmd_postfix = "";
72 if ($^O eq "darwin") {
72 if ($^O eq "darwin") {
73 $cmd_postfix = "/Contents/MacOS/$testapp";
73 $cmd_postfix = "/Contents/MacOS/$testapp";
74 $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app"));
74 $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app"));
75 }
75 }
76
76
77 my $cmd = "$bin_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml";
77 my $cmd = "$bin_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml";
78 print "executing: $cmd\n";
78 print "executing: $cmd\n";
79 system($cmd);
79 system($cmd);
80
80
81 # From http://perldoc.perl.org/perlvar.html about $?:
81 # From http://perldoc.perl.org/perlvar.html about $?:
82 # The upper eight bits reflect specific error conditions encountered by the
82 # The upper eight bits reflect specific error conditions encountered by the
83 # program (the program's exit() value). The lower eight bits reflect
83 # program (the program's exit() value). The lower eight bits reflect
84 # mode of failure, like signal death and core dump information.
84 # mode of failure, like signal death and core dump information.
85 # See wait(2) for details.
85 # See wait(2) for details.
86 my $exit_status = $? >> 8;
86 my $exit_status = $? >> 8;
87 print "\texit status: $exit_status\n";
87 print "\texit status: $exit_status\n";
88
88
89 return $exit_status;
89 return $exit_status;
90 }
90 }
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now