When running the tests under "qemu -accel kvm" on a Linux host,
isQEMU_TCG() should return false. Fixes multiple test cases that were failing with "Test case was expecting a failure but none were raised" on that platform.
This commit is contained in:
parent
3ed29d6469
commit
873071237c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: isqemu.h,v 1.5 2020/08/23 11:00:18 gson Exp $ */
|
||||
/* $NetBSD: isqemu.h,v 1.6 2021/12/15 09:19:28 gson Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||
|
@ -72,10 +72,18 @@ isQEMU_TCG(void) {
|
|||
return false;
|
||||
err(EXIT_FAILURE, "sysctl");
|
||||
}
|
||||
return strstr(name, "QEMU") != NULL;
|
||||
#else
|
||||
if (strstr(name, "QEMU") == NULL)
|
||||
return false;
|
||||
if (sysctlbyname("machdep.hypervisor", name, &len, NULL, 0) == -1) {
|
||||
if (errno == ENOENT)
|
||||
return true;
|
||||
err(EXIT_FAILURE, "sysctl");
|
||||
}
|
||||
if (strcmp(name, "KVM") == 0)
|
||||
return false;
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
|
Loading…
Reference in New Issue