Skip to content

Commit

Permalink
better skipif
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jun 27, 2023
1 parent a25ad19 commit 1606f89
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions ext/curl/tests/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

localhost

respond / "Caddy is up and running"

# HTTP/2 Server Push
respond /serverpush "main response"
respond /serverpush/pushed "pushed response"
Expand Down
5 changes: 2 additions & 3 deletions ext/curl/tests/bug76675.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ Bug #76675 (Segfault with H2 server push write/writeheader handlers)
curl
--SKIPIF--
<?php
if (!@fsockopen("localhost", 443, $errno, $errstr, 0.5)) {
die("skip test needs Caddy");
}
include 'skipif-nocaddy.inc';

$curl_version = curl_version();
if ($curl_version['version_number'] < 0x073d00) {
exit("skip: test may crash with curl < 7.61.0");
Expand Down
5 changes: 2 additions & 3 deletions ext/curl/tests/bug77535.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ Bug #77535 (Invalid callback, h2 server push)
curl
--SKIPIF--
<?php
if (!@fsockopen("localhost", 443, $errno, $errstr, 0.5)) {
die("skip test needs Caddy");
}
include 'skipif-nocaddy.inc';

$curl_version = curl_version();
if ($curl_version['version_number'] < 0x073d00) {
exit("skip: test may crash with curl < 7.61.0");
Expand Down
5 changes: 2 additions & 3 deletions ext/curl/tests/curl_pushfunction.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ Kévin Dunglas
curl
--SKIPIF--
<?php
if (!@fsockopen("localhost", 443, $errno, $errstr, 0.5)) {
die("skip test needs Caddy");
}
include 'skipif-nocaddy.inc';

$curl_version = curl_version();
if ($curl_version['version_number'] < 0x073d00) {
exit("skip: test may crash with curl < 7.61.0");
Expand Down
12 changes: 12 additions & 0 deletions ext/curl/tests/skipif-nocaddy.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$ch = curl_init("https://localhost");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$body = curl_exec($ch);

curl_close($ch);

if ($body !== "Caddy is up and running") {
die("skip test needs Caddy");
}

0 comments on commit 1606f89

Please sign in to comment.