Merge pull request #2816 from xmcclure/profile-clean-0
[mono.git] / mono / profiler / ptestrunner.pl
index 42946608efb263103d2e66368fcabd2c3b76c1ee..5215621c2fdf7f22e669d26a39579b1dcc3e319e 100755 (executable)
@@ -6,7 +6,8 @@ use strict;
 
 my $builddir = shift || die "Usage: ptestrunner.pl mono_build_dir\n";
 my @errors = ();
-my $total_errors = 0;
+my $total_errors = 0; # this is reset before each test
+my $global_errors = 0;
 my $report;
 
 my $profbuilddir = $builddir . "/mono/profiler";
@@ -14,8 +15,7 @@ my $minibuilddir = $builddir . "/mono/mini";
 
 # Setup the execution environment
 # for the profiler module
-append_path ("LD_LIBRARY_PATH", $profbuilddir . "/.libs");
-append_path ("DYLD_LIBRARY_PATH", $profbuilddir . "/.libs");
+append_path ("MONO_PROFILER_LIB_DIR", $profbuilddir . "/.libs");
 append_path ("DYLD_LIBRARY_PATH", $minibuilddir . "/.libs");
 # for mprof-report
 append_path ("PATH", $profbuilddir);
@@ -106,7 +106,7 @@ report_errors ();
 
 emit_nunit_report();
 
-exit ($total_errors? 1: 0);
+exit ($global_errors ? 1 : 0);
 
 # utility functions
 sub append_path {
@@ -156,6 +156,7 @@ sub report_errors
        foreach my $e (@errors) {
                print "Error: $e\n";
                $total_errors++;
+               $global_errors++;
        }
        print "Total errors: $total_errors\n" if $total_errors;
        #print $report;
@@ -168,7 +169,7 @@ sub emit_nunit_report
        use Net::Domain qw(hostname hostfqdn);
        use locale;
 
-       my $failed = $total_errors ? 1 : 0;
+       my $failed = $global_errors ? 1 : 0;
        my $successbool;
        my $total = 1;
        my $mylocale = setlocale (LC_CTYPE);
@@ -180,7 +181,7 @@ sub emit_nunit_report
        } else {
                $successbool = "True";
        }
-       open (my $nunitxml, '>', 'TestResults_profiler.xml') or die "Could not write to 'TestResults_profiler.xml' $!";
+       open (my $nunitxml, '>', 'TestResult-profiler.xml') or die "Could not write to 'TestResult-profiler.xml' $!";
        print $nunitxml "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n";
        print $nunitxml "<!--This file represents the results of running a test suite-->\n";
        print $nunitxml "<test-results name=\"profiler-tests.dummy\" total=\"$total\" failures=\"$failed\" not-run=\"0\" date=\"" . strftime ("%F", localtime) . "\" time=\"" . strftime ("%T", localtime) . "\">\n";