Fix test-runner on FreeBSD
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 <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Co-authored-by: Rich Ercolani <rincebrain@gmail.com> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #12995
This commit is contained in:
parent
07a2ba541d
commit
435407eb5c
|
@ -33,7 +33,7 @@ from subprocess import PIPE
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
from threading import Timer
|
from threading import Timer
|
||||||
from time import time, CLOCK_MONOTONIC_RAW
|
from time import time, CLOCK_MONOTONIC
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
|
|
||||||
BASEDIR = '/var/tmp/test_results'
|
BASEDIR = '/var/tmp/test_results'
|
||||||
|
@ -62,7 +62,7 @@ clock_gettime.argtypes = [ctypes.c_int, ctypes.POINTER(timespec)]
|
||||||
|
|
||||||
def monotonic_time():
|
def monotonic_time():
|
||||||
t = timespec()
|
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()
|
errno_ = ctypes.get_errno()
|
||||||
raise OSError(errno_, os.strerror(errno_))
|
raise OSError(errno_, os.strerror(errno_))
|
||||||
return t.tv_sec + t.tv_nsec * 1e-9
|
return t.tv_sec + t.tv_nsec * 1e-9
|
||||||
|
|
Loading…
Reference in New Issue