From 4f3ccd4f166c12ae2bbdf21af3a16da8a7f16a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Sun, 11 Oct 2020 21:49:18 +0200 Subject: tests/qtest: Replace magic value by NANOSECONDS_PER_SECOND definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use self-explicit NANOSECONDS_PER_SECOND definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201011194918.3219195-5-f4bug@amsat.org> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qtest/rtc-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c index c7af34f..402ce2c 100644 --- a/tests/qtest/rtc-test.c +++ b/tests/qtest/rtc-test.c @@ -292,7 +292,7 @@ static void alarm_time(void) break; } - clock_step(1000000000); + clock_step(NANOSECONDS_PER_SECOND); } g_assert(get_irq(RTC_ISA_IRQ)); -- cgit v1.1 From d44d9b6bc81df6080ed83073ab2711e5a4258a07 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Fri, 9 Oct 2020 16:55:11 -0400 Subject: Acceptance tests: bump pycdlib version for easier installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On with certain versions of "pip", package installations will attempt to create wheels. And, on environments without a "complete" Python installation (as described in the acceptance tests requirements docs), that will fail. pycdlib, starting with version 1.11.0, is now being made available as wheels, so its instalation on those constrained environments is now possible. Buglink: https://bugs.launchpad.net/qemu/+bug/1897783 Reported-by: Philippe Mathieu-Daudé Signed-off-by: Cleber Rosa Message-Id: <20201009205513.751968-2-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/requirements.txt b/tests/requirements.txt index 036691c..a1c631f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,4 +2,4 @@ # in the tests/venv Python virtual environment. For more info, # refer to: https://pip.pypa.io/en/stable/user_guide/#id1 avocado-framework==81.0 -pycdlib==1.9.0 +pycdlib==1.11.0 -- cgit v1.1 From d8dd10950199ee4a505dc4872171dcb1b4ca6710 Mon Sep 17 00:00:00 2001 From: Li Qiang Date: Mon, 21 Sep 2020 09:06:05 -0700 Subject: qtest: add fuzz test case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the device fuzzer finds more and more issues. For every fuzz case, we need not only the fixes but also the corresponding test case. We can analysis the reproducer for every case and find what happened in where and write a beautiful test case. However the raw data of reproducer is not friendly to analysis. It will take a very long time, even far more than the fixes itself. So let's create a new file to hold all of the fuzz test cases and just use the raw data to act as the test case. This way nobody will be afraid of writing a test case for the fuzz reproducer. This patch adds the issue LP#1878263 test case. Signed-off-by: Li Qiang Message-Id: <20200921160605.19329-1-liq3ea@163.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alexander Bulekov [thuth: Slightly adjusted commit message, removed empty lines] Signed-off-by: Thomas Huth --- tests/qtest/fuzz-test.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 2 files changed, 50 insertions(+) create mode 100644 tests/qtest/fuzz-test.c (limited to 'tests') diff --git a/tests/qtest/fuzz-test.c b/tests/qtest/fuzz-test.c new file mode 100644 index 0000000..2f38bb1 --- /dev/null +++ b/tests/qtest/fuzz-test.c @@ -0,0 +1,49 @@ +/* + * QTest testcase for fuzz case + * + * Copyright (c) 2020 Li Qiang + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqos/libqtest.h" + +/* + * This used to trigger the assert in scsi_dma_complete + * https://bugs.launchpad.net/qemu/+bug/1878263 + */ +static void test_lp1878263_megasas_zero_iov_cnt(void) +{ + QTestState *s; + + s = qtest_init("-nographic -monitor none -serial none " + "-M q35 -device megasas -device scsi-cd,drive=null0 " + "-blockdev driver=null-co,read-zeroes=on,node-name=null0"); + qtest_outl(s, 0xcf8, 0x80001818); + qtest_outl(s, 0xcfc, 0xc101); + qtest_outl(s, 0xcf8, 0x8000181c); + qtest_outl(s, 0xcf8, 0x80001804); + qtest_outw(s, 0xcfc, 0x7); + qtest_outl(s, 0xcf8, 0x8000186a); + qtest_writeb(s, 0x14, 0xfe); + qtest_writeb(s, 0x0, 0x02); + qtest_outb(s, 0xc1c0, 0x17); + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + const char *arch = qtest_get_arch(); + + g_test_init(&argc, &argv, NULL); + + if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { + qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt", + test_lp1878263_megasas_zero_iov_cnt); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 0f32ca0..6c6bfb5 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -54,6 +54,7 @@ qtests_i386 = \ 'bios-tables-test', 'rtc-test', 'i440fx-test', + 'fuzz-test', 'fw_cfg-test', 'device-plug-test', 'drive_del-test', -- cgit v1.1 From a4339de2de4def4beb33e22e6f506bcc8b9d9326 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 8 Oct 2020 17:03:30 +0100 Subject: tests/migration: Allow longer timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In travis, with gcov and gprof we're seeing timeouts; hopefully fix this by increasing the test timeouts a bit, but for xbzrle ensure it really does get a couple of cycles through to test the cache. I think the problem in travis is we have about 2 host CPU threads, in the test we have at least 3: a) The vCPU thread (100% flat out) b) The source migration thread c) The destination migration thread if (b) & (c) are slow for any reason - gcov+gperf or a slow host - then they're sharing one host CPU thread so limit the migration bandwidth. Tested on my laptop with: taskset -c 0,1 ./tests/qtest/migration-test -p /x86_64/migration Reported-by: Alex Bennée Signed-off-by: Dr. David Alan Gilbert Message-Id: <20201008160330.130431-1-dgilbert@redhat.com> [thuth: Move the #define to the right location] Signed-off-by: Thomas Huth --- tests/qtest/migration-test.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 00a233c..f410ec5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -34,6 +34,9 @@ unsigned start_address; unsigned end_address; static bool uffd_feature_thread_id; +/* A downtime where the test really should converge */ +#define CONVERGE_DOWNTIME 1000 + #if defined(__linux__) #include #include @@ -864,8 +867,7 @@ static void test_precopy_unix(void) wait_for_migration_pass(from); - /* 300 ms should converge */ - migrate_set_parameter_int(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -947,9 +949,11 @@ static void test_xbzrle(const char *uri) migrate_qmp(from, uri, "{}"); wait_for_migration_pass(from); + /* Make sure we have 2 passes, so the xbzrle cache gets a workout */ + wait_for_migration_pass(from); - /* 300ms should converge */ - migrate_set_parameter_int(from, "downtime-limit", 300); + /* 1000ms should converge */ + migrate_set_parameter_int(from, "downtime-limit", 1000); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -999,8 +1003,7 @@ static void test_precopy_tcp(void) wait_for_migration_pass(from); - /* 300ms should converge */ - migrate_set_parameter_int(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -1068,8 +1071,7 @@ static void test_migrate_fd_proto(void) wait_for_migration_pass(from); - /* 300ms should converge */ - migrate_set_parameter_int(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -1304,8 +1306,7 @@ static void test_multifd_tcp(const char *method) wait_for_migration_pass(from); - /* 300ms it should converge */ - migrate_set_parameter_int(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); -- cgit v1.1 From 07f5903c852de10fa71059f5e7594d203e077b10 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Tue, 29 Sep 2020 19:55:01 +0530 Subject: Add a comment in bios-tables-test.c to clarify the reason behind approach A comment is added in bios-tables-test.c that explains the reasoning behind the process of updating the ACPI table blobs when new tests are added or old tests are modified or code is committed that affect tests. The explanation would help future contributors follow the correct process when making code changes that affect ACPI tables. Signed-off-by: Ani Sinha Acked-by: Igor Mammedov Message-Id: <20200929142501.1057-1-ani@anisinha.ca> Signed-off-by: Thomas Huth --- tests/qtest/bios-tables-test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index e15f36c..5647624 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -11,7 +11,7 @@ */ /* - * How to add or update the tests: + * How to add or update the tests or commit changes that affect ACPI tables: * Contributor: * 1. add empty files for new tables, if any, under tests/data/acpi * 2. list any changed files in tests/qtest/bios-tables-test-allowed-diff.h @@ -38,6 +38,11 @@ * $(SRC_PATH)/tests/data/acpi/rebuild-expected-aml.sh * 6. Now commit any changes to the expected binary, include diff from step 4 * in commit log. + * Expected binary updates needs to be a separate patch from the code that + * introduces changes to ACPI tables. It lets the maintainer drop + * and regenerate binary updates in case of merge conflicts. Further, a code + * change is easily reviewable but a binary blob is not (without doing a + * disassembly). * 7. Before sending patches to the list (Contributor) * or before doing a pull request (Maintainer), make sure * tests/qtest/bios-tables-test-allowed-diff.h is empty - this will ensure -- cgit v1.1 From 2ae00c8b2f7536f1bb38c3eb40d76f4196c61d0c Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Sat, 19 Sep 2020 12:27:20 +0200 Subject: Remove superfluous .gitignore files Since we are now always doing out-of-tree builds, these gitignore files should not be necessary anymore. Message-Id: <20200919133637.72744-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/.gitignore | 32 -------------------------------- tests/fp/.gitignore | 2 -- tests/migration/.gitignore | 2 -- tests/multiboot/.gitignore | 3 --- tests/qemu-iotests/.gitignore | 9 --------- tests/tcg/.gitignore | 5 ----- tests/uefi-test-tools/.gitignore | 3 --- 7 files changed, 56 deletions(-) delete mode 100644 tests/.gitignore delete mode 100644 tests/fp/.gitignore delete mode 100644 tests/migration/.gitignore delete mode 100644 tests/multiboot/.gitignore delete mode 100644 tests/qemu-iotests/.gitignore delete mode 100644 tests/tcg/.gitignore delete mode 100644 tests/uefi-test-tools/.gitignore (limited to 'tests') diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index d03c037..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -atomic_add-bench -benchmark-crypto-cipher -benchmark-crypto-hash -benchmark-crypto-hmac -check-* -!check-*.c -!check-*.sh -fp/*.out -qht-bench -rcutorture -test-* -!test-*.c -!test-*.py -!docker/test-* -test-qapi-commands.[ch] -test-qapi-init-commands.[ch] -include/test-qapi-commands-sub-module.[ch] -test-qapi-commands-sub-sub-module.[ch] -test-qapi-emit-events.[ch] -test-qapi-events.[ch] -include/test-qapi-events-sub-module.[ch] -test-qapi-events-sub-sub-module.[ch] -test-qapi-types.[ch] -include/test-qapi-types-sub-module.[ch] -test-qapi-types-sub-sub-module.[ch] -test-qapi-visit.[ch] -include/test-qapi-visit-sub-module.[ch] -test-qapi-visit-sub-sub-module.[ch] -test-qapi-introspect.[ch] -*-test -qapi-schema/*.test.* -vm/*.img diff --git a/tests/fp/.gitignore b/tests/fp/.gitignore deleted file mode 100644 index 704fd42..0000000 --- a/tests/fp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -fp-test -fp-bench diff --git a/tests/migration/.gitignore b/tests/migration/.gitignore deleted file mode 100644 index 84f3755..0000000 --- a/tests/migration/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -initrd-stress.img -stress diff --git a/tests/multiboot/.gitignore b/tests/multiboot/.gitignore deleted file mode 100644 index 93ef998..0000000 --- a/tests/multiboot/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.bin -*.elf -test.out diff --git a/tests/qemu-iotests/.gitignore b/tests/qemu-iotests/.gitignore deleted file mode 100644 index da62054..0000000 --- a/tests/qemu-iotests/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -check.log -check.time* -common.env -*.out.bad -*.notrun -socket_scm_helper - -# ignore everything in the scratch directory -scratch/ diff --git a/tests/tcg/.gitignore b/tests/tcg/.gitignore deleted file mode 100644 index 84d7541..0000000 --- a/tests/tcg/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# These are build artefacts which only appear when you are doing -# builds directly in the source tree. -config-*.mak -*-softmmu/ -*-linux-user/ diff --git a/tests/uefi-test-tools/.gitignore b/tests/uefi-test-tools/.gitignore deleted file mode 100644 index 9f24670..0000000 --- a/tests/uefi-test-tools/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Build -Conf -log -- cgit v1.1