Merge pull request 'CI: le prove ferme si chiudono da sole e si vede lo stato della macchina' (#78) from correzione/prove-interfaccia-ferme into main
This commit was merged in pull request #78.
This commit is contained in:
commit
862f99562a
7 files changed
+105
-4
No files matched your search
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# The state of the machine while the tests run: every few seconds one line with the time, the load and the available
|
||||||
|
# memory and swap of the runner host and, where the kernel offers them, its CPU, memory and disk pressure (PSI). Runs
|
||||||
|
# 502 and 532 stopped for half an hour with every test in progress, browser or not: a hole in the times of this file
|
||||||
|
# says the host (or the container) was suspended, lines without holes say what it was short of.
|
||||||
|
#
|
||||||
|
# .gitea/scripts/macchina.sh <file> [secondi fra una riga e l'altra] [righe, 0 = senza fine]
|
||||||
|
#
|
||||||
|
# It runs in the background of the test step, which ends it. Only numbers of the machine: no names, paths or tokens.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
file="${1:?Indica il file da scrivere.}"
|
||||||
|
ogni="${2:-15}"
|
||||||
|
righe="${3:-0}"
|
||||||
|
[[ "$ogni" =~ ^[0-9]+$ && "$righe" =~ ^[0-9]+$ ]] || { echo "I secondi e le righe devono essere numeri interi." >&2; exit 2; }
|
||||||
|
mkdir -p "$(dirname "$file")"
|
||||||
|
|
||||||
|
# One value of /proc/meminfo, in MB; nothing where there is no /proc.
|
||||||
|
memoria() {
|
||||||
|
awk -v nome="$1:" '$1 == nome { printf "%d", $2 / 1024 }' /proc/meminfo 2> /dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# The ten-second average of the «some» line of one PSI file; nothing where the kernel does not offer it.
|
||||||
|
pressione() {
|
||||||
|
awk '$1 == "some" { sub(/^avg10=/, "", $2); printf "%s", $2 }' "/proc/pressure/$1" 2> /dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
fatte=0
|
||||||
|
while :; do
|
||||||
|
carico=$(cut -d ' ' -f 1-3 /proc/loadavg 2> /dev/null || true)
|
||||||
|
printf '%s carico=%s memoria=%s MB scambio=%s MB psi cpu=%s memoria=%s disco=%s\n' \
|
||||||
|
"$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$carico" "$(memoria MemAvailable)" "$(memoria SwapFree)" \
|
||||||
|
"$(pressione cpu)" "$(pressione memory)" "$(pressione io)" >> "$file"
|
||||||
|
fatte=$((fatte + 1))
|
||||||
|
if ((righe > 0 && fatte >= righe)); then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# With no share in the output of the step: killing the script must not leave the step waiting for this sleep.
|
||||||
|
sleep "$ogni" > /dev/null 2>&1
|
||||||
|
done
|
||||||
@@ -103,9 +103,13 @@ jobs:
|
|||||||
- name: Compilazione (avvisi = errori)
|
- name: Compilazione (avvisi = errori)
|
||||||
run: dotnet build Febe.slnx -c Release -nologo -warnaserror
|
run: dotnet build Febe.slnx -c Release -nologo -warnaserror
|
||||||
|
|
||||||
|
# As in the verification: twenty minutes without a test that starts or ends (the longest take 2 to 3) end the
|
||||||
|
# run and name the tests in progress, instead of a job that waits for the runner's own limit; no dump: one of
|
||||||
|
# the test host, with its managed heap, can take gigabytes in the febe-ci package.
|
||||||
- name: Prove
|
- name: Prove
|
||||||
run: >-
|
run: >-
|
||||||
dotnet test tests/Febe.Tests -c Release --no-build --nologo
|
dotnet test tests/Febe.Tests -c Release --no-build --nologo
|
||||||
|
--blame-hang-timeout 20m --blame-hang-dump-type none
|
||||||
--logger "trx;LogFileName=prove.trx" --results-directory out/prove
|
--logger "trx;LogFileName=prove.trx" --results-directory out/prove
|
||||||
|
|
||||||
# No skipped test: an inconclusive test (for example without Chromium) stops the release.
|
# No skipped test: an inconclusive test (for example without Chromium) stops the release.
|
||||||
|
|||||||
@@ -174,10 +174,17 @@ jobs:
|
|||||||
- name: Compilazione di tutta la soluzione (avvisi = errori)
|
- name: Compilazione di tutta la soluzione (avvisi = errori)
|
||||||
run: dotnet build Febe.slnx -c Release -nologo -warnaserror
|
run: dotnet build Febe.slnx -c Release -nologo -warnaserror
|
||||||
|
|
||||||
|
# Twenty minutes without a test that starts or ends (the longest take 2 to 3) end the run and name the tests in
|
||||||
|
# progress, instead of a job that waits for the runner's own limit; no dump: one of the test host, with its
|
||||||
|
# managed heap, can take gigabytes in the febe-ci package.
|
||||||
- name: Prove, seme 13
|
- name: Prove, seme 13
|
||||||
run: >-
|
run: |
|
||||||
dotnet test tests/Febe.Tests -c Release --no-build --nologo
|
bash .gitea/scripts/macchina.sh out/prove/macchina.log &
|
||||||
--logger "trx;LogFileName=prove-seme-13.trx" --results-directory out/prove
|
macchina=$!
|
||||||
|
trap 'kill "$macchina" 2> /dev/null || true' EXIT
|
||||||
|
dotnet test tests/Febe.Tests -c Release --no-build --nologo \
|
||||||
|
--blame-hang-timeout 20m --blame-hang-dump-type none \
|
||||||
|
--logger "trx;LogFileName=prove-seme-13.trx" --results-directory out/prove
|
||||||
|
|
||||||
- name: Prove del sito di prova, seme dell'esecuzione
|
- name: Prove del sito di prova, seme dell'esecuzione
|
||||||
if: ${{ !cancelled() && steps.semi.outputs.seme != '' }}
|
if: ${{ !cancelled() && steps.semi.outputs.seme != '' }}
|
||||||
@@ -185,6 +192,7 @@ jobs:
|
|||||||
FEBE_SEME_PROVA: ${{ steps.semi.outputs.seme }}
|
FEBE_SEME_PROVA: ${{ steps.semi.outputs.seme }}
|
||||||
run: >-
|
run: >-
|
||||||
dotnet test tests/Febe.Tests -c Release --no-build --nologo --filter "TestCategory=SitoDiProva"
|
dotnet test tests/Febe.Tests -c Release --no-build --nologo --filter "TestCategory=SitoDiProva"
|
||||||
|
--blame-hang-timeout 20m --blame-hang-dump-type none
|
||||||
--logger "trx;LogFileName=prove-seme-$FEBE_SEME_PROVA.trx" --results-directory out/prove
|
--logger "trx;LogFileName=prove-seme-$FEBE_SEME_PROVA.trx" --results-directory out/prove
|
||||||
|
|
||||||
- name: Riepilogo delle prove
|
- name: Riepilogo delle prove
|
||||||
@@ -201,6 +209,7 @@ jobs:
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
risultati=(out/prove/*.trx)
|
risultati=(out/prove/*.trx)
|
||||||
((${#risultati[@]} > 0)) || { echo "::warning::Nessun risultato delle prove da conservare."; exit 0; }
|
((${#risultati[@]} > 0)) || { echo "::warning::Nessun risultato delle prove da conservare."; exit 0; }
|
||||||
|
[ ! -f out/prove/macchina.log ] || risultati+=(out/prove/macchina.log)
|
||||||
bash .gitea/scripts/artefatti.sh verifica "${risultati[@]}"
|
bash .gitea/scripts/artefatti.sh verifica "${risultati[@]}"
|
||||||
|
|
||||||
installatore:
|
installatore:
|
||||||
|
|||||||
@@ -661,3 +661,4 @@ Ogni scelta tecnica presa strada facendo, con data e motivo (specifica §15).
|
|||||||
| 2026-11-29 | Commenti in inglese anche negli script di shell di `.gitea/scripts/` e `installer/`, nei blocchi `run:` dei flussi di `.gitea/workflows/` e in `docker/entrypoint.sh`; restano in italiano i messaggi che una persona legge (`echo`, `::warning::`/`::error::`, nomi dei passi, note della release, istruzioni d'uso), come nel resto del codice. Decisione di Alberto (#43) | La regola «codice e commenti in inglese; interfaccia, documenti e messaggi in italiano» vale per tutto il repository, script compresi: nessuna eccezione per la CI |
|
| 2026-11-29 | Commenti in inglese anche negli script di shell di `.gitea/scripts/` e `installer/`, nei blocchi `run:` dei flussi di `.gitea/workflows/` e in `docker/entrypoint.sh`; restano in italiano i messaggi che una persona legge (`echo`, `::warning::`/`::error::`, nomi dei passi, note della release, istruzioni d'uso), come nel resto del codice. Decisione di Alberto (#43) | La regola «codice e commenti in inglese; interfaccia, documenti e messaggi in italiano» vale per tutto il repository, script compresi: nessuna eccezione per la CI |
|
||||||
| 2026-11-29 | **Subito dopo «Scollega», con l'indirizzo della pagina sconosciuto** (il browser non risponde ancora, `FullUrlAsync` dà `null`), Febe aspetta che il browser risponda, entro un limite; se ancora non risponde apre la pagina di accesso (#67). Fatto così: `BrowserConnectionService` chiede l'indirizzo ogni 200 ms (`AddressPoll`, con `IClock`) per al più 10 s (`AddressWait`), poi apre la pagina di accesso o d'inizio; se anche la navigazione non riesce, la finestra resta su e il registro dice «Alberto usa il browser: … non aperta (il browser non risponde).» | Decisione di Alberto del 29 novembre 2026: senza sapere quale pagina mostra il browser non si può dire se è già quella di accesso; aspettare un poco evita di ricaricare una pagina che sta arrivando, e il limite evita di restare fermi |
|
| 2026-11-29 | **Subito dopo «Scollega», con l'indirizzo della pagina sconosciuto** (il browser non risponde ancora, `FullUrlAsync` dà `null`), Febe aspetta che il browser risponda, entro un limite; se ancora non risponde apre la pagina di accesso (#67). Fatto così: `BrowserConnectionService` chiede l'indirizzo ogni 200 ms (`AddressPoll`, con `IClock`) per al più 10 s (`AddressWait`), poi apre la pagina di accesso o d'inizio; se anche la navigazione non riesce, la finestra resta su e il registro dice «Alberto usa il browser: … non aperta (il browser non risponde).» | Decisione di Alberto del 29 novembre 2026: senza sapere quale pagina mostra il browser non si può dire se è già quella di accesso; aspettare un poco evita di ricaricare una pagina che sta arrivando, e il limite evita di restare fermi |
|
||||||
| 2026-11-29 | **Il motore non rimette a riposo la pagina che Alberto ha appena ripreso**: a fine sessione e dopo la guida di Alberto il riposo (`about:blank`) si dà solo se, ottenuto il turno, Alberto non guida il browser e l'interruttore non è su Verifica o Scollegato (`KeepsPageAfterWaitingForTurn`); `IsRunning` si accende in `StartAsync` prima di avviare il lavoro | Le prove del desktop su #67 cadevano a volte: fra il controllo e il turno Alberto poteva riprendere il browser, e il motore gli toglieva la pagina. Resta una finestra stretta fra il turno e la navigazione, scritta in `docs/stato.md` |
|
| 2026-11-29 | **Il motore non rimette a riposo la pagina che Alberto ha appena ripreso**: a fine sessione e dopo la guida di Alberto il riposo (`about:blank`) si dà solo se, ottenuto il turno, Alberto non guida il browser e l'interruttore non è su Verifica o Scollegato (`KeepsPageAfterWaitingForTurn`); `IsRunning` si accende in `StartAsync` prima di avviare il lavoro | Le prove del desktop su #67 cadevano a volte: fra il controllo e il turno Alberto poteva riprendere il browser, e il motore gli toglieva la pagina. Resta una finestra stretta fra il turno e la navigazione, scritta in `docs/stato.md` |
|
||||||
|
| 2026-12-01 | **Prove ferme nella CI (502 e 532): `--blame-hang-timeout 20m --blame-hang-dump-type none` su ogni `dotnet test` e lo stato della macchina durante le prove** (`.gitea/scripts/macchina.sh`: ogni 15 s ora, carico, memoria, scambio e pressione PSI in `macchina.log`, nel pacchetto `febe-ci` con i `.trx`). Nessun limite ai Chromium paralleli | Nelle due pause si sono fermate insieme tutte le prove in corso, anche le H.265, che non usano browser (aperti solo 5 e 3 Chromium), e tutto è ripartito insieme: un limite a 4 Chromium non le avrebbe evitate e allunga le prove (da 242 a 332 s in una misura sola, nell'immagine della CI in locale). Il quadro fa pensare alla macchina del runner (memoria, disco o sospensione), ma non è verificato: un buco negli orari di `macchina.log` dirà una sospensione, le righe senza buchi che cosa mancava. Venti minuti senza una prova che comincia o finisce chiudono l'esecuzione con i nomi delle prove in corso; niente dump, che può pesare gigabyte nel pacchetto |
|
||||||
@@ -51,6 +51,11 @@ fra le sessioni; ciò che è da fare si legge nelle issue aperte.
|
|||||||
(anche le prove H.265 da 1 s), e due prove d'interfaccia nuove sono scadute in quella pausa; la stessa revisione
|
(anche le prove H.265 da 1 s), e due prove d'interfaccia nuove sono scadute in quella pausa; la stessa revisione
|
||||||
nell'immagine della CI in locale è verde in 10 m 33 s e nel codice di E3 non c'è nulla che blocchi i thread. Se si
|
nell'immagine della CI in locale è verde in 10 m 33 s e nel codice di E3 non c'è nulla che blocchi i thread. Se si
|
||||||
ripete, il prossimo passo è limitare i Chromium paralleli nelle prove (`UiBrowser`) e aggiungere `--blame-hang`.
|
ripete, il prossimo passo è limitare i Chromium paralleli nelle prove (`UiBrowser`) e aggiungere `--blame-hang`.
|
||||||
|
Si è ripetuto nella 532 (29/11, 28 minuti). I `.trx` dicono che **i Chromium non sono la causa**: si sono fermate
|
||||||
|
insieme anche le prove H.265, con 3 e 5 browser aperti. Perciò nessun limite ai browser; aggiunti (1/12)
|
||||||
|
`--blame-hang-timeout 20m` e `macchina.log` (carico, memoria e pressione della macchina durante le prove, nel pacchetto
|
||||||
|
`febe-ci`). La causa resta da trovare: da guardare la macchina del runner, memoria, scambio, disco e sospensione, del
|
||||||
|
28/11 11:38–12:20 e del 29/11 12:55–13:23 UTC.
|
||||||
La 510 è stata verde alla seconda prova: al primo giro la prova da capo a fondo con il sito di prova
|
La 510 è stata verde alla seconda prova: al primo giro la prova da capo a fondo con il sito di prova
|
||||||
(`TheRealServerCollectsFromTheTestSite…`) ha passato i 90 s, come già una volta prima di E3 (2 min 10 s nella 107).
|
(`TheRealServerCollectsFromTheTestSite…`) ha passato i 90 s, come già una volta prima di E3 (2 min 10 s nella 107).
|
||||||
Dopo l'unione la 518 di main è caduta nell'immagine su `APreviewPastItsBudgetSaysToUseTheFolderOfTheCopies`: con
|
Dopo l'unione la 518 di main è caduta nell'immagine su `APreviewPastItsBudgetSaysToUseTheFolderOfTheCopies`: con
|
||||||
|
|||||||
@@ -58,6 +58,37 @@ public sealed partial class PipelineTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The state of the machine sampled while the tests run (runs 502 and 532 stopped with every test in progress): the
|
||||||
|
/// test step starts it, ends it and keeps the result of the tests; the log goes up with the .trx files.
|
||||||
|
/// </summary>
|
||||||
|
[TestMethod]
|
||||||
|
public async Task TheVerificationKeepsTheStateOfTheMachineDuringTheTests()
|
||||||
|
{
|
||||||
|
var tests = Code(Workflow("verifica.yml"));
|
||||||
|
StringAssert.Contains(tests, "bash .gitea/scripts/macchina.sh out/prove/macchina.log &");
|
||||||
|
StringAssert.Contains(tests, "trap 'kill \"$macchina\" 2> /dev/null || true' EXIT");
|
||||||
|
StringAssert.Contains(tests, "risultati+=(out/prove/macchina.log)");
|
||||||
|
|
||||||
|
CiPath("scripts", "macchina.sh");
|
||||||
|
var bash = RequireBash();
|
||||||
|
using var folder = new TempFolder("febe-macchina");
|
||||||
|
var log = folder.Combine("prove", "macchina.log");
|
||||||
|
var run = await RunProcessAsync(bash, ["--noprofile", "--norc", ".gitea/scripts/macchina.sh", log.Replace('\\', '/'), "0", "3"]);
|
||||||
|
Assert.AreEqual(0, run.Code, run.Errors);
|
||||||
|
var lines = await File.ReadAllLinesAsync(log, TestContext.CancellationToken);
|
||||||
|
Assert.HasCount(3, lines);
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
StringAssert.Matches(line, MachineLine());
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.AreEqual(2, (await RunProcessAsync(bash, ["--noprofile", "--norc", ".gitea/scripts/macchina.sh", log.Replace('\\', '/'), "presto"])).Code);
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Text.RegularExpressions.GeneratedRegex(@"^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ carico=[\d. ]* memoria=\d* MB scambio=\d* MB psi cpu=[\d.]* memoria=[\d.]* disco=[\d.]*$")]
|
||||||
|
private static partial System.Text.RegularExpressions.Regex MachineLine();
|
||||||
|
|
||||||
/// <summary>riepilogo-prove.sh with no skipped test allowed, on one .trx file of the given results.</summary>
|
/// <summary>riepilogo-prove.sh with no skipped test allowed, on one .trx file of the given results.</summary>
|
||||||
private async Task<(int Code, string Output, string Errors, string Report)> RunSummaryAsync(string bash, params (string Outcome, string Name, string? Message)[] results)
|
private async Task<(int Code, string Output, string Errors, string Report)> RunSummaryAsync(string bash, params (string Outcome, string Name, string? Message)[] results)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -122,12 +122,23 @@ public sealed partial class PipelineTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tests/Febe.Tests.Windows runs only on Windows: never «dotnet test» on the solution or without a project.
|
// tests/Febe.Tests.Windows runs only on Windows: never «dotnet test» on the solution or without a project.
|
||||||
|
// Every run of the tests ends, naming the culprit, when a test is stuck for 20 minutes (no dump of the test host).
|
||||||
foreach (var name in new[] { "verifica.yml", "rilascio.yml" })
|
foreach (var name in new[] { "verifica.yml", "rilascio.yml" })
|
||||||
{
|
{
|
||||||
foreach (Match test in DotnetTest().Matches(Code(Workflow(name))))
|
var code = Code(Workflow(name));
|
||||||
|
var runs = 0;
|
||||||
|
foreach (Match test in DotnetTest().Matches(code))
|
||||||
{
|
{
|
||||||
Assert.AreEqual("tests/Febe.Tests", test.Groups["target"].Value, $"{name}: {test.Value}");
|
Assert.AreEqual("tests/Febe.Tests", test.Groups["target"].Value, $"{name}: {test.Value}");
|
||||||
|
var end = code.IndexOf("--results-directory", test.Index, StringComparison.Ordinal);
|
||||||
|
if (code.AsSpan(test.Index + test.Length).StartsWith(" -c Release") && end > test.Index)
|
||||||
|
{
|
||||||
|
runs++;
|
||||||
|
StringAssert.Contains(code[test.Index..end], "--blame-hang-timeout 20m --blame-hang-dump-type none", $"{name}: {test.Value}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert.AreEqual(name == "verifica.yml" ? 2 : 1, runs, $"{name}: le esecuzioni delle prove");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user