@@ -0,0 +1,33 | |||
|
1 | package Jobs; | |
|
2 | use File::Basename; | |
|
3 | use IniFiles; | |
|
4 | ||
|
5 | sub get { | |
|
6 | my $inifile = shift; | |
|
7 | my $jobname = shift; | |
|
8 | ||
|
9 | # Strip the prefix from job name when using ${bamboo.buildPlanName} | |
|
10 | my $prefix = "Digia Qt Commercial - Chart component - "; | |
|
11 | $jobname =~ s/$prefix//; | |
|
12 | ||
|
13 | # read ini file | |
|
14 | my %cfg; | |
|
15 | tie %cfg, 'Config::IniFiles', ( -file => $inifile ); | |
|
16 | ||
|
17 | # get section from ini by jobname | |
|
18 | my %job = %{$cfg{$jobname}}; | |
|
19 | if (!%job) { | |
|
20 | die ("Unknown jobname! Check $inifile and bamboo job name."); | |
|
21 | } | |
|
22 | ||
|
23 | # print out the ini settings | |
|
24 | print "\n\n$jobname\n"; | |
|
25 | print "**********\n"; | |
|
26 | foreach (keys %job) { | |
|
27 | print $_ . " : " . $job{$_} . "\n"; | |
|
28 | } | |
|
29 | ||
|
30 | return %job; | |
|
31 | } | |
|
32 | ||
|
33 | 1; No newline at end of file |
@@ -0,0 +1,57 | |||
|
1 | use Cwd; | |
|
2 | use Cwd 'abs_path'; | |
|
3 | use File::Basename; | |
|
4 | use File::Copy; | |
|
5 | use lib 'test/scripts'; | |
|
6 | use Jobs; | |
|
7 | ||
|
8 | # read command line params | |
|
9 | my $jobname = shift; | |
|
10 | ||
|
11 | # read ini file | |
|
12 | my $inifile = File::Basename::dirname($0) . "/jobs.ini"; | |
|
13 | my %job = Jobs::get($inifile, $jobname); | |
|
14 | ||
|
15 | # Windows specific magic | |
|
16 | if ($job{'Platform'} eq "Win7") { | |
|
17 | $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin"; # Add qtdir to path | |
|
18 | } | |
|
19 | ||
|
20 | # Go through all the files in the test folder | |
|
21 | my $root_path = abs_path(); | |
|
22 | my $test_path = "$root_path/bin/test/"; | |
|
23 | opendir (TESTAPPDIR, "$test_path") or die "Couldn't open test app dir"; | |
|
24 | @files = <TESTAPPDIR>; | |
|
25 | while ($testapp = readdir TESTAPPDIR) { | |
|
26 | # autotest is an executable beginning with "tst_" | |
|
27 | if (index($testapp, "tst_") == 0) { | |
|
28 | if (-x "$test_path$testapp") { | |
|
29 | my $cmd_postfix = ""; | |
|
30 | if ($^O eq "darwin") { | |
|
31 | # On OSX the actual test binary is in a sub folder | |
|
32 | $cmd_postfix = "/Contents/MacOS/$testapp"; | |
|
33 | $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app")); | |
|
34 | } | |
|
35 | # Generate path for test results | |
|
36 | my $test_result_path = "test-reports/$testapp.xml"; | |
|
37 | mkdir dirname($test_result_path); | |
|
38 | # Execute the actual auto test | |
|
39 | executeTestApp("$test_path$testapp$cmd_postfix", "-xunitxml -o $test_result_path"); | |
|
40 | } else { | |
|
41 | #print "file $testapp not executable\n"; | |
|
42 | } | |
|
43 | } | |
|
44 | } | |
|
45 | closedir TESTAPPDIR; | |
|
46 | ||
|
47 | sub executeTestApp($) { | |
|
48 | my $test_app_path = $_[0]; | |
|
49 | my $parameters = $_[1]; | |
|
50 | ||
|
51 | print "executing: $cmd_prefix$test_app_path $parameters\n"; | |
|
52 | my $file_handle = system("$test_app_path $parameters"); | |
|
53 | ||
|
54 | my $exit_status = $? >> 8; | |
|
55 | # print "exit: $exit_status \n"; | |
|
56 | # print "handle: $file_handle\n"; | |
|
57 | } |
@@ -1,55 +1,39 | |||
|
1 | use lib 'test/scripts'; # for IniFiles | |
|
2 | 1 |
|
|
3 | use IniFiles; | |
|
4 | 2 | use feature "switch"; |
|
3 | use lib 'test/scripts'; | |
|
4 | use Jobs; | |
|
5 | 5 | |
|
6 | 6 | # read command line params |
|
7 | 7 | my $jobname = shift; |
|
8 | 8 | |
|
9 | # Strip the prefix from job name when using ${bamboo.buildPlanName} | |
|
10 | my $prefix = "Digia Qt Commercial - Chart component - "; | |
|
11 | $jobname =~ s/$prefix//; | |
|
9 | # get script directory | |
|
10 | my $scriptdir = File::Basename::dirname($0); | |
|
12 | 11 | |
|
13 | 12 | # read ini file |
|
14 | my $scriptdir = File::Basename::dirname($0); | |
|
15 | 13 | my $inifile = $scriptdir . "/jobs.ini"; |
|
16 | my %cfg; | |
|
17 | tie %cfg, 'Config::IniFiles', ( -file => $inifile ); | |
|
18 | ||
|
19 | # get section from ini by jobname | |
|
20 | my %build = %{$cfg{$jobname}}; | |
|
21 | if (!%build) { | |
|
22 | die ("Unknown jobname! Check $inifile and bamboo job name."); | |
|
23 | } | |
|
24 | ||
|
25 | # print out the ini settings | |
|
26 | print "\n\n$jobname\n"; | |
|
27 | print "**********\n"; | |
|
28 | foreach (keys %build) { | |
|
29 | print $_ . " : " . $build{$_} . "\n"; | |
|
30 | } | |
|
14 | my %job = Jobs::get($inifile, $jobname); | |
|
31 | 15 | |
|
32 | 16 | # examine the platform |
|
33 |
given ($b |
|
|
17 | given ($job{'Platform'}) { | |
|
34 | 18 | when ("Win7") { |
|
35 | 19 | # construct a build command |
|
36 | 20 | my @cmd; |
|
37 |
if ($b |
|
|
38 |
@cmd = ($scriptdir . "\\build_win_mingw.bat", $b |
|
|
21 | if ($job{'ToolChain'} eq "mingw") { | |
|
22 | @cmd = ($scriptdir . "\\build_win_mingw.bat", $job{'QtDir'}, $job{'Config'}, $job{'MinGWDir'}); | |
|
39 | 23 | } |
|
40 |
if ($b |
|
|
41 |
@cmd = ($scriptdir . "\\build_win_vs2005.bat", $b |
|
|
24 | if ($job{'ToolChain'} eq "vs2005") { | |
|
25 | @cmd = ($scriptdir . "\\build_win_vs2005.bat", $job{'QtDir'}, $job{'Config'}); | |
|
42 | 26 | } |
|
43 |
if ($b |
|
|
44 |
@cmd = ($scriptdir . "\\build_win_vs2008.bat", $b |
|
|
27 | if ($job{'ToolChain'} eq "vs2008") { | |
|
28 | @cmd = ($scriptdir . "\\build_win_vs2008.bat", $job{'QtDir'}, $job{'Config'}); | |
|
45 | 29 | } |
|
46 |
if ($b |
|
|
47 |
@cmd = ($scriptdir . "\\build_win_vs2010.bat", $b |
|
|
30 | if ($job{'ToolChain'} eq "vs2010") { | |
|
31 | @cmd = ($scriptdir . "\\build_win_vs2010.bat", $job{'QtDir'}, $job{'Config'}); | |
|
48 | 32 | } |
|
49 | 33 | # run the build command |
|
50 | 34 | system (@cmd) == 0 or die "system @cmd failed: $?"; |
|
51 | 35 | } |
|
52 | 36 | default { |
|
53 |
die "Unknown platform " . $b |
|
|
37 | die "Unknown platform " . $job{'Platform'}; | |
|
54 | 38 | } |
|
55 | 39 | } No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now