Mixed FS+Wiitek test pair: modules dispatched by EEPROM PN to a BCM or Go RollBall client (whitelist panics outside the wiitek proven-safe set), SNR now solely the wiitek's IEEE margins (BCM handler SNR dropped as unactionable), ECD-clears-AN-enable trap found and fixed (7.0 |= 0x1200 on every restart, explicit restart after each diag), mixed roles FS-slave/wiitek-auto-master, window re-arms at taken edge so the one CMD write per window sits far from the poll; X710 rejects the honest FS EEPROM so the noise pair runs Fibergaga+Wiitek

This commit is contained in:
flamingcow
2026-08-14 23:35:19 -07:00
parent c0f3d0d61a
commit 9f2b074c4a
6 changed files with 565 additions and 265 deletions
+28 -8
View File
@@ -3,13 +3,14 @@ package main
import "testing"
func freshMod(margins [4]float64) phyModView {
return phyModView{fresh: true, link: true, margins: margins}
return phyModView{fresh: true, link: true, haveSNR: true, margins: margins}
}
func TestPhyDisplayWorstMarginAndFault(t *testing.T) {
cable := cableInfo{
ecd: ecdResult{verdicts: [4]int{pairOK, pairOpen, pairOK, pairOK}, metres: [4]int{45, 12, 41, 46}},
maps: [2]byte{pairIdentityMap, pairIdentityMap},
ecd: ecdResult{verdicts: [4]int{pairOK, pairOpen, pairOK, pairOK}, metres: [4]int{45, 12, 41, 46}},
maps: [2]byte{pairIdentityMap, pairIdentityMap},
haveMaps: [2]bool{true, true},
}
a := freshMod([4]float64{5, 5, 2, 0.5})
b := freshMod([4]float64{4, 5, 5, 5})
@@ -23,6 +24,23 @@ func TestPhyDisplayWorstMarginAndFault(t *testing.T) {
}
}
func TestPhyDisplaySNREndOwnsMargin(t *testing.T) {
wiitek := freshMod([4]float64{9.2, 7.2, 7.0, 8.7})
fs := phyModView{fresh: true, link: true}
d := phyDisplayFrom(cableInfo{}, false, wiitek, fs)
if !d.haveSNR || d.worstMargin != 7.0 {
t.Errorf("worstMargin = %v (have %v), want the SNR end's 7.0", d.worstMargin, d.haveSNR)
}
d = phyDisplayFrom(cableInfo{}, false, fs, wiitek)
if !d.haveSNR || d.worstMargin != 7.0 {
t.Errorf("swapped ends: worstMargin = %v, want 7.0", d.worstMargin)
}
d = phyDisplayFrom(cableInfo{}, false, fs, fs)
if d.haveSNR {
t.Error("a pair with no SNR end should withhold snr")
}
}
func TestCableSummary(t *testing.T) {
healthy := ecdResult{verdicts: [4]int{pairOK, pairOK, pairOK, pairOK}, metres: [4]int{50, 48, 47, 51}}
for _, c := range []struct {
@@ -32,10 +50,11 @@ func TestCableSummary(t *testing.T) {
want string
class int
}{
{"clean", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, pairIdentityMap}}, false, "49", clsGood},
{"far-end swap", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, 0xE1}}, false, "49", clsWarn},
{"clean", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, pairIdentityMap}, haveMaps: [2]bool{true, true}}, false, "49", clsGood},
{"far-end swap", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, 0xE1}, haveMaps: [2]bool{true, true}}, false, "49", clsWarn},
{"one-end map only", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, 0}, haveMaps: [2]bool{true, false}}, false, "49", clsGood},
{"no diag yet", cableInfo{}, false, "-", clsNone},
{"measuring", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, pairIdentityMap}}, true, "...", clsNone},
{"measuring", cableInfo{ecd: healthy, maps: [2]byte{pairIdentityMap, pairIdentityMap}, haveMaps: [2]bool{true, true}}, true, "...", clsNone},
} {
s, cl := cableSummary(c.cable, c.measuring)
if s != c.want || cl != c.class {
@@ -46,8 +65,9 @@ func TestCableSummary(t *testing.T) {
func TestPhyDisplayStaleGoesDim(t *testing.T) {
cable := cableInfo{
ecd: ecdResult{verdicts: [4]int{pairOK, pairOK, pairOK, pairOK}, metres: [4]int{45, 45, 41, 46}},
maps: [2]byte{pairIdentityMap, pairIdentityMap},
ecd: ecdResult{verdicts: [4]int{pairOK, pairOK, pairOK, pairOK}, metres: [4]int{45, 45, 41, 46}},
maps: [2]byte{pairIdentityMap, pairIdentityMap},
haveMaps: [2]bool{true, true},
}
d := phyDisplayFrom(cable, false, freshMod([4]float64{5, 5, 5, 5}), phyModView{})
if d.haveSNR {