@@ -23,13 +23,14 @@ import (
23
23
"errors"
24
24
"os"
25
25
"reflect"
26
- "syscall"
27
26
"testing"
27
+
28
+ "golang.org/x/sys/unix"
28
29
)
29
30
30
31
func TestFillOSSpecificData (t * testing.T ) {
31
32
type args struct {
32
- syscallUname func (* syscall .Utsname ) error
33
+ syscallUname func (* unix .Utsname ) error
33
34
etc string
34
35
}
35
36
tests := []struct {
@@ -42,8 +43,8 @@ func TestFillOSSpecificData(t *testing.T) {
42
43
name : "get uname os information" ,
43
44
args : args {
44
45
etc : "./testdata/lsb-release" ,
45
- syscallUname : func (in * syscall .Utsname ) error {
46
- in .Version = [65 ]int8 {35 , 57 , 45 , 85 , 98 , 117 , 110 , 116 ,
46
+ syscallUname : func (in * unix .Utsname ) error {
47
+ in .Version = [65 ]byte {35 , 57 , 45 , 85 , 98 , 117 , 110 , 116 ,
47
48
117 , 32 , 83 , 77 , 80 , 32 , 87 , 101 , 100 ,
48
49
32 , 77 , 97 , 121 , 32 , 49 , 54 , 32 , 49 ,
49
50
53 , 58 , 50 , 50 , 58 , 53 , 52 , 32 , 85 ,
@@ -60,8 +61,8 @@ func TestFillOSSpecificData(t *testing.T) {
60
61
name : "get uname os information uname call fails" ,
61
62
args : args {
62
63
etc : "./testdata/lsb-release" ,
63
- syscallUname : func (in * syscall .Utsname ) error {
64
- in .Version = [65 ]int8 {}
64
+ syscallUname : func (in * unix .Utsname ) error {
65
+ in .Version = [65 ]byte {}
65
66
return errors .New ("shouldn't work" )
66
67
},
67
68
},
@@ -88,13 +89,13 @@ func TestFillOSSpecificData(t *testing.T) {
88
89
}
89
90
})
90
91
os .Unsetenv ("HOST_ETC" )
91
- syscallUname = syscall .Uname
92
+ syscallUname = unix .Uname
92
93
}
93
94
}
94
95
95
96
func TestFillPlatformSpecificCPUData (t * testing.T ) {
96
97
type args struct {
97
- syscallUname func (* syscall .Utsname ) error
98
+ syscallUname func (* unix .Utsname ) error
98
99
}
99
100
tests := []struct {
100
101
name string
@@ -105,8 +106,8 @@ func TestFillPlatformSpecificCPUData(t *testing.T) {
105
106
{
106
107
name : "get uname cpu information" ,
107
108
args : args {
108
- syscallUname : func (in * syscall .Utsname ) error {
109
- in .Machine = [65 ]int8 {120 , 56 , 54 , 95 , 54 , 52 }
109
+ syscallUname : func (in * unix .Utsname ) error {
110
+ in .Machine = [65 ]byte {120 , 56 , 54 , 95 , 54 , 52 }
110
111
return nil
111
112
},
112
113
},
@@ -118,8 +119,8 @@ func TestFillPlatformSpecificCPUData(t *testing.T) {
118
119
{
119
120
name : "get uname cpu information and the call to uname fails" ,
120
121
args : args {
121
- syscallUname : func (in * syscall .Utsname ) error {
122
- in .Machine = [65 ]int8 {}
122
+ syscallUname : func (in * unix .Utsname ) error {
123
+ in .Machine = [65 ]byte {}
123
124
return errors .New ("shouldn't work" )
124
125
},
125
126
},
@@ -142,6 +143,6 @@ func TestFillPlatformSpecificCPUData(t *testing.T) {
142
143
}
143
144
})
144
145
os .Unsetenv ("HOST_ETC" )
145
- syscallUname = syscall .Uname
146
+ syscallUname = unix .Uname
146
147
}
147
148
}
0 commit comments