4628 magnus.blaudd@stripped 2012-10-17 [merge]
Merge
modified:
mysql-test/lib/My/Exec.pm
4627 Craig L Russell 2012-10-16
Load the ndbclient system library during initialization of clusterj Utility.java
This is normally done during initialization of ClusterConnection but in some
cases Utility might be loaded first.
Sort the actual results of unordered query during tests. This allows
testing an exact match of expected versus actual results.
modified:
storage/ndb/clusterj/clusterj-jdbc/src/test/java/jdbctest/JDBCQueryTest.java
storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/Utility.java
=== modified file 'mysql-test/lib/My/Exec.pm'
--- a/mysql-test/lib/My/Exec.pm 2011-06-30 16:04:23 +0000
+++ b/mysql-test/lib/My/Exec.pm 2012-10-17 10:23:31 +0000
@@ -51,15 +51,23 @@ sub get_logfile_name {
return $logfile_name;
}
-# Save a set of lines to a file
-sub save_file {
- my $filename = shift;
- my $lines = shift;
-
- my $F = IO::File->new($filename, "w") or die "Can't write to '$filename': $!";
- foreach my $line (@$lines) {
- print $F $line
+# Show the last "max_lines" from file
+sub show_last_lines_from_file {
+ my ($filename, $max_lines) = @_;
+
+ my $F = IO::File->new($filename, "r")
+ or print "Failed to open file '$filename' for reading: $!\n" and return;
+
+ my @input = <$F>;
+ my $lines = scalar(@input);
+ $lines = $max_lines if $lines > $max_lines;
+ print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
+ print "Last '$lines' lines of output from command:\n";
+ foreach my $line (splice(@input, -$lines))
+ {
+ print $line;
}
+ print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
$F->close();
}
@@ -83,10 +91,14 @@ sub exec_print_on_error {
my $logfile_name = get_logfile_name($cmd);
- $cmd .= " 2>&1";
- my @output = `$cmd`;
- print "Result of '$cmd': $?, logfile: '$logfile_name'\n";
- save_file($logfile_name, \@output);
+ # Redirect stdout and stderr of command to log file
+ $cmd .= " > $logfile_name 2>&1";
+
+ # Execute command
+ print "Running '$cmd'\n";
+ system($cmd);
+
+ print "Result of '$cmd': $?\n";
if ($? == 0)
{
# Test program suceeded
@@ -108,14 +120,8 @@ sub exec_print_on_error {
print "Test program killed by signal $sig\n" if $sig;
print "Test program failed with error $return\n" if $return;
- # Show the last lines of the output
- my $lines = scalar(@output);
- $lines = $max_lines if $lines > $max_lines;
- print "Last '$lines' lines of output from command:\n";
- foreach my $line (splice(@output, -$lines))
- {
- print $line;
- }
+ # Show the "max_lines" last lines from the log file
+ show_last_lines_from_file($logfile_name, $max_lines);
}
return 0;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.1 branch (magnus.blaudd:4627 to 4628) | magnus.blaudd | 17 Oct |