[bench] Conformance: the slow-client probes (a TLS handshake that never starts, an HTTP/2 header block that never ends) against both engines, and Caddy's real version from the binary's build info

This commit is contained in:
2026-11-22 19:04:59 +01:00
parent 142f0bedf7
commit facf4422c8
2 changed files with 42 additions and 6 deletions
+29 -5
View File
@@ -95,6 +95,34 @@ mod unix {
}
}
/// `caddy version`, or, for a `go install`ed Caddy that says "unknown", its module version
/// from the binary's build info (`go version -m`).
fn caddy_version(caddy: &std::path::Path) -> String {
let out = |cmd: &mut std::process::Command| {
cmd.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default()
};
let v = out(std::process::Command::new(caddy).arg("version"));
if !v.is_empty() && v != "unknown" {
return v;
}
let info = out(std::process::Command::new("go")
.args(["version", "-m"])
.arg(caddy));
info.lines()
.map(|l| l.split_whitespace().collect::<Vec<_>>())
.find(|f| f.len() >= 3 && f[0] == "mod" && f[1] == "github.com/caddyserver/caddy/v2")
.map(|f| {
format!(
"{} (go install; {})",
f[2],
info.lines().next().unwrap_or("").trim()
)
})
.unwrap_or(v)
}
fn addrs(t: &Target) -> serde_json::Value {
json!({ "http": t.http.to_string(), "https": t.https.to_string() })
}
@@ -158,11 +186,7 @@ mod unix {
&caddy2_cfg,
&[("GOMAXPROCS", "2")],
);
let caddy_version = std::process::Command::new(&caddy)
.arg("version")
.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default();
let caddy_version = caddy_version(&caddy);
println!(
"{}",