Skip to content

Commit ec15f47

Browse files
committed
feat: add test for MEIClass
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
1 parent a39ff8f commit ec15f47

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

sysfs/class_mei_test.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright The Prometheus Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build linux
15+
16+
package sysfs
17+
18+
import (
19+
"testing"
20+
21+
"github.com/google/go-cmp/cmp"
22+
)
23+
24+
func TestMEIClass(t *testing.T) {
25+
fs, err := NewFS(sysTestFixtures)
26+
if err != nil {
27+
t.Fatal(err)
28+
}
29+
30+
got, err := fs.MEIClass()
31+
if err != nil {
32+
t.Fatal(err)
33+
}
34+
35+
dev := "244:0"
36+
devState := "ENABLED"
37+
fwStatus := "90000245\n00110500\n00000020\n00000000\n02F41F03\n40000000"
38+
fwVer := "0:18.0.5.2098\n0:18.0.5.2098\n0:18.0.5.2098"
39+
hbmVer := "2.2"
40+
hbmVerDrv := "2.2"
41+
kind := "mei"
42+
trc := "00000889"
43+
txQueueLimit := "50"
44+
45+
want := &MEIClass{
46+
Dev: &dev,
47+
DevState: &devState,
48+
FWStatus: &fwStatus,
49+
FWVersion: &fwVer,
50+
HBMVersion: &hbmVer,
51+
HBMVersionDrv: &hbmVerDrv,
52+
Kind: &kind,
53+
Trc: &trc,
54+
TxQueueLimit: &txQueueLimit,
55+
}
56+
57+
if diff := cmp.Diff(want, got); diff != "" {
58+
t.Fatalf("unexpected DMI class (-want +got):\n%s", diff)
59+
}
60+
}

0 commit comments

Comments
 (0)