bench-spec-ab: absolute launcher paths
A relative serve-script path plus a cd into its own directory double-counts the
prefix, so every configuration failed to start ('scripts/serve-frank-medium.sh:
No such file or directory'). The safety net did its job -- the unit was restored
-- but the run measured nothing.
This commit is contained in:
1 parent
21daf07713
commit
6e6e7187ca
1 file changed
+8
-3
@@ -39,6 +39,7 @@ constraint — it is draftless and is added to the chain unconditionally.
|
|||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -197,16 +198,20 @@ def main():
|
|||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
configs = parse_configs(args.configs) if args.configs else DEFAULT_CONFIGS
|
configs = parse_configs(args.configs) if args.configs else DEFAULT_CONFIGS
|
||||||
|
# Absolute paths: the launcher must not depend on the caller's cwd, and a
|
||||||
|
# relative path plus a `cd` to its own directory double-counts the prefix.
|
||||||
|
env_file = os.path.abspath(args.env_file)
|
||||||
|
serve_script = os.path.abspath(args.serve_script)
|
||||||
base, logfile = args.base_url, args.log
|
base, logfile = args.base_url, args.log
|
||||||
results = {}
|
results = {}
|
||||||
log("spec A/B start: " + ", ".join(n for n, _ in configs) +
|
log("spec A/B start: " + ", ".join(n for n, _ in configs) +
|
||||||
" (unit " + UNIT + " stopped for the duration)", logfile)
|
" (unit " + UNIT + " stopped for the duration)", logfile)
|
||||||
stop_unit()
|
stop_unit()
|
||||||
for name, over in configs:
|
for name, over in configs:
|
||||||
env_path = write_env(args.env_file, name, over)
|
env_path = write_env(env_file, name, over)
|
||||||
logf = "/tmp/spec-ab-" + name.replace("/", "_") + ".log"
|
logf = "/tmp/spec-ab-" + name.replace("/", "_") + ".log"
|
||||||
sh("cd " + sh("dirname " + args.serve_script) + " && FRANK_MEDIUM_ENV_FILE=" + env_path +
|
sh("FRANK_MEDIUM_ENV_FILE=" + env_path + " setsid bash " + serve_script +
|
||||||
" setsid bash " + args.serve_script + " > " + logf + " 2>&1 < /dev/null &")
|
" > " + logf + " 2>&1 < /dev/null &")
|
||||||
if not wait_health(base):
|
if not wait_health(base):
|
||||||
log(name + ": FAILED to become healthy -- " + sh("tail -3 " + logf), logfile)
|
log(name + ": FAILED to become healthy -- " + sh("tail -3 " + logf), logfile)
|
||||||
results[name] = {"error": "not healthy", "tail": sh("tail -6 " + logf)}
|
results[name] = {"error": "not healthy", "tail": sh("tail -6 " + logf)}
|
||||||
|
|||||||
Reference in new issue
Block a user