From 028bb33fd073a6934862f58a801df3d2745af1cb Mon Sep 17 00:00:00 2001 From: Hana Kim Date: Wed, 23 May 2018 16:35:51 -0400 Subject: [PATCH] unix: delete TestDevices test for Solaris MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test uses hardcoded numbers specific to one Solaris variant or version. It's not guaranteed that they are stable over time or across variants. Fixes golang/go#25528 Change-Id: I148bd4d8264b802f07a2e886b99e76a40824af35 Reviewed-on: https://go-review.googlesource.com/114092 Reviewed-by: Aram Hăvărneanu Reviewed-by: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot --- unix/dev_solaris_test.go | 51 ---------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 unix/dev_solaris_test.go diff --git a/unix/dev_solaris_test.go b/unix/dev_solaris_test.go deleted file mode 100644 index 656508c9..00000000 --- a/unix/dev_solaris_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -package unix_test - -import ( - "fmt" - "testing" - - "golang.org/x/sys/unix" -) - -func TestDevices(t *testing.T) { - testCases := []struct { - path string - major uint32 - minor uint32 - }{ - // Well-known major/minor numbers on OpenSolaris according to - // /etc/name_to_major - {"/dev/zero", 134, 12}, - {"/dev/null", 134, 2}, - {"/dev/ptyp0", 172, 0}, - {"/dev/ttyp0", 175, 0}, - {"/dev/ttyp1", 175, 1}, - } - for _, tc := range testCases { - t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { - var stat unix.Stat_t - err := unix.Stat(tc.path, &stat) - if err != nil { - t.Errorf("failed to stat device: %v", err) - return - } - - dev := uint64(stat.Rdev) - if unix.Major(dev) != tc.major { - t.Errorf("for %s Major(%#x) == %d, want %d", tc.path, dev, unix.Major(dev), tc.major) - } - if unix.Minor(dev) != tc.minor { - t.Errorf("for %s Minor(%#x) == %d, want %d", tc.path, dev, unix.Minor(dev), tc.minor) - } - if unix.Mkdev(tc.major, tc.minor) != dev { - t.Errorf("for %s Mkdev(%d, %d) == %#x, want %#x", tc.path, tc.major, tc.minor, unix.Mkdev(tc.major, tc.minor), dev) - } - }) - } -}