AtlatestRepositorycore-channel
core-channel / tree / scriptsgate-concurrency.sh
1
#!/bin/sh2
set -eu4
sigil_bin=${SIGIL_BIN:?set SIGIL_BIN to the production sigil binary}5
channel=${SIGIL_CHANNEL:-$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)}6
recipe=${1:-zlib}7
gate_root=$(mktemp -d /tmp/sigil-channel-concurrency.XXXXXX)8
store=$gate_root/store10
realize_pair() {11
label=$112
"$sigil_bin" external-build realize "$recipe" --channel "$channel" --store "$store" \13
>"$gate_root/$label.a" 2>"$gate_root/$label.a.err" &14
pid_a=$!15
"$sigil_bin" external-build realize "$recipe" --channel "$channel" --store "$store" \16
>"$gate_root/$label.b" 2>"$gate_root/$label.b.err" &17
pid_b=$!18
wait "$pid_a"19
wait "$pid_b"20
hash_a=$(tail -n 1 "$gate_root/$label.a")21
hash_b=$(tail -n 1 "$gate_root/$label.b")22
test "$hash_a" = "$hash_b"23
printf '%s statuses=0,0 hash=%s\n' "$label" "$hash_a"24
}26
# The first pair intentionally starts with neither source nor derivation in the27
# fresh store. The second pair retains the original warm-hit race coverage.28
realize_pair cold29
realize_pair warm30
printf 'transcripts=%s\n' "$gate_root"