Check returned error values

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-08-25 16:48:11 +02:00
parent e0df157f70
commit 8a9f367067
10 changed files with 37 additions and 15 deletions

View File

@@ -52,7 +52,9 @@ func (i additionalInfo) UsesNVGPUModule() (uses bool, reason string) {
if ret != nvml.SUCCESS {
return false, fmt.Sprintf("failed to initialize nvml: %v", ret)
}
defer i.nvmllib.Shutdown()
defer func() {
_ = i.nvmllib.Shutdown()
}()
var names []string

View File

@@ -22,7 +22,8 @@ func TestMaintainSpec(t *testing.T) {
spec := NewFileSpec(inputSpecPath).(*fileSpec)
spec.Load()
_, err := spec.Load()
require.NoError(t, err)
outputSpecPath := filepath.Join(moduleRoot, "test/output", f)
spec.path = outputSpecPath

View File

@@ -18,6 +18,7 @@ package runtime
import (
"encoding/json"
"errors"
"fmt"
"strings"
@@ -53,7 +54,9 @@ func (r rt) Run(argv []string) (rerr error) {
if rerr != nil {
r.logger.Errorf("%v", rerr)
}
r.logger.Reset()
if err := r.logger.Reset(); err != nil {
rerr = errors.Join(rerr, fmt.Errorf("failed to reset logger: %v", err))
}
}()
// We apply some config updates here to ensure that the config is valid in