Porte delle prove fuori dall'intervallo effimero (#52)
verifica / controlli (push) Successful in 29s
verifica / prove (push) Successful in 15m0s
verifica / installatore (push) Successful in 4m36s
verifica / immagine (push) Successful in 14m52s

Nella CI 350 Chromium non è partito: la porta di debug, presa dalla porta 0
del sistema e chiusa prima dell'avvio, era nell'intervallo effimero di Linux
e un'altra prova parallela l'aveva occupata nel frattempo. FreePort dà ora
porte fra 20000 e 29999, una volta sola per processo e provate prima di
darle; anche DesktopCompositionTests usa lo stesso aiuto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-16 15:12:08 +01:00
1 parent 129ca22449
commit c4c035d61f
3 files changed
+36 -13

No files matched your search

+1
View File
@@ -377,3 +377,4 @@ Ogni scelta tecnica presa strada facendo, con data e motivo (specifica §15).
| 2026-11-16 | Con `--accesso-di-prova` il primo controllo della sessione all'avvio non segnala nulla (`RefreshAsync` con `mayReport: false`) | La sessione mancante è quella che l'accesso automatico sta per aprire, non una disconnessione |
| 2026-11-16 | «Pagina iniziale» vale finché dura il permesso di chi l'ha premuta: la finestra di Windows e la vista remota passano un gettone che si annulla con il loro permesso, e la connessione guarda di nuovo, con il turno della pagina in mano, che Alberto guidi ancora; senza turno rinuncia invece di prendere la pagina. Nella vista remota la pressione corre a parte, una per volta, e intanto clic e tasti si scartano | L'attesa (fine della sessione, turno della pagina) può durare mezzo minuto: Alberto poteva aver chiuso la finestra e Febe navigava senza permesso e fuori dal Governatore (regole 7 e 8); nella vista l'attesa nel ciclo di ricezione bloccava i comandi e poi li riversava sulla pagina nuova |
| 2026-11-16 | `Repaint` della finestra «Browser di Febe» chiede solo di ridisegnare (`RDW_INVALIDATE \| RDW_ALLCHILDREN`), senza `RDW_UPDATENOW` | Le finestre figlie sono del processo del browser di WebView2: un processo bloccato avrebbe fermato il thread dell'interfaccia in un ridisegno sincrono |
| 2026-11-16 | Le porte libere delle prove (`LocalTestSite.FreePort`) vengono da 20000–29999, ciascuna una volta sola per processo e provata prima di darla, non più dalla porta 0 del sistema | Nella CI 350 (#52) Chromium non è partito perché la porta di debug, presa dall'intervallo effimero di Linux e chiusa prima di usarla, era stata nel frattempo occupata (come per #46: la causa, non un tempo più lungo) |
@@ -49,13 +49,42 @@ public sealed class LocalTestSite : IDisposable
public string CdnUrl(string path) => $"http://{CdnHost}{path}";
// Ports handed out by FreePort come from 20000-29999: below the ephemeral ranges of Linux (32768-60999) and Windows
// (49152-65535), so an outgoing connection of another test cannot take one between the probe and the moment the
// test binds it (a port handed out by the system's port 0 could, CI run 350 of #52). Each port is handed out once
// per process; the start depends on the process id, so two test processes on one machine rarely meet.
private const int FirstTestPort = 20000;
private const int TestPorts = 10000;
private static int _nextPort = Environment.ProcessId * 7919 % TestPorts;
/// <summary>
/// A port of 127.0.0.1 that is free now, never handed out before in this process and outside the system's ephemeral
/// range. The caller binds it soon after; nothing can reserve it in between, but no other test of this process gets
/// it and no outgoing connection is given it.
/// </summary>
public static int FreePort()
{
var probe = new TcpListener(IPAddress.Loopback, 0);
probe.Start();
var port = ((IPEndPoint)probe.LocalEndpoint).Port;
probe.Stop();
return port;
for (var attempt = 0; attempt < TestPorts; attempt++)
{
var port = FirstTestPort + (int)((uint)Interlocked.Increment(ref _nextPort) % TestPorts);
var probe = new TcpListener(IPAddress.Loopback, port);
try
{
probe.Start();
}
catch (SocketException)
{
continue;
}
finally
{
probe.Stop();
}
return port;
}
throw new InvalidOperationException("Nessuna porta libera fra 20000 e 29999.");
}
private int _disposed;
@@ -336,12 +336,5 @@ public sealed class DesktopCompositionTests
StringAssert.Contains(log, "Windows non ha legato Edge a Febe");
}
private static int FreePort()
{
var listener = new System.Net.Sockets.TcpListener(IPAddress.Loopback, 0);
listener.Start();
var port = ((IPEndPoint)listener.LocalEndpoint).Port;
listener.Stop();
return port;
}
private static int FreePort() => Febe.Tests.Browser.TestSupport.LocalTestSite.FreePort();
}