aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/machine_sparc64_sun4u.py36
-rw-r--r--tests/qtest/device-introspect-test.c5
-rw-r--r--tests/qtest/fuzz/fork_fuzz.c40
-rw-r--r--tests/qtest/fuzz/fuzz.c3
-rw-r--r--tests/qtest/libqtest.c4
-rw-r--r--tests/qtest/qom-test.c5
-rw-r--r--tests/qtest/test-hmp.c5
7 files changed, 56 insertions, 42 deletions
diff --git a/tests/acceptance/machine_sparc64_sun4u.py b/tests/acceptance/machine_sparc64_sun4u.py
new file mode 100644
index 0000000000..458165500e
--- /dev/null
+++ b/tests/acceptance/machine_sparc64_sun4u.py
@@ -0,0 +1,36 @@
+# Functional test that boots a Linux kernel and checks the console
+#
+# Copyright (c) 2020 Red Hat, Inc.
+#
+# Author:
+# Thomas Huth <thuth@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+
+import os
+
+from avocado_qemu import wait_for_console_pattern
+from avocado.utils import archive
+from boot_linux_console import LinuxKernelTest
+
+class Sun4uMachine(LinuxKernelTest):
+ """Boots the Linux kernel and checks that the console is operational"""
+
+ timeout = 90
+
+ def test_sparc64_sun4u(self):
+ """
+ :avocado: tags=arch:sparc64
+ :avocado: tags=machine:sun4u
+ """
+ tar_url = ('https://www.qemu-advent-calendar.org'
+ '/2018/download/day23.tar.xz')
+ tar_hash = '142db83cd974ffadc4f75c8a5cad5bcc5722c240'
+ file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
+ archive.extract(file_path, self.workdir)
+ self.vm.set_console()
+ self.vm.add_args('-kernel', self.workdir + '/day23/vmlinux',
+ '-append', self.KERNEL_COMMON_COMMAND_LINE)
+ self.vm.launch()
+ wait_for_console_pattern(self, 'Starting logging: OK')
diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-introspect-test.c
index f2c1576cae..9abb5ec889 100644
--- a/tests/qtest/device-introspect-test.c
+++ b/tests/qtest/device-introspect-test.c
@@ -287,11 +287,6 @@ static void add_machine_test_case(const char *mname)
{
char *path, *args;
- /* Ignore blacklisted machines */
- if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
- return;
- }
-
path = g_strdup_printf("device/introspect/concrete/defaults/%s", mname);
args = g_strdup_printf("-M %s", mname);
qtest_add_data_func(path, args, test_device_intro_concrete);
diff --git a/tests/qtest/fuzz/fork_fuzz.c b/tests/qtest/fuzz/fork_fuzz.c
index 2bd0851903..6ffb2a7937 100644
--- a/tests/qtest/fuzz/fork_fuzz.c
+++ b/tests/qtest/fuzz/fork_fuzz.c
@@ -17,39 +17,25 @@
void counter_shm_init(void)
{
- char *shm_path = g_strdup_printf("/qemu-fuzz-cntrs.%d", getpid());
- int fd = shm_open(shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
- g_free(shm_path);
-
- if (fd == -1) {
- perror("Error: ");
- exit(1);
- }
- if (ftruncate(fd, &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START) == -1) {
- perror("Error: ");
- exit(1);
- }
- /* Copy what's in the counter region to the shm.. */
- void *rptr = mmap(NULL ,
- &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
- PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- memcpy(rptr,
+ /* Copy what's in the counter region to a temporary buffer.. */
+ void *copy = malloc(&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
+ memcpy(copy,
&__FUZZ_COUNTERS_START,
&__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
- munmap(rptr, &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
-
- /* And map the shm over the counter region */
- rptr = mmap(&__FUZZ_COUNTERS_START,
- &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
- PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0);
-
- close(fd);
-
- if (!rptr) {
+ /* Map a shared region over the counter region */
+ if (mmap(&__FUZZ_COUNTERS_START,
+ &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START,
+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS,
+ 0, 0) == MAP_FAILED) {
perror("Error: ");
exit(1);
}
+
+ /* Copy the original data back to the counter-region */
+ memcpy(&__FUZZ_COUNTERS_START, copy,
+ &__FUZZ_COUNTERS_END - &__FUZZ_COUNTERS_START);
+ free(copy);
}
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index a44fe479db..a36d9038e0 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -211,5 +211,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
qemu_init(result.we_wordc, result.we_wordv, NULL);
+ /* re-enable the rcu atfork, which was previously disabled in qemu_init */
+ rcu_enable_atfork();
+
return 0;
}
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 49075b55a1..fd4680590d 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1232,6 +1232,10 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
qstr = qobject_to(QString, qobj);
g_assert(qstr);
mname = qstring_get_str(qstr);
+ /* Ignore machines that cannot be used for qtests */
+ if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
+ continue;
+ }
if (!skip_old_versioned || !qtest_is_old_versioned_machine(mname)) {
cb(mname);
}
diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c
index e338a41194..1acf0d7369 100644
--- a/tests/qtest/qom-test.c
+++ b/tests/qtest/qom-test.c
@@ -81,11 +81,6 @@ static void add_machine_test_case(const char *mname)
{
char *path;
- /* Ignore blacklisted machines that have known problems */
- if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
- return;
- }
-
path = g_strdup_printf("qom/%s", mname);
qtest_add_data_func(path, g_strdup(mname), test_machine);
g_free(path);
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index b8b1271b9e..d5e7ebd176 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -143,11 +143,6 @@ static void add_machine_test_case(const char *mname)
{
char *path;
- /* Ignore blacklisted machines that have known problems */
- if (!memcmp("xenfv", mname, 5) || g_str_equal("xenpv", mname)) {
- return;
- }
-
path = g_strdup_printf("hmp/%s", mname);
qtest_add_data_func(path, g_strdup(mname), test_machine);
g_free(path);