diff --git a/test/scripts/run_tests.pl b/test/scripts/run_tests.pl index ad88be1..e6c620e 100644 --- a/test/scripts/run_tests.pl +++ b/test/scripts/run_tests.pl @@ -14,16 +14,15 @@ my %job = Jobs::get($inifile, $jobname); # set/get paths my $root_path = abs_path(); -my $test_path = "$root_path/bin/test/"; +my $bin_path = "$root_path/bin/"; my $reports_path = "test-reports"; # create reports path -mkdir dirname($reports_path); +mkdir $reports_path; # Windows specific magic if ($job{'Platform'} eq "Win7") { $ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin"; # Add qtdir to path - $ENV{'PATH'} .= ";" . $root_path . "\\bin"; # Add charts bin to path $ENV{'PATH'} =~ s/\//\\/g; # replace / -> \ } @@ -31,11 +30,11 @@ my $script_exit_status = 0; # Go through all the files in the test folder # autotest is an executable beginning with "tst_" -opendir (TESTAPPDIR, "$test_path") or die "Couldn't open test app dir"; +opendir (TESTAPPDIR, "$bin_path") or die "Couldn't open test app dir"; @files = ; while ($testapp = readdir TESTAPPDIR) { if (index($testapp, "tst_") == 0) { - if (-x "$test_path$testapp") { + if (-x "$bin_path$testapp") { my $status = executeTestApp($testapp); if ($status != 0) { $script_exit_status = $status; @@ -47,7 +46,7 @@ while ($testapp = readdir TESTAPPDIR) { } closedir TESTAPPDIR; -print "\nscript exit status : $script_exit_status\n"; +print "\n*** script exit status : $script_exit_status ***\n\n"; exit($script_exit_status); sub executeTestApp($) { @@ -60,11 +59,17 @@ sub executeTestApp($) { $cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app")); } - my $cmd = "$test_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml"; + my $cmd = "$bin_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml"; print "executing: $cmd\n"; - my $file_handle = system($cmd); + system($cmd); + + # From http://perldoc.perl.org/perlvar.html about $?: + # The upper eight bits reflect specific error conditions encountered by the + # program (the program's exit() value). The lower eight bits reflect + # mode of failure, like signal death and core dump information. + # See wait(2) for details. my $exit_status = $? >> 8; - print "\texit status: $exit_status handle: $file_handle\n"; + print "\texit status: $exit_status\n"; return $exit_status; } diff --git a/test/test.pri b/test/test.pri index 7fcfcf4..0ebeba7 100644 --- a/test/test.pri +++ b/test/test.pri @@ -4,8 +4,8 @@ TEMPLATE = app -DESTDIR = $$CHART_BUILD_BIN_DIR/test -OBJECTS_DIR = $$CHART_BUILD_DIR/test/$$TARGET -MOC_DIR = $$CHART_BUILD_DIR/test/$$TARGET -UI_DIR = $$CHART_BUILD_DIR/test/$$TARGET -RCC_DIR = $$CHART_BUILD_DIR/test/$$TARGET +DESTDIR = $$CHART_BUILD_BIN_DIR +OBJECTS_DIR = $$CHART_BUILD_DIR/$$TARGET +MOC_DIR = $$CHART_BUILD_DIR/$$TARGET +UI_DIR = $$CHART_BUILD_DIR/$$TARGET +RCC_DIR = $$CHART_BUILD_DIR/$$TARGET