Primo commit del progetto: motore Rust con parser HTML, cascata CSS, layout, raster CPU, formulari, bidi, flex, tabelle, JavaScript (Boa) con eventi e costruzione di nodi, rete HTTP/HTTPS con TLS, sotto-risorse, invio dei formulari; guscio grafico per Sailfish (QML/Silica) e per desktop (minifb, distribuito come AppImage), con 11 documenti di specifica e 91 casi di reftest.
58 lines
1.9 KiB
Bash
58 lines
1.9 KiB
Bash
#!/bin/sh
|
|
# Verifica della rete su pagine vere. Non fa parte della CI predefinita: esce in
|
|
# internet e dipende da servizi di terzi. Si lancia a mano o con MOSAIC_NET=1.
|
|
set -eu
|
|
|
|
RADICE=$(cd "$(dirname "$0")/.." && pwd)
|
|
RENDER="$RADICE/target/release/render"
|
|
FONT=${FONT:-/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf}
|
|
USCITA=${TMPDIR:-/tmp}
|
|
|
|
if [ ! -x "$RENDER" ]; then
|
|
echo "serve prima: cargo build --release"
|
|
exit 1
|
|
fi
|
|
|
|
fallisci=0
|
|
|
|
prova() {
|
|
descrizione=$1
|
|
url=$2
|
|
atteso=$3
|
|
if "$RENDER" --url "$url" --font "$FONT" --out "$USCITA/net-check.png" \
|
|
--size 640x480 --scale 1 >"$USCITA/net-check.json" 2>"$USCITA/net-check.err"; then
|
|
righe=$(sed -n 's/.*"lines":\([0-9]*\).*/\1/p' "$USCITA/net-check.json")
|
|
nodi=$(sed -n 's/.*"nodes":\([0-9]*\).*/\1/p' "$USCITA/net-check.json")
|
|
if [ "${nodi:-0}" -ge "$atteso" ]; then
|
|
echo "ok $descrizione (nodi $nodi, righe ${righe:-0})"
|
|
else
|
|
echo "FAIL $descrizione: nodi $nodi, attesi almeno $atteso"
|
|
fallisci=1
|
|
fi
|
|
else
|
|
echo "FAIL $descrizione: $(tail -1 "$USCITA/net-check.err")"
|
|
fallisci=1
|
|
fi
|
|
}
|
|
|
|
# HTTPS con certificato valido, corpo con Content-Length
|
|
prova "https example.com" "https://example.com/" 3
|
|
# il server di prova locale serve in chunked; qui si controlla che un 404 non blocchi
|
|
prova "http con reindirizzamento a https" "http://example.com/" 3
|
|
|
|
# un errore di rete deve uscire con codice 1 e un messaggio, non con una pagina vuota
|
|
if "$RENDER" --url "http://127.0.0.1:1/" --font "$FONT" --out "$USCITA/net-check.png" \
|
|
--size 320x200 >/dev/null 2>"$USCITA/net-check.err"; then
|
|
echo "FAIL connessione rifiutata: doveva fallire"
|
|
fallisci=1
|
|
else
|
|
if grep -q "connessione" "$USCITA/net-check.err"; then
|
|
echo "ok connessione rifiutata: messaggio esplicito"
|
|
else
|
|
echo "FAIL connessione rifiutata: messaggio inatteso"
|
|
fallisci=1
|
|
fi
|
|
fi
|
|
|
|
exit $fallisci
|