Skip to content

Commit

Permalink
Fix test-runner on FreeBSD
Browse files Browse the repository at this point in the history
CLOCK_MONOTONIC_RAW is only a thing on Linux and macOS. I'm not
actually sure why the previous hardcoding of a constant didn't
error out, but when we removed it, it sure does now.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Co-authored-by: Rich Ercolani <[email protected]>
Signed-off-by: Rich Ercolani <[email protected]>
Closes #12995
  • Loading branch information
nabijaczleweli authored Jan 21, 2022
1 parent 063daa8 commit 17b2ae0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test-runner/bin/test-runner.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ from select import select
from subprocess import PIPE
from subprocess import Popen
from threading import Timer
from time import time, CLOCK_MONOTONIC_RAW
from time import time, CLOCK_MONOTONIC

BASEDIR = '/var/tmp/test_results'
TESTDIR = '/usr/share/zfs/'
Expand All @@ -59,7 +59,7 @@ clock_gettime.argtypes = [ctypes.c_int, ctypes.POINTER(timespec)]

def monotonic_time():
t = timespec()
if clock_gettime(CLOCK_MONOTONIC_RAW, ctypes.pointer(t)) != 0:
if clock_gettime(CLOCK_MONOTONIC, ctypes.pointer(t)) != 0:
errno_ = ctypes.get_errno()
raise OSError(errno_, os.strerror(errno_))
return t.tv_sec + t.tv_nsec * 1e-9
Expand Down

0 comments on commit 17b2ae0

Please sign in to comment.