You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by pg...@apache.org on 2006/08/07 02:15:06 UTC
svn commit: r429216 - in /perl/Apache-Test/trunk: Changes
lib/Apache/TestUtil.pm
Author: pgollucci
Date: Sun Aug 6 17:15:05 2006
New Revision: 429216
URL: http://svn.apache.org/viewvc?rev=429216&view=rev
Log:
Add functions:
o t_start_error_log_watch()
o t_finish_error_log_watch()
Submitted by: Torsten Foertsch <to...@gmx.net>
Message ID: <20...@gmx.net>
Reviewed by: pgollucci
Modified:
perl/Apache-Test/trunk/Changes
perl/Apache-Test/trunk/lib/Apache/TestUtil.pm
Modified: perl/Apache-Test/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/Changes?rev=429216&r1=429215&r2=429216&view=diff
==============================================================================
--- perl/Apache-Test/trunk/Changes (original)
+++ perl/Apache-Test/trunk/Changes Sun Aug 6 17:15:05 2006
@@ -8,6 +8,10 @@
=item 1.29-dev
+Add t_start_error_log_watch() and t_finish_error_log_watch()
+to the Apache::TestUtil API which are only exported unpon request.
+[Torsten Foertsch <to...@gmx.net>]
+
Allow version variants of debuggers to be passed as arguments
to -debug. i.e. -debug=gdb65 for systems with multiple
versions of the same debugger. [Philip M. Gollucci]
Modified: perl/Apache-Test/trunk/lib/Apache/TestUtil.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestUtil.pm?rev=429216&r1=429215&r2=429216&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestUtil.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestUtil.pm Sun Aug 6 17:15:05 2006
@@ -26,6 +26,7 @@
use File::Basename qw(dirname);
use File::Spec::Functions qw(catfile file_name_is_absolute);
use Symbol ();
+use Fcntl qw(SEEK_END);
use Apache::Test ();
use Apache::TestConfig ();
@@ -42,7 +43,8 @@
);
@EXPORT_OK = qw(t_write_perl_script t_write_shell_script t_chown
- t_catfile_apache t_catfile);
+ t_catfile_apache t_catfile
+ t_start_error_log_watch t_finish_error_log_watch);
%CLEAN = ();
@@ -52,6 +54,27 @@
use constant HAS_DUMPER => eval { $] >= 5.6 && require Data::Dumper; };
use constant INDENT => 4;
+{
+ my $f;
+ sub t_start_error_log_watch {
+
+ my $name=File::Spec->catfile( Apache::Test::vars->{t_logs}, 'error_log' );
+ open $f, "$name" or die "ERROR: Cannot open $name: $!\n";
+ seek $f, 0, SEEK_END;
+
+ return;
+ }
+
+ sub t_finish_error_log_watch {
+
+ local $/ = "\n";
+ my @lines = <$f>;
+ undef $f;
+
+ return @lines;
+ }
+}
+
# because of the prototype and recursive call to itself a forward
# declaration is needed
sub t_is_equal ($$);
@@ -772,6 +795,18 @@
It is useful when comparing something to that returned by Apache,
which uses a Unix-style specification with forward slashes for
directory separators. The function is not exported by default.
+
+=item t_start_error_log_watch(), t_finish_error_log_watch()
+
+This pair of functions provides an easy interface for checking
+the presence or absense of any particular message or messages
+in the httpd error_log that were generated by the httpd daemon
+as part of a test suite. It is likely, that you should proceed
+this with a call to one of the t_*_is_expected() functions.
+
+ t_start_error_log_watch();
+ do_it;
+ ok grep {...} t_finish_error_log_watch()
=back