mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-14 07:20:35 -08:00
add logfile parameter to describe_test add logcomment subroutine Copied from Perforce Change: 18988 ServerID: perforce.ravenbrook.com
115 lines
2.1 KiB
Perl
115 lines
2.1 KiB
Perl
#!/usr/local/perl
|
|
#
|
|
# provides subroutines to help in creating test logs and
|
|
# reports
|
|
#
|
|
|
|
1;
|
|
|
|
@LOG_FILES = (STDOUT);
|
|
|
|
#
|
|
# &describe_test(report_type)
|
|
#
|
|
# prints out report on a test. report_type is one of:
|
|
# full: everything
|
|
# summary: single line, pass/fail
|
|
# results: test, spec output, results, conclusion
|
|
#
|
|
|
|
sub describe_test {
|
|
local ($report, $LOGFILE, $oldhandle) = @_;
|
|
|
|
if ($LOGFILE) {
|
|
$oldhandle = select($LOGFILE);
|
|
}
|
|
if ($report eq "summary") {
|
|
$~ = "LOGSUMM";
|
|
write;
|
|
} else {
|
|
$~ = "LOGHEAD";
|
|
write;
|
|
%keyvalues = %test_header;
|
|
%keyrelations = ();
|
|
&dispvals;
|
|
%keyvalues = %spec_output;
|
|
%keyrelations = %spec_rel;
|
|
print $log_test_spec;
|
|
&dispvals;
|
|
%keyvalues = %real_output;
|
|
%keyrelations = ();
|
|
print $log_test_res;
|
|
&dispvals;
|
|
print $log_test_conc;
|
|
$~ = "LOGCONC";
|
|
write;
|
|
if ($report eq "full") {
|
|
&displog;
|
|
}
|
|
}
|
|
if ($LOGFILE) {
|
|
select($oldhandle);
|
|
}
|
|
}
|
|
|
|
sub dispvals {
|
|
local ($key, $rel, $val);
|
|
|
|
$~ = "LOGVALS";
|
|
|
|
foreach $key (sort keys %keyvalues) {
|
|
$val = $keyvalues{$key};
|
|
$rel = ($keyrelations{$key} || "=");
|
|
write;
|
|
}
|
|
}
|
|
|
|
sub displog {
|
|
open(TESTLOG, $testlogfile);
|
|
print $log_test_tran;
|
|
while ($line = <TESTLOG>) {
|
|
print $line;
|
|
}
|
|
print $log_test_end;
|
|
}
|
|
|
|
sub logcomment {
|
|
local ($text, $FILE) = @_;
|
|
|
|
foreach $FILE (@LOG_FILES) {
|
|
print $FILE "$text\n";
|
|
}
|
|
}
|
|
|
|
#
|
|
# what the output looks like:
|
|
#
|
|
|
|
$log_test_spec = "SPECIFIED RESULTS\n";
|
|
$log_test_res = "RESULTS\n";
|
|
$log_test_conc = "CONCLUSION\n";
|
|
$log_test_tran = "TRANSCRIPT\n";
|
|
$log_test_end = "END OF TRANSCRIPT\n\n";
|
|
|
|
format LOGHEAD =
|
|
------------------------------------------------------------------------
|
|
@<<<ED TEST @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
$testconclusion, $testfile
|
|
.
|
|
|
|
format LOGVALS =
|
|
@<<<<<<<<< @< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
$key, $rel, $val
|
|
.
|
|
|
|
format LOGCONC =
|
|
@<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
$testconclusion, $testconcreason
|
|
|
|
.
|
|
|
|
format LOGSUMM =
|
|
@<<<ED TEST @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
|
$testconclusion, $testfile
|
|
.
|
|
|