From ae6b79c8559f78de09a90f51b1e40bb244753d32 Mon Sep 17 00:00:00 2001 From: mtortonesi Date: Wed, 22 Aug 2007 07:05:18 -0700 Subject: [PATCH] [svn] Minor fixes/updates for the testing suite. --- tests/ChangeLog | 15 ++++++++++++++ tests/Makefile.in | 25 ++++++++++++------------ tests/Test-HTTP-Content-Disposition-1.px | 2 +- tests/Test-HTTP-Content-Disposition.px | 2 +- tests/Test-N-current.px | 13 +++++++----- tests/WgetTest.pm.in | 12 +++++++++--- 6 files changed, 47 insertions(+), 22 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 085f45be..c5b42778 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,18 @@ +2007-08-21 Mauro Tortonesi + + * WgetTest.pm.in: Added support for timestamping of pre-existing + files. + + * Test-N-current.px: Fixed broken test logic. + + * Makefile.in: Updated list of automatically run tests. + + * Test-HTTP-Content-Disposition.px: Added -e contentdisposition=on + option, since now HTTP Content-Disposition header support is turned + off by default. + + * Test-HTTP-Content-Disposition-1.px: Ditto. + 2007-07-25 Micah Cowan * HTTPServer.pm (run, send_response): Farmed out some logic from diff --git a/tests/Makefile.in b/tests/Makefile.in index ad244434..21d76410 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -85,28 +85,29 @@ run-unit-tests: unit-tests$(exeext) ./unit-tests$(exeext) run-px-tests: WgetTest.pm + ./Test-auth-basic.px && echo && echo ./Test-c-full.px && echo && echo ./Test-c-partial.px && echo && echo ./Test-c.px && echo && echo -# ./Test-E-k-K.px && echo && echo -# ./Test-E-k.px && echo && echo + ./Test-E-k-K.px && echo && echo + ./Test-E-k.px && echo && echo ./Test-ftp.px && echo && echo -# ./Test-HTTP-Content-Disposition.px && echo && echo -# ./Test-HTTP-Content-Disposition-1.px && echo && echo -# ./Test-HTTP-Content-Disposition-2.px && echo && echo + ./Test-HTTP-Content-Disposition-1.px && echo && echo + ./Test-HTTP-Content-Disposition-2.px && echo && echo + ./Test-HTTP-Content-Disposition.px && echo && echo ./Test-N-current.px && echo && echo -# ./Test-nonexisting-quiet.px && echo && echo -# ./Test-noop.px && echo && echo -# ./Test-np.px && echo && echo -# ./Test-N.px && echo && echo + ./Test-N-old.px && echo && echo + ./Test-nonexisting-quiet.px && echo && echo + ./Test-noop.px && echo && echo + ./Test-np.px && echo && echo + ./Test-N.px && echo && echo ./Test-O-nonexisting.px && echo && echo ./Test-O.px && echo && echo -# ./Test-Restrict-Lowercase.px && echo && echo -# ./Test-Restrict-Uppercase.px && echo && echo + ./Test-Restrict-Lowercase.px && echo && echo + ./Test-Restrict-Uppercase.px && echo && echo ./Test--spider-fail.px && echo && echo ./Test--spider.px && echo && echo ./Test--spider-r.px && echo && echo - ./Test-auth-basic.px && echo && echo WgetTest.pm: WgetTest.pm.in @top_srcdir@/config.status cd @top_srcdir@ && ./config.status diff --git a/tests/Test-HTTP-Content-Disposition-1.px b/tests/Test-HTTP-Content-Disposition-1.px index 6d295230..ffc9eb25 100755 --- a/tests/Test-HTTP-Content-Disposition-1.px +++ b/tests/Test-HTTP-Content-Disposition-1.px @@ -37,7 +37,7 @@ my %urls = ( }, ); -my $cmdline = $WgetTest::WGETPATH . " http://localhost:8080/dummy.html"; +my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:8080/dummy.html"; my $expected_error_code = 0; diff --git a/tests/Test-HTTP-Content-Disposition.px b/tests/Test-HTTP-Content-Disposition.px index 2a8fd398..0f4b285b 100755 --- a/tests/Test-HTTP-Content-Disposition.px +++ b/tests/Test-HTTP-Content-Disposition.px @@ -33,7 +33,7 @@ my %urls = ( }, ); -my $cmdline = $WgetTest::WGETPATH . " http://localhost:8080/dummy.html"; +my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:8080/dummy.html"; my $expected_error_code = 0; diff --git a/tests/Test-N-current.px b/tests/Test-N-current.px index bb5b0d92..47003c7e 100755 --- a/tests/Test-N-current.px +++ b/tests/Test-N-current.px @@ -7,7 +7,7 @@ use HTTPTest; ############################################################################### -my $wholefile = < "Dontcare", headers => { "Content-type" => "text/plain", + "Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT", }, - content => $wholefile, + content => $currentversion, }, ); -my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:8080/somefile.txt"; +my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt"; my $expected_error_code = 0; my %existing_files = ( 'somefile.txt' => { - content => $wholefile, + content => $currentversion, + timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT" }, ); my %expected_downloaded_files = ( 'somefile.txt' => { - content => $wholefile, + content => $currentversion, + timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT" }, ); diff --git a/tests/WgetTest.pm.in b/tests/WgetTest.pm.in index b20b5d8f..a57c1bb8 100644 --- a/tests/WgetTest.pm.in +++ b/tests/WgetTest.pm.in @@ -124,11 +124,17 @@ sub _setup { foreach my $filename (keys %{$self->{_existing}}) { open (FILE, ">$filename") or return "Test failed: cannot open pre-existing file $filename\n"; - - print FILE $self->{_existing}->{$filename}->{content} + + my $file = $self->{_existing}->{$filename}; + print FILE $file->{content} or return "Test failed: cannot write pre-existing file $filename\n"; - + close (FILE); + + if (exists($file->{timestamp})) { + utime $file->{timestamp}, $file->{timestamp}, $filename + or return "Test failed: cannot set timestamp on pre-existing file $filename\n"; + } } chdir ("../input");