mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: convert Utsname members from {u,}int8 array to byte array
In order to make conversion to string easier, change the Utsname members from int8 array to byte array. Also add a test on Linux for Uname and the string conversion of the Utsname members. Fixes golang/go#20753 Change-Id: Iec793dfb4a6dd8f3523cf0b6284a6162074f2e9e Reviewed-on: https://go-review.googlesource.com/74331 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
661970f62f
commit
4da7545edf
@@ -231,6 +231,17 @@ func TestSelect(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUname(t *testing.T) {
|
||||
var utsname unix.Utsname
|
||||
err := unix.Uname(&utsname)
|
||||
if err != nil {
|
||||
t.Fatalf("Uname: %v", err)
|
||||
}
|
||||
|
||||
// conversion from []byte to string, golang.org/issue/20753
|
||||
t.Logf("OS: %s/%s %s", string(utsname.Sysname[:]), string(utsname.Machine[:]), string(utsname.Release[:]))
|
||||
}
|
||||
|
||||
// utilities taken from os/os_test.go
|
||||
|
||||
func touch(t *testing.T, name string) {
|
||||
|
||||
Reference in New Issue
Block a user