Files
Febe/tests/Febe.Tests/Packaging/PipelineTests.Riepilogo.cs
T
Alby96andClaude Opus 5.5 cdc3cc11b9 Correzioni dopo la revisione del decodificatore H.264, dei lettori FLV e della CI (#58)
- CI: le due prove MVC di FeaturesStillToDo finivano con «da verificare: …», che
  riepilogo-prove.sh contava come saltate: ogni verifica del ramo sarebbe fallita.
  Ora cominciano con «da fare: », e lo script esenta solo le inconclusive di
  FeaturesStillToDo il cui motivo comincia con «da fare: » subito dopo la cornice
  di MSTest (prima bastava la parola in qualunque punto di qualunque prova).
  PipelineTests prova lo script su .trx con le cornici inglese e italiana;
  processo.md, Sviluppo.md e verifica.yml descrivono la categoria.
- Partizionamento dei dati: una partizione B o C sperduta (partizione A persa)
  sovrascriveva il buffer delle partizioni della slice in attesa. Ora slice_id e
  redundant_pic_cnt si leggono prima di copiare, e contano l'ordine A, B, C.
- MVC: le viste tengono insieme al massimo 2 × MaxDpbMbs di immagini, e il
  decodificatore di una vista nuova si tiene solo dopo il controllo dell'SPS di
  sottoinsieme; Wanted vale per ogni vista.
- FLV: senza durata nei metadati la durata arriva alla fine dell'ultimo
  fotogramma, come per MPEG; «solo audio» solo con una prova vera nella testa
  (un onMetaData grande non fa più scartare un video).
- Flussi di conformità: tolti i 48 readme e schede di terzi (decisione di
  Alberto: nel repository solo flussi e MD5).
- Prove nuove: partizioni A perse, limite delle viste e Wanted in MVC, unità di
  estensione troncate, flussi rovinati 4:2:2, 10 bit, 4:0:0, SVC e MVC.
- Commenti sulla provenienza che citano i file di ricostruzione ufficiali e
  §8.7 invece del decodificatore di riferimento; commento di
  ImportEnvironment.VideoProbe aggiornato; righe nuove in decisioni.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:30:45 +01:00

89 lines
5.1 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>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}");
}
}