From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9C52D1F5AF for ; Sun, 5 Jul 2020 23:28:09 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 20/43] xt/httpd-async-stream: allow more options Date: Sun, 5 Jul 2020 23:27:36 +0000 Message-Id: <20200705232759.3161-21-e@yhbt.net> In-Reply-To: <20200705232759.3161-1-e@yhbt.net> References: <20200705232759.3161-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We want to be able to parallelize and stress test more endpoints and toggle `--compressed' and possibly other options in curl. --- xt/httpd-async-stream.t | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xt/httpd-async-stream.t b/xt/httpd-async-stream.t index 29bcb6125..22a96875d 100644 --- a/xt/httpd-async-stream.t +++ b/xt/httpd-async-stream.t @@ -15,7 +15,12 @@ my $curl = which('curl') or plan skip_all => "curl(1) missing for $0"; my ($tmpdir, $for_destroy) = tmpdir(); require_mods(qw(DBD::SQLite)); my $JOBS = $ENV{TEST_JOBS} // 4; -diag "TEST_JOBS=$JOBS"; +my $endpoint = $ENV{TEST_ENDPOINT} // 'all.mbox.gz'; +my $curl_opt = $ENV{TEST_CURL_OPT} // ''; +diag "TEST_JOBS=$JOBS TEST_ENDPOINT=$endpoint TEST_CURL_OPT=$curl_opt"; + +# we set Host: to ensure stable results across test runs +my @CURL_OPT = (qw(-HHost:example.com -sSf), split(' ', $curl_opt)); my $make_local_server = sub { my $pi_config = "$tmpdir/config"; @@ -38,7 +43,7 @@ address = test\@example.com my $cmd = [ '-httpd', "--stdout=$out", "--stderr=$err", '-W0' ]; my $host_port = $http->sockhost.':'.$http->sockport; push @$cmd, "-lhttp://$host_port"; - my $url = "$host_port/test/all.mbox.gz"; + my $url = "$host_port/test/$endpoint"; print STDERR "# CMD ". join(' ', @$cmd). "\n"; my $env = { PI_CONFIG => $pi_config }; (start_script($cmd, $env, $rdr), $url); @@ -53,7 +58,7 @@ my $do_get_all = sub { my ($buf, $nr); my $bytes = 0; my $t0 = now(); - my ($rd, $pid) = popen_rd([$curl, qw(-HHost:example.com -sSf), $url]); + my ($rd, $pid) = popen_rd([$curl, @CURL_OPT, $url]); while (1) { $nr = sysread($rd, $buf, 65536); last if !$nr;