okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
53623e56f
main
1#!/usr/bin/env bash 2# One arm of the A/B harness (scripts/ab-run.sh, the report's own copy of the 3# harness), with everything it produced archived into the report's data/ 4# folder: the engine log slice (startup lines plus the requests), both arms' 5# JSON, both server outputs and the printed summary. 6# 7# Usage: run-arm.sh LABEL [ab-run.sh extras ...] 8# e.g. run-arm.sh pipeline-off --arg --pipeline-windows 1 9set -u 10REPORT =" $( cd -- " $( dirname -- " $ 0" ) /.." && pwd ) " 11ROOT =" $( cd -- " $ REPORT /../../.." && pwd ) " 12DATA =$ REPORT /data 13WORK =$ DATA /ab-work 14LOG =$ ROOT /strata-coder-iq1_m.log 15LABEL =$ 1 ;shift 16 17mkdir -p " $ DATA " " $ WORK " 18off =$( stat -c %s " $ LOG " 2 > /dev/null || echo 0) 19echo "[run-arm $ LABEL ] engine log offset $ off , $( date -Is ) " 20 21# run-all.sh writes its extras the way build_cfg.py spells them ("--arg FLAG 22# VALUE"), but ab-run.sh takes bare (FLAG, VALUE) pairs and crashes on a stray 23# "--arg", so the markers are dropped here. 24args =() 25for a in " $ @" ;do 26 [" $ a " ="--arg" ]&& continue 27args +=(" $ a " ) 28done 29 30AB_OUT =" $ WORK " bash " $ REPORT /scripts/ab-run.sh" " $ LABEL " " ${ args [@]} " \ 31> " $ WORK /run.out" 2 >&1 32rc =$ ? 33cp " $ WORK /run.out" " $ DATA /ab- $ LABEL -run.out" 34tail -c +$((off + 1))" $ LOG " > " $ DATA /engine-ab- $ LABEL .log" 35for f in A B;do 36 [ -f" $ WORK / $ f .json" ]&& cp " $ WORK / $ f .json" " $ DATA /ab- $ LABEL - $ f .json" 37 [ -f" $ WORK /server- $ f .out" ]&& cp " $ WORK /server- $ f .out" " $ DATA /ab- $ LABEL -server- $ f .out" 38done 39cfgB =$ WORK /cfg-$ LABEL-B.json 40[ -f" $ cfgB " ]&& cp " $ cfgB " " $ DATA /cfg- $ LABEL -B.json" 41rm -rf " $ WORK " 42echo "[run-arm $ LABEL ] ab-run.sh exit $ rc , $( date -Is ) " 43exit $ rc