-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathfirmware_test.go
94 lines (91 loc) · 2.39 KB
/
firmware_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package bmc
import (
"testing"
"github.com/gebn/bmc/pkg/iana"
"github.com/gebn/bmc/pkg/ipmi"
)
func TestFirmwareVersion(t *testing.T) {
tests := []struct {
in *ipmi.GetDeviceIDRsp
want string
}{
{
&ipmi.GetDeviceIDRsp{
ID: 33,
Revision: 1,
MajorFirmwareRevision: 1,
MinorFirmwareRevision: 20,
Manufacturer: iana.EnterpriseIntel,
Product: 73,
AuxiliaryFirmwareRevision: [4]byte{0x01, 0x17, 0xa1, 0x16},
},
"01.20.5793",
},
{
&ipmi.GetDeviceIDRsp{
ID: 32,
Revision: 1,
MajorFirmwareRevision: 2,
MinorFirmwareRevision: 41,
Manufacturer: iana.EnterpriseDell,
Product: 1,
AuxiliaryFirmwareRevision: [4]byte{0x00, 0x07, 0x28, 0x28},
},
"2.41.40.40b07",
},
{
&ipmi.GetDeviceIDRsp{
ID: 32,
Revision: 1,
MajorFirmwareRevision: 2,
MinorFirmwareRevision: 50,
Manufacturer: iana.EnterpriseDell,
Product: 1,
AuxiliaryFirmwareRevision: [4]byte{0x00, 0x21, 0x32, 0x32},
},
"2.50.50.50b33",
},
{
&ipmi.GetDeviceIDRsp{
ID: 32,
Revision: 1,
MajorFirmwareRevision: 3,
MinorFirmwareRevision: 15,
Manufacturer: iana.EnterpriseDell,
Product: 1,
AuxiliaryFirmwareRevision: [4]byte{0x00, 0x01, 0x11, 0x0f},
},
"3.15.17.15b01",
},
{
&ipmi.GetDeviceIDRsp{
ID: 32,
Revision: 1,
MajorFirmwareRevision: 3,
MinorFirmwareRevision: 45,
Manufacturer: iana.EnterpriseQuanta,
Product: 12866,
AuxiliaryFirmwareRevision: [4]byte{0x01, 0x00, 0x00, 0x00},
},
"3.45.01",
},
{
&ipmi.GetDeviceIDRsp{
ID: 32,
Revision: 1,
MajorFirmwareRevision: 3,
MinorFirmwareRevision: 72,
Manufacturer: iana.EnterpriseSuperMicro,
Product: 2052,
AuxiliaryFirmwareRevision: [4]byte{},
},
"03.72",
},
}
for _, test := range tests {
if got := FirmwareVersion(test.in); got != test.want {
t.Errorf("FirmwareVersion(%v) = %v, want %v", test.in, got,
test.want)
}
}
}