Add nvproxy test to ensure ABI and struct name maps cover the same ioctls.

PiperOrigin-RevId: 658078138
This commit is contained in:
Anthony Cui
2024-07-31 11:26:31 -07:00
committed by gVisor bot
parent 4542eb5ba6
commit 5b47d132c2
@@ -37,3 +37,36 @@ func TestAllSupportedHashesPresent(t *testing.T) {
}
}
}
// TestABIStructNamesInSync tests that all the supported ioctls in an ABI version are also mapped
// by GetStructNames.
func TestABIStructNamesInSync(t *testing.T) {
Init()
for version, abiCons := range abis {
t.Run(version.String(), func(t *testing.T) {
abi := abiCons.cons()
structNames := abi.getStructNames()
for ioctl := range abi.frontendIoctl {
if _, ok := structNames.frontendNames[ioctl]; !ok {
t.Errorf("Frontend ioctl %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.uvmIoctl {
if _, ok := structNames.uvmNames[ioctl]; !ok {
t.Errorf("UVM ioctl %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.controlCmd {
if _, ok := structNames.controlNames[ioctl]; !ok {
t.Errorf("Control command %#x not found in struct names for version %v", ioctl, version.String())
}
}
for ioctl := range abi.allocationClass {
if _, ok := structNames.allocationNames[ioctl]; !ok {
t.Errorf("Alloc class %#x not found in struct names for version %v", ioctl, version.String())
}
}
})
}
}