Skip to content

Commit

Permalink
Update nvproxy parity tests to run in parallel.
Browse files Browse the repository at this point in the history
This test file now takes ~30 seconds instead of ~4 minutes.

PiperOrigin-RevId: 662702276
  • Loading branch information
AC-Dap authored and gvisor-bot committed Aug 14, 2024
1 parent f813cc6 commit 5523613
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/sentry/devices/nvproxy/nvproxy_driver_parity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit 5523613

Please sign in to comment.