-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtest-process-tree.sh
More file actions
executable file
·34 lines (34 loc) · 1.02 KB
/
Copy pathtest-process-tree.sh
File metadata and controls
executable file
·34 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
set -eu
if [ "${1:-}" = --version ]; then
printf 'fixture 1\n'
exit 0
fi
if [ "${1:-}" = run ]; then
printf 'ready helper=%s\n' "${LATE_HELPER:-0}"
if [ "${LATE_HELPER:-0}" = 1 ]; then
sleep 1
sleep 30 &
wait
else
exec sleep 30
fi
exit 0
fi
script_dir="$(cd "${BASH_SOURCE[0]%/*}" && pwd)"
self="$script_dir/${BASH_SOURCE[0]##*/}"
root="$(mktemp -d)"
cleanup() { rm -rf "$root"; }
trap cleanup EXIT
mkdir -p "$root/work/.git" "$root/home"
run_case() {
label="$1"
helper="$2"
printf 'command: LATE_HELPER=%s IDLE_SECONDS=2 SETTLE_SECONDS=2 STARTUP_RUNS=1 STARTUP_WARMUP=0 WORKDIR=%s %s %s %s %s run\n' \
"$helper" "$root/work" "$script_dir/measure-cli.sh" "$label" "$root/home" "$self"
BENCH_ENV=LATE_HELPER LATE_HELPER="$helper" IDLE_SECONDS=2 SETTLE_SECONDS=2 STARTUP_RUNS=1 STARTUP_WARMUP=0 \
WORKDIR="$root/work" "$script_dir/measure-cli.sh" "$label" "$root/home" "$self" run |
awk '/phase=proc / || /phase=summary /'
}
run_case helper-one-second 1
run_case no-helper 0