unix: skip TestIoctlGetRTCWkAlrm if unsupported

Some RTC devices do not support wakeup alarms and will return
EINVAL in such cases. The generic powerpc rtc driver is one such
case.

Fixes golang/go#48554

Change-Id: I46f6da7902586a7fcaa9a367801d9fead288e264
Reviewed-on: https://go-review.googlesource.com/c/sys/+/352090
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: David Chase <drchase@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Paul E. Murphy
2021-09-24 14:07:06 -05:00
committed by Tobias Klauser
parent 1cf2251ac2
commit 39ccf1dd6f

View File

@@ -117,6 +117,12 @@ func TestIoctlGetRTCWkAlrm(t *testing.T) {
defer f.Close()
v, err := unix.IoctlGetRTCWkAlrm(int(f.Fd()))
// Not all RTC drivers support wakeup alarms, and will return EINVAL in such cases.
if err == unix.EINVAL {
t.Skip("RTC_WKALM_RD ioctl not supported on this rtc, skipping test")
}
if err != nil {
t.Fatalf("failed to perform ioctl: %v", err)
}