qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>
Subject: [Qemu-devel] [PULL 14/74] tests: Skip old versioned machine types in quick testing mode
Date: Tue, 21 Aug 2018 19:01:46 +0200	[thread overview]
Message-ID: <1534870966-9287-15-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1534870966-9287-1-git-send-email-pbonzini@redhat.com>

From: Thomas Huth <thuth@redhat.com>

The tests that check something for all machine types currently spend
a lot of time checking old machine types (like "pc-i440fx-2.0" for
example). The chances that we find something new there in addition
to checking the latest version of a machine type are pretty low, so
we should not waste the time of the developers by testing this again
and again in the "quick" testing mode.
Thus let's add some code to determine whether we are testing a current
machine type or an old one, and only test the old types if we are
running in "SPEED=slow" mode.
This decreases the testing time quite a bit now, e.g. the qom-test
now finishes within 4 seconds for qemu-system-x86_64 instead of 30
seconds when testing all machines.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1534419358-10932-6-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/cpu-plug-test.c |  6 +++---
 tests/libqtest.c      | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--
 tests/libqtest.h      |  4 +++-
 tests/qom-test.c      |  2 +-
 tests/test-hmp.c      |  2 +-
 5 files changed, 58 insertions(+), 8 deletions(-)

diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c
index f5d57da..3e93c8e 100644
--- a/tests/cpu-plug-test.c
+++ b/tests/cpu-plug-test.c
@@ -257,11 +257,11 @@ int main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_cb_for_every_machine(add_pc_test_case);
+        qtest_cb_for_every_machine(add_pc_test_case, g_test_quick());
     } else if (g_str_equal(arch, "ppc64")) {
-        qtest_cb_for_every_machine(add_pseries_test_case);
+        qtest_cb_for_every_machine(add_pseries_test_case, g_test_quick());
     } else if (g_str_equal(arch, "s390x")) {
-        qtest_cb_for_every_machine(add_s390x_test_case);
+        qtest_cb_for_every_machine(add_s390x_test_case, g_test_quick());
     }
 
     return g_test_run();
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 852ccff..1eefad4 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -991,7 +991,53 @@ bool qtest_big_endian(QTestState *s)
     return s->big_endian;
 }
 
-void qtest_cb_for_every_machine(void (*cb)(const char *machine))
+static bool qtest_check_machine_version(const char *mname, const char *basename,
+                                        int major, int minor)
+{
+    char *newname;
+    bool is_equal;
+
+    newname = g_strdup_printf("%s-%i.%i", basename, major, minor);
+    is_equal = g_str_equal(mname, newname);
+    g_free(newname);
+
+    return is_equal;
+}
+
+static bool qtest_is_old_versioned_machine(const char *mname)
+{
+    const char *dash = strrchr(mname, '-');
+    const char *dot = strrchr(mname, '.');
+    const char *chr;
+    char *bname;
+    const int major = QEMU_VERSION_MAJOR;
+    const int minor = QEMU_VERSION_MINOR;
+    bool res = false;
+
+    if (dash && dot && dot > dash) {
+        for (chr = dash + 1; *chr; chr++) {
+            if (!isdigit(*chr) && *chr != '.') {
+                return false;
+            }
+        }
+        /*
+         * Now check if it is one of the latest versions. Check major + 1
+         * and minor + 1 versions as well, since they might already exist
+         * in the development branch.
+         */
+        bname = g_strdup(mname);
+        bname[dash - mname] = 0;
+        res = !qtest_check_machine_version(mname, bname, major + 1, 0) &&
+              !qtest_check_machine_version(mname, bname, major, minor + 1) &&
+              !qtest_check_machine_version(mname, bname, major, minor);
+        g_free(bname);
+    }
+
+    return res;
+}
+
+void qtest_cb_for_every_machine(void (*cb)(const char *machine),
+                                bool skip_old_versioned)
 {
     QDict *response, *minfo;
     QList *list;
@@ -1014,7 +1060,9 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine))
         qstr = qobject_to(QString, qobj);
         g_assert(qstr);
         mname = qstring_get_str(qstr);
-        cb(mname);
+        if (!skip_old_versioned || !qtest_is_old_versioned_machine(mname)) {
+            cb(mname);
+        }
     }
 
     qtest_end();
diff --git a/tests/libqtest.h b/tests/libqtest.h
index def1eda..1159b73 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -954,10 +954,12 @@ QDict *qmp_fd(int fd, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
 /**
  * qtest_cb_for_every_machine:
  * @cb: Pointer to the callback function
+ * @skip_old_versioned: true if versioned old machine types should be skipped
  *
  *  Call a callback function for every name of all available machines.
  */
-void qtest_cb_for_every_machine(void (*cb)(const char *machine));
+void qtest_cb_for_every_machine(void (*cb)(const char *machine),
+                                bool skip_old_versioned);
 
 /**
  * qtest_qmp_device_add:
diff --git a/tests/qom-test.c b/tests/qom-test.c
index e6f712c..73c52af 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
 
-    qtest_cb_for_every_machine(add_machine_test_case);
+    qtest_cb_for_every_machine(add_machine_test_case, g_test_quick());
 
     return g_test_run();
 }
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 5352c9c..1a3a9c5 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
 
     g_test_init(&argc, &argv, NULL);
 
-    qtest_cb_for_every_machine(add_machine_test_case);
+    qtest_cb_for_every_machine(add_machine_test_case, g_test_quick());
 
     /* as none machine has no memory by default, add a test case with memory */
     qtest_add_data_func("hmp/none+2MB", g_strdup("none -m 2"), test_machine);
-- 
1.8.3.1

  parent reply	other threads:[~2018-08-21 17:03 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21 17:01 [Qemu-devel] [PULL 00/74] Misc patches for 2018-08-21 Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 01/74] tests: virtio: separate ccw tests from libqos Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 02/74] scsi: mptsas: Mark as storage device Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 03/74] es1370: simplify MemoryRegionOps Paolo Bonzini
2018-08-24 15:04   ` Peter Maydell
2018-08-24 15:15     ` Peter Maydell
2018-08-25  7:48     ` Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 04/74] fix "Missing break in switch" coverity reports Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 05/74] checkpatch: fix filename detection when using -f Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 06/74] qemu-pr-helper: Fix build on CentOS 7 Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 07/74] chardev/char-fe: Fix typos Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 08/74] megasas: fix sglist leak Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 09/74] MAINTAINERS: add maintainers for qtest Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 10/74] tests/migration-test: Silence the kvm_hv message by default Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 11/74] net: Silence 'has no peer' messages in testing mode Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 12/74] hw/timer/mc146818rtc: White space clean-up Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 13/74] hw/timer/mc146818rtc: Fix introspection problem Paolo Bonzini
2018-08-21 17:01 ` Paolo Bonzini [this message]
2018-08-21 17:01 ` [Qemu-devel] [PULL 15/74] tests/device-introspection: Check that the qom-tree and qtree do not change Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 16/74] tests/device-introspect: Test with all machines, not only with "none" Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 17/74] seqlock: constify seqlock_read_begin Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 18/74] qsp: QEMU's Synchronization Profiler Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 19/74] qsp: add sort_by option to qsp_report Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 20/74] qsp: add qsp_reset Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 21/74] qsp: support call site coalescing Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 22/74] qsp: track BQL callers explicitly Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 23/74] tests/atomic_add-bench: add -p to enable sync profiler Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 24/74] vl: add -enable-sync-profile Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 25/74] hmp-commands: add sync-profile Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 26/74] hmp-commands-info: " Paolo Bonzini
2018-08-21 17:01 ` [Qemu-devel] [PULL 27/74] checkpatch: allow space in more places before a bracket Paolo Bonzini
2018-08-21 18:38   ` Linus Torvalds
2018-08-22  8:56     ` Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 28/74] update-linux-headers.sh: add qemu_fw_cfg.h Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 29/74] fw_cfg: import & use linux/qemu_fw_cfg.h Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 30/74] i386: Fix arch_query_cpu_model_expansion() leak Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 31/74] lsi_scsi: add support for PPR Extended Message Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 32/74] kvm: add call to qemu_add_opts() for -overcommit option Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 33/74] build-sys: remove glib_subprocess check Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 34/74] target-i386: Fix lcall/ljmp to call gate in IA-32e mode Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 35/74] target-i386: fix segment limit check in ljmp Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 36/74] rcu_queue: use atomic_set in QLIST_REMOVE_RCU Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 37/74] rcu_queue: remove barrier from QLIST_EMPTY_RCU Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 38/74] rcu_queue: add RCU QSIMPLEQ Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 39/74] rcu_queue: add RCU QTAILQ Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 40/74] test-rcu-list: access goflag with atomics Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 41/74] test-rcu-list: access counters " Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 42/74] test-rcu-list: abstract the list implementation Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 43/74] tests: add test-list-simpleq Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 44/74] tests: add test-rcu-tailq Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 45/74] spapr: do not use CPU_FOREACH_REVERSE Paolo Bonzini
2018-08-24 15:20   ` Peter Maydell
2018-08-24 20:24     ` Emilio G. Cota
2018-08-21 17:02 ` [Qemu-devel] [PULL 46/74] qom: convert the CPU list to RCU Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 47/74] hw/intc/apic: Switch away from old_mmio Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 48/74] qemu-guest-agent: freeze-hook to ignore dpkg files as well Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 49/74] module: Use QEMU_MODULE_DIR as a search path Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 50/74] cpus: protect all icount computation with seqlock Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 51/74] seqlock: add QemuLockable support Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 52/74] cpus: protect TimerState writes with a spinlock Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 53/74] cpus: allow cpu_get_ticks out of BQL Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 54/74] vhost-user-scsi: move host_features into VHostSCSICommon Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 55/74] vhost-scsi: unify vhost-scsi get_features implementations Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 56/74] vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 57/74] ipmi: Use proper struct reference for BT vmstate Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 58/74] pc-dimm: assign and verify the "slot" property during pre_plug Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 59/74] util/oslib-win32: indicate alignment for qemu_anon_ram_alloc() Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 60/74] pc: drop memory region alignment check for 0 Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 61/74] pc-dimm: assign and verify the "addr" property during pre_plug Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 62/74] i2c: pm_smbus: Clean up some style issues Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 63/74] i2c: pm_smbus: Fix the semantics of block I2C transfers Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 64/74] i2c: pm_smbus: Make the I2C block read command read-only Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 65/74] i2c: pm_smbus: Add block transfer capability Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 66/74] i2c: pm_smbus: Add interrupt handling Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 67/74] i2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 68/74] i2c: pm_smbus: Add the ability to force block transfer enable Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 69/74] target/i386: update MPX flags when CPL changes Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 70/74] KVM: cleanup unnecessary #ifdef KVM_CAP_ Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 71/74] Revert "chardev: tcp: postpone TLS work until machine done" Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 72/74] Revert "chardev: tcp: postpone async connection setup" Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 73/74] char-socket: update all ioc handlers when changing context Paolo Bonzini
2018-08-21 17:02 ` [Qemu-devel] [PULL 74/74] test-char: add socket reconnect test Paolo Bonzini
2018-08-23 11:25 ` [Qemu-devel] [PULL 00/74] Misc patches for 2018-08-21 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1534870966-9287-15-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).