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