Add a run_with_h2get helper function
@@ -12,7 +12,7 @@ use Test::More;
use Time::HiRes qw(sleep);
use base qw(Exporter);
-our @EXPORT = qw(ASSETS_DIR DOC_ROOT bindir server_features exec_unittest exec_mruby_unittest spawn_server spawn_h2o empty_ports create_data_file md5_file prog_exists run_prog openssl_can_negotiate curl_supports_http2 run_with_curl);
+our @EXPORT = qw(ASSETS_DIR DOC_ROOT bindir server_features exec_unittest exec_mruby_unittest spawn_server spawn_h2o empty_ports create_data_file md5_file prog_exists run_prog openssl_can_negotiate curl_supports_http2 run_with_curl run_with_h2get);
use constant ASSETS_DIR => 't/assets';
use constant DOC_ROOT => ASSETS_DIR . "/doc_root";
@@ -279,4 +279,14 @@ sub run_with_curl {
};
}
+sub run_with_h2get {
+ my ($server, $script) = @_;
+ plan skip_all => "h2get not found"
+ unless prog_exists($ENV{"H2O_ROOT"}."/h2get_bin/h2get");
+ my ($scriptfh, $scriptfn) = tempfile(UNLINK => 1);
+ print $scriptfh $script;
+ close($scriptfh);
+ return run_prog($ENV{"H2O_ROOT"}."/h2get_bin/h2get $scriptfn https://127.0.0.1:$server->{tls_port}");
+}
+
1;
