user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/6] t/cgi.t: eliminate some cruft and unnecessary tests
  2019-01-04 13:10  6% [PATCH 0/6] t/cgi.t: test speedups and cleanups Eric Wong
@ 2019-01-04 13:10  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-01-04 13:10 UTC (permalink / raw)
  To: meta

More of this test will be, we use PSGI nowadays; and
most of these tests can be ported over to use PSGI and
not fork+exec as much.
---
 t/cgi.t | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/t/cgi.t b/t/cgi.t
index d92749b..ac2c69f 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -48,9 +48,8 @@ my $im = PublicInbox::Import->new($git, 'test', $addr);
 {
 	local $ENV{HOME} = $home;
 
-	# ensure successful message delivery
-	{
-		my $mime = Email::MIME->new(<<EOF);
+	# inject some messages:
+	my $mime = Email::MIME->new(<<EOF);
 From: Me <me\@example.com>
 To: You <you\@example.com>
 Cc: $addr
@@ -60,15 +59,10 @@ Date: Thu, 01 Jan 1970 00:00:00 +0000
 
 zzzzzz
 EOF
-		$im->add($mime);
-		$im->done;
-		my $rev = `git --git-dir=$maindir rev-list HEAD`;
-		like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
-	}
+	$im->add($mime);
 
 	# deliver a reply, too
-	{
-		my $reply = Email::MIME->new(<<EOF);
+	my $reply = Email::MIME->new(<<EOF);
 From: You <you\@example.com>
 To: Me <me\@example.com>
 Cc: $addr
@@ -82,12 +76,8 @@ Me wrote:
 
 what?
 EOF
-		$im->add($reply);
-		$im->done;
-		my $rev = `git --git-dir=$maindir rev-list HEAD`;
-		like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
-	}
-
+	$im->add($reply);
+	$im->done;
 }
 
 # obvious failures, first
@@ -118,7 +108,7 @@ EOF
 	like($res->{head}, qr/Status:\s*206/i, "info/refs partial past end OK");
 	is($res->{body}, substr($orig, 5), 'partial body OK past end');
 }
-use Data::Dumper;
+
 # atom feeds
 {
 	local $ENV{HOME} = $home;
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/6] t/cgi.t: test speedups and cleanups
@ 2019-01-04 13:10  6% Eric Wong
  2019-01-04 13:10  7% ` [PATCH 1/6] t/cgi.t: eliminate some cruft and unnecessary tests Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-01-04 13:10 UTC (permalink / raw)
  To: meta

While we relied on CGI.pm early in the project, we've moved onto PSGI
and relied on PSGI for providing CGI compatibility.  Thus, most of our
CGI-based tests are redundant and Perl startup overhead is painful.

On my system, this cuts the t/cgi.t from 4.4s to 1.8s for a nice
improvement.  Moving some tests to t/plack.t did not increase runtimes
in a meaningful way.

Eric Wong (6):
  t/cgi.t: eliminate some cruft and unnecessary tests
  t/cgi.t: remove redundant redirect check
  t/cgi.t: remove atom.xml test
  t/cgi.t: move dumb HTTP git clone/fetch tests to plack.t
  t/cgi.t: move expected failure tests to t/plack.t
  t/cgi.t: remove more redundant tests

 t/cgi.t   | 105 ++++++++----------------------------------------------
 t/plack.t |  43 ++++++++++++++++++++--
 2 files changed, 54 insertions(+), 94 deletions(-)

-- 
EW

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-01-04 13:10  6% [PATCH 0/6] t/cgi.t: test speedups and cleanups Eric Wong
2019-01-04 13:10  7% ` [PATCH 1/6] t/cgi.t: eliminate some cruft and unnecessary tests Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).