-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nvidia): skip clock events NVML check if not supported by old dri…
…vers Signed-off-by: Gyuho Lee <[email protected]>
- Loading branch information
Showing
6 changed files
with
224 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package nvml | ||
|
||
import "testing" | ||
|
||
func TestParseDriverVersion(t *testing.T) { | ||
testCases := []struct { | ||
version string | ||
wantMajor int | ||
wantMinor int | ||
wantPatch int | ||
wantErrNil bool | ||
}{ | ||
{ | ||
version: "525.85.12", | ||
wantMajor: 525, | ||
wantMinor: 85, | ||
wantPatch: 12, | ||
wantErrNil: true, | ||
}, | ||
{ | ||
version: "535.161.08", | ||
wantMajor: 535, | ||
wantMinor: 161, | ||
wantPatch: 8, | ||
wantErrNil: true, | ||
}, | ||
{ | ||
version: "invalid.version", | ||
wantErrNil: false, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
t.Run(tc.version, func(t *testing.T) { | ||
major, minor, patch, err := ParseDriverVersion(tc.version) | ||
|
||
if (err == nil) != tc.wantErrNil { | ||
t.Errorf("ParseDriverVersion(%q) error = %v, wantErrNil %v", tc.version, err, tc.wantErrNil) | ||
return | ||
} | ||
|
||
if err == nil { | ||
if major != tc.wantMajor { | ||
t.Errorf("ParseDriverVersion(%q) major = %d, want %d", tc.version, major, tc.wantMajor) | ||
} | ||
if minor != tc.wantMinor { | ||
t.Errorf("ParseDriverVersion(%q) minor = %d, want %d", tc.version, minor, tc.wantMinor) | ||
} | ||
if patch != tc.wantPatch { | ||
t.Errorf("ParseDriverVersion(%q) patch = %d, want %d", tc.version, patch, tc.wantPatch) | ||
} | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters