| // Copyright 2020 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. |
| // Modified from Linux tests for device numbers. |
| func TestDevices(t *testing.T) { |
| // Device nums found using ls -l on z/OS |
| for _, tc := range testCases { |
| t.Run(fmt.Sprintf("%s %v:%v", tc.path, tc.major, tc.minor), func(t *testing.T) { |
| err := unix.Stat(tc.path, &stat) |
| t.Skip("no permission to stat device, skipping test") |
| t.Errorf("failed to stat device: %v", err) |
| 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) |