Le esecuzioni 502 e 532 si sono fermate per circa mezz'ora con tutte le prove in corso, anche quelle H.265 che non usano browser: i Chromium paralleli non sono la causa, quindi nessun limite. Ogni dotnet test ha ora --blame-hang-timeout 20m senza dump, e durante le prove .gitea/scripts/macchina.sh scrive carico, memoria, scambio e pressione in macchina.log, caricato con i .trx: alla prossima pausa si vedrà se la macchina del runner era sospesa o che cosa le mancava. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
120 lines
6.8 KiB
C#
120 lines
6.8 KiB
C#
using System.Security;
|
|
using Febe.Tests.Desktop.Support;
|
|
using Febe.Tests.Support;
|
|
|
|
namespace Febe.Tests.Packaging;
|
|
|
|
/// <summary>
|
|
/// The summary of the test results (.gitea/scripts/riepilogo-prove.sh), run on .trx files written here: the CI allows no
|
|
/// skipped test, and the only inconclusive results that do not count as skipped are the «da fare» ones of
|
|
/// H264ConformanceTests.FeaturesStillToDo, whose reason starts with «da fare: » right after the frame MSTest puts around
|
|
/// it (in English or in Italian).
|
|
/// </summary>
|
|
public sealed partial class PipelineTests
|
|
{
|
|
private const string FeaturesStillToDo = "FeaturesStillToDo (\"SVCBST-19\",\"SVC, scalabilità spaziale\")";
|
|
|
|
[TestMethod]
|
|
[Timeout(120_000, CooperativeCancellation = true)]
|
|
public async Task OnlyTheToDoConformanceStreamsMaySkipInTheCi()
|
|
{
|
|
var bash = RequireBash();
|
|
|
|
// The frames of MSTest, old and new, English and Italian: all «da fare», none skipped.
|
|
var toDo = await RunSummaryAsync(bash,
|
|
("Passed", "AnythingElse", null),
|
|
("NotExecuted", FeaturesStillToDo, "Assert.Inconclusive. da fare: SVC, scalabilità spaziale"),
|
|
("NotExecuted", FeaturesStillToDo, "Assert.Inconclusive failed. da fare: MVC, due viste, confronto bit per bit"),
|
|
("NotExecuted", FeaturesStillToDo, "Assert.Inconclusive non riuscito. da fare: MVC, tre viste"),
|
|
("Inconclusive", FeaturesStillToDo, "Assert.Inconclusive. da fare: SVC & <CGS>"));
|
|
Assert.AreEqual(0, toDo.Code, toDo.Report);
|
|
StringAssert.Contains(toDo.Output, "totale 5 · superate 1 · fallite 0 · saltate 0 · da fare 4", toDo.Report);
|
|
StringAssert.Contains(toDo.Output, " - da fare: SVC & <CGS>", toDo.Report);
|
|
|
|
// Anything else inconclusive is a skipped test, and turns the verification red: another reason in
|
|
// FeaturesStillToDo, «da fare: » not at the start of the reason, the same reason in another test.
|
|
(string Name, string Message)[] skipped =
|
|
[
|
|
(FeaturesStillToDo, "Assert.Inconclusive. da verificare: MVC, due viste"),
|
|
(FeaturesStillToDo, "Assert.Inconclusive. Manca Chromium; da fare: installarlo"),
|
|
("ChromiumStartsInTheSandbox", "Assert.Inconclusive. da fare: niente"),
|
|
("FeaturesStillToDoLater", "Assert.Inconclusive. da fare: niente"),
|
|
];
|
|
foreach (var (name, message) in skipped)
|
|
{
|
|
var run = await RunSummaryAsync(bash, ("Passed", "AnythingElse", null), ("NotExecuted", name, message));
|
|
Assert.AreEqual(1, run.Code, $"{name}: {message}\n{run.Report}");
|
|
StringAssert.Contains(run.Output, "totale 2 · superate 1 · fallite 0 · saltate 1 · da fare 0", run.Report);
|
|
StringAssert.Contains(run.Errors, "Prove saltate: 1, più delle 0 ammesse.", run.Report);
|
|
}
|
|
|
|
// The H.264 conformance tests write no other inconclusive reason: every Assert.Inconclusive there starts with it.
|
|
var source = Read(Repository.PathOf("tests", "Febe.Tests", "Media", "H264", "H264ConformanceTests.cs"));
|
|
var reasons = System.Text.RegularExpressions.Regex.Matches(source, @"Assert\.Inconclusive\(\$?""(?<reason>[^""]*)""");
|
|
Assert.IsGreaterThanOrEqualTo(3, reasons.Count);
|
|
foreach (System.Text.RegularExpressions.Match reason in reasons)
|
|
{
|
|
StringAssert.StartsWith(reason.Groups["reason"].Value, "da fare: ", reason.Value);
|
|
}
|
|
}
|
|
|
|
/// <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>
|
|
private async Task<(int Code, string Output, string Errors, string Report)> RunSummaryAsync(string bash, params (string Outcome, string Name, string? Message)[] results)
|
|
{
|
|
using var folder = new TempFolder("febe-riepilogo");
|
|
var trx = new System.Text.StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<TestRun xmlns=\"http://microsoft.com/schemas/VisualStudio/TeamTest/2010\">\n <Results>\n");
|
|
var id = 0;
|
|
foreach (var (outcome, name, message) in results)
|
|
{
|
|
trx.Append($" <UnitTestResult executionId=\"e{id}\" testId=\"t{id}\" testName=\"{SecurityElement.Escape(name)}\" computerName=\"prova\" duration=\"00:00:00.0100000\" outcome=\"{outcome}\">");
|
|
if (message is not null)
|
|
{
|
|
trx.Append($"\n <Output>\n <ErrorInfo>\n <Message>{SecurityElement.Escape(message)}</Message>\n </ErrorInfo>\n </Output>\n ");
|
|
}
|
|
|
|
trx.Append("</UnitTestResult>\n");
|
|
id++;
|
|
}
|
|
|
|
trx.Append(" </Results>\n</TestRun>\n");
|
|
await File.WriteAllTextAsync(folder.Combine("prove.trx"), trx.ToString(), TestContext.CancellationToken);
|
|
var run = await RunProcessAsync(bash, ["--noprofile", "--norc", ".gitea/scripts/riepilogo-prove.sh", folder.Path.Replace('\\', '/'), "0"], start =>
|
|
{
|
|
start.Environment.Remove("GITHUB_STEP_SUMMARY");
|
|
start.Environment.Remove("PROVE_SALTATE_AMMESSE");
|
|
});
|
|
return (run.Code, run.Output, run.Errors, $"codice {run.Code}\n{run.Output}\n{run.Errors}");
|
|
}
|
|
}
|