Merge tag 'pull-request-2020-06-16' of https://gitlab.com/huth/kvm-unit-tests
* Lots of CI-related fixes and improvements
* Update the gitlab-CI to Fedora 32
* Test compilation with Clang
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3093239..3af53f0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-image: fedora:30
+image: fedora:32
before_script:
- dnf update -y
@@ -77,6 +77,19 @@
- ./configure --arch=i386
- make -j2
- ACCEL=tcg ./run_tests.sh
- cmpxchg8b eventinj port80 setjmp sieve tsc taskswitch taskswitch2 umip
+ cmpxchg8b eventinj port80 setjmp sieve tsc taskswitch umip
| tee results.txt
- if grep -q FAIL results.txt ; then exit 1 ; fi
+
+build-clang:
+ script:
+ - dnf install -y qemu-system-x86 clang
+ - ./configure --arch=x86_64 --cc=clang
+ - make -j2
+ - ACCEL=tcg ./run_tests.sh
+ smptest smptest3 vmexit_cpuid vmexit_mov_from_cr8
+ vmexit_mov_to_cr8 vmexit_inl_pmtimer vmexit_ipi vmexit_ipi_halt
+ vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
+ eventinj msr port80 setjmp syscall tsc rmap_chain umip intel_iommu
+ | tee results.txt
+ - grep -q PASS results.txt && ! grep -q FAIL results.txt
diff --git a/Makefile b/Makefile
index 754ed65..3ff2f91 100644
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,7 @@
cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
-COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing
+COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
COMMON_CFLAGS += -Wignored-qualifiers -Werror
diff --git a/lib/auxinfo.h b/lib/auxinfo.h
index 08b96f8..a46a1e6 100644
--- a/lib/auxinfo.h
+++ b/lib/auxinfo.h
@@ -13,7 +13,6 @@
unsigned long flags;
};
-/* No extern! Define a common symbol. */
-struct auxinfo auxinfo;
+extern struct auxinfo auxinfo;
#endif
#endif
diff --git a/powerpc/flat.lds b/powerpc/flat.lds
index 53221e8..5eed368 100644
--- a/powerpc/flat.lds
+++ b/powerpc/flat.lds
@@ -1,7 +1,17 @@
+PHDRS
+{
+ text PT_LOAD FLAGS(5);
+ data PT_LOAD FLAGS(6);
+}
+
SECTIONS
{
- .text : { *(.init) *(.text) *(.text.*) }
+ .text : {
+ *(.init)
+ *(.text)
+ *(.text.*)
+ } :text
. = ALIGN(64K);
etext = .;
.opd : { *(.opd) }
@@ -19,9 +29,12 @@
.data : {
*(.data)
*(.data.rel*)
- }
+ } :data
. = ALIGN(16);
- .rodata : { *(.rodata) *(.rodata.*) }
+ .rodata : {
+ *(.rodata)
+ *(.rodata.*)
+ } :data
. = ALIGN(16);
.bss : { *(.bss) }
. = ALIGN(256);
diff --git a/s390x/stsi.c b/s390x/stsi.c
index 66b4257..b81cea7 100644
--- a/s390x/stsi.c
+++ b/s390x/stsi.c
@@ -129,11 +129,11 @@
}
report(!memcmp(data->vm[0].uuid, uuid, sizeof(uuid)), "uuid");
- report(data->vm[0].conf_cpus == smp_query_num_cpus(), "cpu # configured");
+ report(data->vm[0].conf_cpus == smp_query_num_cpus(), "cpu count configured");
report(data->vm[0].total_cpus ==
data->vm[0].reserved_cpus + data->vm[0].conf_cpus,
- "cpu # total == conf + reserved");
- report(data->vm[0].standby_cpus == 0, "cpu # standby");
+ "cpu count total == conf + reserved");
+ report(data->vm[0].standby_cpus == 0, "cpu count standby");
report(!memcmp(data->vm[0].name, vm_name, sizeof(data->vm[0].name)),
"VM name == kvm-unit-test");
diff --git a/x86/Makefile.common b/x86/Makefile.common
index ab67ca0..2ea9c9f 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -5,6 +5,7 @@
cflatobjs += lib/pci.o
cflatobjs += lib/pci-edu.o
cflatobjs += lib/alloc.o
+cflatobjs += lib/auxinfo.o
cflatobjs += lib/vmalloc.o
cflatobjs += lib/alloc_page.o
cflatobjs += lib/alloc_phys.o
diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 89ce214..610685b 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -890,7 +890,7 @@
}
#define TSC_ADJUST_VALUE (1ll << 32)
-#define TSC_OFFSET_VALUE (-1ll << 48)
+#define TSC_OFFSET_VALUE (~0ull << 48)
static bool ok;
static void tsc_adjust_prepare(struct svm_test *test)
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index df722ff..9fec0f7 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -2253,7 +2253,9 @@
.offset = (uintptr_t)&&into,
.selector = KERNEL_CS32,
};
- register uintptr_t rsp asm("rsp");
+ uintptr_t rsp;
+
+ asm volatile ("mov %%rsp, %0" : "=r"(rsp));
if (fp.offset != (uintptr_t)&&into) {
printf("Code address too high.\n");
@@ -3349,7 +3351,9 @@
.offset = (uintptr_t)&&invvpid,
.selector = KERNEL_CS32,
};
- register uintptr_t rsp asm("rsp");
+ uintptr_t rsp;
+
+ asm volatile ("mov %%rsp, %0" : "=r"(rsp));
TEST_ASSERT_MSG(fp.offset == (uintptr_t)&&invvpid,
"Code address too high.");
@@ -8544,7 +8548,7 @@
* an event that you injected.
*/
vmx_set_test_stage(1);
- vmx_preemption_timer_zero_inject_db(1 << DB_VECTOR);
+ vmx_preemption_timer_zero_inject_db(true);
vmx_preemption_timer_zero_expect_preempt_at_rip(db_fault_address);
vmx_preemption_timer_zero_advance_past_vmcall();