@@ -1,70 +1,75 | |||||
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 lib 'test/scripts'; |
|
5 | use lib 'test/scripts'; | |
6 | use Jobs; |
|
6 | use Jobs; | |
7 |
|
7 | |||
8 | # read command line params |
|
8 | # read command line params | |
9 | my $jobname = shift; |
|
9 | my $jobname = shift; | |
10 |
|
10 | |||
11 | # read ini file |
|
11 | # read ini file | |
12 | my $inifile = File::Basename::dirname($0) . "/jobs.ini"; |
|
12 | my $inifile = File::Basename::dirname($0) . "/jobs.ini"; | |
13 | my %job = Jobs::get($inifile, $jobname); |
|
13 | my %job = Jobs::get($inifile, $jobname); | |
14 |
|
14 | |||
15 | # set/get paths |
|
15 | # set/get paths | |
16 | my $root_path = abs_path(); |
|
16 | my $root_path = abs_path(); | |
17 |
my $ |
|
17 | my $bin_path = "$root_path/bin/"; | |
18 | my $reports_path = "test-reports"; |
|
18 | my $reports_path = "test-reports"; | |
19 |
|
19 | |||
20 | # create reports path |
|
20 | # create reports path | |
21 |
mkdir |
|
21 | mkdir $reports_path; | |
22 |
|
22 | |||
23 | # Windows specific magic |
|
23 | # Windows specific magic | |
24 | if ($job{'Platform'} eq "Win7") { |
|
24 | if ($job{'Platform'} eq "Win7") { | |
25 | $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin"; # Add qtdir to path |
|
25 | $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin"; # Add qtdir to path | |
26 | $ENV{'PATH'} .= ";" . $root_path . "\\bin"; # Add charts bin to path |
|
|||
27 | $ENV{'PATH'} =~ s/\//\\/g; # replace / -> \ |
|
26 | $ENV{'PATH'} =~ s/\//\\/g; # replace / -> \ | |
28 | } |
|
27 | } | |
29 |
|
28 | |||
30 | my $script_exit_status = 0; |
|
29 | my $script_exit_status = 0; | |
31 |
|
30 | |||
32 | # Go through all the files in the test folder |
|
31 | # Go through all the files in the test folder | |
33 | # autotest is an executable beginning with "tst_" |
|
32 | # autotest is an executable beginning with "tst_" | |
34 |
opendir (TESTAPPDIR, "$ |
|
33 | opendir (TESTAPPDIR, "$bin_path") or die "Couldn't open test app dir"; | |
35 | @files = <TESTAPPDIR>; |
|
34 | @files = <TESTAPPDIR>; | |
36 | while ($testapp = readdir TESTAPPDIR) { |
|
35 | while ($testapp = readdir TESTAPPDIR) { | |
37 | if (index($testapp, "tst_") == 0) { |
|
36 | if (index($testapp, "tst_") == 0) { | |
38 |
if (-x "$ |
|
37 | if (-x "$bin_path$testapp") { | |
39 | my $status = executeTestApp($testapp); |
|
38 | my $status = executeTestApp($testapp); | |
40 | if ($status != 0) { |
|
39 | if ($status != 0) { | |
41 | $script_exit_status = $status; |
|
40 | $script_exit_status = $status; | |
42 | } |
|
41 | } | |
43 | } else { |
|
42 | } else { | |
44 | #print "file $testapp not executable\n"; |
|
43 | #print "file $testapp not executable\n"; | |
45 | } |
|
44 | } | |
46 | } |
|
45 | } | |
47 | } |
|
46 | } | |
48 | closedir TESTAPPDIR; |
|
47 | closedir TESTAPPDIR; | |
49 |
|
48 | |||
50 | print "\nscript exit status : $script_exit_status\n"; |
|
49 | print "\n*** script exit status : $script_exit_status ***\n\n"; | |
51 | exit($script_exit_status); |
|
50 | exit($script_exit_status); | |
52 |
|
51 | |||
53 | sub executeTestApp($) { |
|
52 | sub executeTestApp($) { | |
54 | my $testapp = $_[0]; |
|
53 | my $testapp = $_[0]; | |
55 |
|
54 | |||
56 | # On OSX the actual test binary is in a sub folder |
|
55 | # On OSX the actual test binary is in a sub folder | |
57 | my $cmd_postfix = ""; |
|
56 | my $cmd_postfix = ""; | |
58 | if ($^O eq "darwin") { |
|
57 | if ($^O eq "darwin") { | |
59 | $cmd_postfix = "/Contents/MacOS/$testapp"; |
|
58 | $cmd_postfix = "/Contents/MacOS/$testapp"; | |
60 | $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app")); |
|
59 | $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app")); | |
61 | } |
|
60 | } | |
62 |
|
61 | |||
63 |
my $cmd = "$ |
|
62 | my $cmd = "$bin_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml"; | |
64 | print "executing: $cmd\n"; |
|
63 | print "executing: $cmd\n"; | |
65 |
|
|
64 | system($cmd); | |
|
65 | ||||
|
66 | # From http://perldoc.perl.org/perlvar.html about $?: | |||
|
67 | # The upper eight bits reflect specific error conditions encountered by the | |||
|
68 | # program (the program's exit() value). The lower eight bits reflect | |||
|
69 | # mode of failure, like signal death and core dump information. | |||
|
70 | # See wait(2) for details. | |||
66 | my $exit_status = $? >> 8; |
|
71 | my $exit_status = $? >> 8; | |
67 |
print "\texit status: $exit_status |
|
72 | print "\texit status: $exit_status\n"; | |
68 |
|
73 | |||
69 | return $exit_status; |
|
74 | return $exit_status; | |
70 | } |
|
75 | } |
@@ -1,11 +1,11 | |||||
1 | !include( ../config.pri ) { |
|
1 | !include( ../config.pri ) { | |
2 | error( "Couldn't find the config.pri file!" ) |
|
2 | error( "Couldn't find the config.pri file!" ) | |
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | TEMPLATE = app |
|
5 | TEMPLATE = app | |
6 |
|
6 | |||
7 |
DESTDIR = $$CHART_BUILD_BIN_DIR |
|
7 | DESTDIR = $$CHART_BUILD_BIN_DIR | |
8 |
OBJECTS_DIR = $$CHART_BUILD_DIR/ |
|
8 | OBJECTS_DIR = $$CHART_BUILD_DIR/$$TARGET | |
9 |
MOC_DIR = $$CHART_BUILD_DIR/ |
|
9 | MOC_DIR = $$CHART_BUILD_DIR/$$TARGET | |
10 |
UI_DIR = $$CHART_BUILD_DIR/ |
|
10 | UI_DIR = $$CHART_BUILD_DIR/$$TARGET | |
11 |
RCC_DIR = $$CHART_BUILD_DIR/ |
|
11 | RCC_DIR = $$CHART_BUILD_DIR/$$TARGET |
General Comments 0
You need to be logged in to leave comments.
Login now