Update nvproxy parity tests to run in parallel.

This test file now takes ~30 seconds instead of ~4 minutes.

PiperOrigin-RevId: 662702276
This commit is contained in:
Anthony Cui
2024-08-13 17:01:28 -07:00
committed by gVisor bot
parent f813cc6f7a
commit 55236137ca
@@ -81,13 +81,15 @@ func getDriverDefs(t *testing.T, runner *parser.Runner, version nvproxy.DriverVe
// TestSupportedStructNames tests that all the structs listed in nvproxy are found in the driver
// source code.
func TestSupportedStructNames(t *testing.T) {
f, runner := createParserRunner(t)
defer f.Close()
nvproxy.Init()
// Run the parser on all supported driver versions
nvproxy.ForEachSupportDriver(func(version nvproxy.DriverVersion, checksum string) {
t.Run(version.String(), func(t *testing.T) {
t.Parallel()
f, runner := createParserRunner(t)
defer f.Close()
structNames, defs := getDriverDefs(t, runner, version)
// Check that every struct is found in the parser output.
@@ -102,13 +104,17 @@ func TestSupportedStructNames(t *testing.T) {
})
}
// TestStructDefinitionParity tests that the struct definitions in nvproxy are the same as the
// definitions in the driver source code.
func TestStructDefinitionParity(t *testing.T) {
f, runner := createParserRunner(t)
defer f.Close()
nvproxy.Init()
nvproxy.ForEachSupportDriver(func(version nvproxy.DriverVersion, checksum string) {
t.Run(version.String(), func(t *testing.T) {
t.Parallel()
f, runner := createParserRunner(t)
defer f.Close()
_, defs := getDriverDefs(t, runner, version)
nvproxyDefs, ok := nvproxy.SupportedStructTypes(version)