KVM: selftests: Rip out old, param-based guest assert macros
Drop the param-based guest assert macros and enable the printf versions for all selftests. Note! This change can affect tests even if they don't use directly use guest asserts! E.g. via library code, or due to the compiler making different optimization decisions. Link: https://lore.kernel.org/r/20230729003643.1053367-33-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
4e15c38a1a
commit
7ce7f8e754
@ -19,8 +19,6 @@
|
||||
*
|
||||
* Copyright (c) 2021, Google LLC.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <test_util.h>
|
||||
#include <kvm_util.h>
|
||||
#include <processor.h>
|
||||
|
@ -8,8 +8,6 @@
|
||||
* hypercalls are properly masked or unmasked to the guest when disabled or
|
||||
* enabled from the KVM userspace, respectively.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <errno.h>
|
||||
#include <linux/arm-smccc.h>
|
||||
#include <asm/kvm.h>
|
||||
|
@ -7,8 +7,6 @@
|
||||
* hugetlbfs with a hole). It checks that the expected handling method is
|
||||
* called (e.g., uffd faults with the right address and write/read flag).
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <linux/bitmap.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -7,8 +7,6 @@
|
||||
* host to inject a specific intid via a GUEST_SYNC call, and then checks that
|
||||
* it received it.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <asm/kvm.h>
|
||||
#include <asm/kvm_para.h>
|
||||
#include <sys/eventfd.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright 2022, Google, Inc. and/or its affiliates.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -66,7 +66,6 @@ enum guest_assert_builtin_args {
|
||||
GUEST_ASSERT_BUILTIN_NARGS
|
||||
};
|
||||
|
||||
#ifdef USE_GUEST_ASSERT_PRINTF
|
||||
#define ____GUEST_ASSERT(_condition, _exp, _fmt, _args...) \
|
||||
do { \
|
||||
if (!(_condition)) \
|
||||
@ -108,74 +107,4 @@ do { \
|
||||
#define GUEST_ASSERT_1(_condition, arg1) \
|
||||
__GUEST_ASSERT(_condition, "arg1 = 0x%lx", arg1)
|
||||
|
||||
#else
|
||||
|
||||
#define __GUEST_ASSERT(_condition, _condstr, _nargs, _args...) \
|
||||
do { \
|
||||
if (!(_condition)) \
|
||||
ucall(UCALL_ABORT, GUEST_ASSERT_BUILTIN_NARGS + _nargs, \
|
||||
"Failed guest assert: " _condstr, \
|
||||
__FILE__, __LINE__, ##_args); \
|
||||
} while (0)
|
||||
|
||||
#define GUEST_ASSERT(_condition) \
|
||||
__GUEST_ASSERT(_condition, #_condition, 0, 0)
|
||||
|
||||
#define GUEST_ASSERT_1(_condition, arg1) \
|
||||
__GUEST_ASSERT(_condition, #_condition, 1, (arg1))
|
||||
|
||||
#define GUEST_ASSERT_2(_condition, arg1, arg2) \
|
||||
__GUEST_ASSERT(_condition, #_condition, 2, (arg1), (arg2))
|
||||
|
||||
#define GUEST_ASSERT_3(_condition, arg1, arg2, arg3) \
|
||||
__GUEST_ASSERT(_condition, #_condition, 3, (arg1), (arg2), (arg3))
|
||||
|
||||
#define GUEST_ASSERT_4(_condition, arg1, arg2, arg3, arg4) \
|
||||
__GUEST_ASSERT(_condition, #_condition, 4, (arg1), (arg2), (arg3), (arg4))
|
||||
|
||||
#define GUEST_ASSERT_EQ(a, b) __GUEST_ASSERT((a) == (b), #a " == " #b, 2, a, b)
|
||||
|
||||
#define __REPORT_GUEST_ASSERT(_ucall, fmt, _args...) \
|
||||
TEST_FAIL("%s at %s:%ld\n" fmt, \
|
||||
(const char *)(_ucall).args[GUEST_ERROR_STRING], \
|
||||
(const char *)(_ucall).args[GUEST_FILE], \
|
||||
(_ucall).args[GUEST_LINE], \
|
||||
##_args)
|
||||
|
||||
#define GUEST_ASSERT_ARG(ucall, i) ((ucall).args[GUEST_ASSERT_BUILTIN_NARGS + i])
|
||||
|
||||
#define REPORT_GUEST_ASSERT(ucall) \
|
||||
__REPORT_GUEST_ASSERT((ucall), "")
|
||||
|
||||
#define REPORT_GUEST_ASSERT_1(ucall, fmt) \
|
||||
__REPORT_GUEST_ASSERT((ucall), \
|
||||
fmt, \
|
||||
GUEST_ASSERT_ARG((ucall), 0))
|
||||
|
||||
#define REPORT_GUEST_ASSERT_2(ucall, fmt) \
|
||||
__REPORT_GUEST_ASSERT((ucall), \
|
||||
fmt, \
|
||||
GUEST_ASSERT_ARG((ucall), 0), \
|
||||
GUEST_ASSERT_ARG((ucall), 1))
|
||||
|
||||
#define REPORT_GUEST_ASSERT_3(ucall, fmt) \
|
||||
__REPORT_GUEST_ASSERT((ucall), \
|
||||
fmt, \
|
||||
GUEST_ASSERT_ARG((ucall), 0), \
|
||||
GUEST_ASSERT_ARG((ucall), 1), \
|
||||
GUEST_ASSERT_ARG((ucall), 2))
|
||||
|
||||
#define REPORT_GUEST_ASSERT_4(ucall, fmt) \
|
||||
__REPORT_GUEST_ASSERT((ucall), \
|
||||
fmt, \
|
||||
GUEST_ASSERT_ARG((ucall), 0), \
|
||||
GUEST_ASSERT_ARG((ucall), 1), \
|
||||
GUEST_ASSERT_ARG((ucall), 2), \
|
||||
GUEST_ASSERT_ARG((ucall), 3))
|
||||
|
||||
#define REPORT_GUEST_ASSERT_N(ucall, fmt, args...) \
|
||||
__REPORT_GUEST_ASSERT((ucall), fmt, ##args)
|
||||
|
||||
#endif /* USE_GUEST_ASSERT_PRINTF */
|
||||
|
||||
#endif /* SELFTEST_KVM_UCALL_COMMON_H */
|
||||
|
@ -6,8 +6,6 @@
|
||||
*
|
||||
* Basic guest setup / host vCPU thread code lifted from set_memory_region_test.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <semaphore.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright (C) 2019, Red Hat, Inc.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright IBM Corp. 2021
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include "test_util.h"
|
||||
#include "kvm_util.h"
|
||||
|
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE /* for program_invocation_short_name */
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright (C) 2020, Red Hat, Inc.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Generic tests for KVM CPUID set/get ioctls
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <asm/kvm_para.h>
|
||||
#include <linux/kvm_para.h>
|
||||
#include <stdint.h>
|
||||
|
@ -8,8 +8,6 @@
|
||||
* Copyright 2022 Google LLC
|
||||
* Author: Vipin Sharma <vipinsh@google.com>
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include "kvm_util.h"
|
||||
#include "processor.h"
|
||||
#include "hyperv.h"
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Tests for Hyper-V features enablement
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <asm/kvm_para.h>
|
||||
#include <linux/kvm_para.h>
|
||||
#include <stdint.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Tests for KVM paravirtual feature disablement
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <asm/kvm_para.h>
|
||||
#include <linux/kvm_para.h>
|
||||
#include <stdint.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE /* for program_invocation_short_name */
|
||||
|
||||
#include "test_util.h"
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright (C) 2020, Red Hat, Inc.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE /* for program_invocation_name */
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
@ -8,8 +8,6 @@
|
||||
* Copyright (C) 2021, Red Hat, Inc.
|
||||
*
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <stdatomic.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright (C) 2020, Red Hat, Inc.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "kvm_util.h"
|
||||
|
@ -1,6 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -10,8 +10,6 @@
|
||||
* and check it can be retrieved with KVM_GET_MSR, also test
|
||||
* the invalid LBR formats are rejected.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#define _GNU_SOURCE /* for program_invocation_short_name */
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
*
|
||||
* Copyright (C) 2022, Google LLC.
|
||||
*/
|
||||
#define USE_GUEST_ASSERT_PRINTF 1
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user