AtlatestRepositorysigil-http3

sigil-http3 / tree / scriptsphantom-lifecycle-check.sh

1#!/usr/bin/env bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4mkdir -p build/lifecycle/certificate .deps
5lifecycle_result="$PWD/build/lifecycle-result.txt"
6record_result() {
7 local job_rc=$?
8 printf 'RESULT lifecycle-job rc=%s\n' "$job_rc" | tee -a "$lifecycle_result"
9}
10trap record_result EXIT
11printf 'RESULT lifecycle-fixture=socket-free-not-interop page-host=loopback-https-only\n' | tee "$lifecycle_result"
12if [ ! -e .deps/sigil-quic ]; then bash scripts/prepare-quic.sh; fi
13test "$(git -C .deps/sigil-quic rev-parse HEAD)" = "$(cat quic.rev)"
14openssl_command=(openssl)
15if ! command -v openssl >/dev/null; then
16 openssl_command=(guix shell openssl -- openssl)
17fi
18chmod 700 build/lifecycle/certificate
19timeout --foreground 180 "${openssl_command[@]}" genpkey \
20 -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out build/lifecycle/certificate/key.pem
21chmod 600 build/lifecycle/certificate/key.pem
22timeout --foreground 180 "${openssl_command[@]}" req \
23 -new -x509 -key build/lifecycle/certificate/key.pem -out build/lifecycle/certificate/cert.pem \
24 -days 13 -sha256 -subj /CN=localhost -addext subjectAltName=IP:127.0.0.1,DNS:localhost
25node scripts/prepare-certificate.mjs "$PWD/build/lifecycle/certificate"
26timeout --foreground 60 node --test test/test-echo-lifecycle.mjs test/test-phone-page-host.mjs 2>&1 | tee build/lifecycle-tests.log
27printf 'RESULT lifecycle-checks=PASS page-host-loopback-only no-vpn-deployment\n' | tee -a "$lifecycle_result"