summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-03-24 21:42:12 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-03-24 21:42:40 +0000
commit84a5a8014801a83d1b8d15fa7f0fde03db081530 (patch)
tree9b7090464e9b910d6e083f44ed54e9afe85b7ff2 /tests
parentb68a80139e37e806f004237e55311ebc42151434 (diff)
parent0f70ed4759a29ca932af1e9525729f4f455642f8 (diff)
downloadqemu-84a5a8014801a83d1b8d15fa7f0fde03db081530.tar.gz
qemu-84a5a8014801a83d1b8d15fa7f0fde03db081530.tar.bz2
qemu-84a5a8014801a83d1b8d15fa7f0fde03db081530.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* Log filtering from Alex and Peter * Chardev fix from Marc-André * config.status tweak from David * Header file tweaks from Markus, myself and Veronia (Outreachy candidate) * get_ticks_per_sec() removal from Rutuja (Outreachy candidate) * Coverity fix from myself * PKE implementation from myself, based on rth's XSAVE support # gpg: Signature made Thu 24 Mar 2016 20:15:11 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (28 commits) target-i386: implement PKE for TCG config.status: Pass extra parameters char: translate from QIOChannel error to errno exec: fix error handling in file_ram_alloc cputlb: modernise the debug support qemu-log: support simple pid substitution for logs target-arm: dfilter support for in_asm qemu-log: dfilter-ise exec, out_asm, op and opt_op qemu-log: new option -dfilter to limit output qemu-log: Improve the "exec" TB execution logging qemu-log: Avoid function call for disabled qemu_log_mask logging qemu-log: correct help text for -d cpu tcg: pass down TranslationBlock to tcg_code_gen util: move declarations out of qemu-common.h Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND hw: explicitly include qemu-common.h and cpu.h include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h Move ParallelIOArg from qemu-common.h to sysemu/char.h Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Conflicts: scripts/clean-includes
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile4
-rw-r--r--tests/boot-order-test.c4
-rw-r--r--tests/check-qom-proplist.c1
-rw-r--r--tests/fw_cfg-test.c3
-rw-r--r--tests/io-channel-helpers.c1
-rw-r--r--tests/libqos/malloc-pc.c3
-rw-r--r--tests/qom-test.c1
-rw-r--r--tests/tcg/linux-test.c1
-rw-r--r--tests/tcg/test-i386-fprem.c4
-rw-r--r--tests/test-aio.c1
-rw-r--r--tests/test-base64.c2
-rw-r--r--tests/test-blockjob-txn.c1
-rw-r--r--tests/test-crypto-afsplit.c1
-rw-r--r--tests/test-crypto-block.c1
-rw-r--r--tests/test-crypto-cipher.c1
-rw-r--r--tests/test-crypto-ivgen.c1
-rw-r--r--tests/test-crypto-pbkdf.c1
-rw-r--r--tests/test-crypto-secret.c2
-rw-r--r--tests/test-crypto-tlscredsx509.c1
-rw-r--r--tests/test-crypto-tlssession.c1
-rw-r--r--tests/test-cutils.c3
-rw-r--r--tests/test-io-channel-command.c1
-rw-r--r--tests/test-io-channel-file.c2
-rw-r--r--tests/test-io-channel-socket.c1
-rw-r--r--tests/test-io-task.c1
-rw-r--r--tests/test-logging.c141
-rw-r--r--tests/test-opts-visitor.c1
-rw-r--r--tests/test-qemu-opts.c1
-rw-r--r--tests/test-qmp-input-strict.c1
-rw-r--r--tests/test-qmp-input-visitor.c1
-rw-r--r--tests/test-qmp-output-visitor.c1
-rw-r--r--tests/test-string-input-visitor.c1
-rw-r--r--tests/test-string-output-visitor.c1
-rw-r--r--tests/test-thread-pool.c1
-rw-r--r--tests/test-throttle.c1
-rw-r--r--tests/test-visitor-serialization.c1
-rw-r--r--tests/test-xbzrle.c1
37 files changed, 181 insertions, 14 deletions
diff --git a/tests/Makefile b/tests/Makefile
index d1ff18200f..ab185d8647 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -97,6 +97,8 @@ check-unit-y += tests/test-crypto-ivgen$(EXESUF)
check-unit-y += tests/test-crypto-afsplit$(EXESUF)
check-unit-y += tests/test-crypto-xts$(EXESUF)
check-unit-y += tests/test-crypto-block$(EXESUF)
+gcov-files-test-logging-y = tests/test-logging.c
+check-unit-y += tests/test-logging$(EXESUF)
check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
@@ -436,6 +438,8 @@ tests/test-timed-average$(EXESUF): tests/test-timed-average.o qemu-timer.o \
tests/test-base64$(EXESUF): tests/test-base64.o \
libqemuutil.a libqemustub.a
+tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
+
tests/test-qapi-types.c tests/test-qapi-types.h :\
$(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py)
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c
index 210964a00c..a6d8bd5cbf 100644
--- a/tests/boot-order-test.c
+++ b/tests/boot-order-test.c
@@ -15,9 +15,7 @@
#include "libqos/fw_cfg.h"
#include "libqtest.h"
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
-#undef NO_QEMU_PROTOS
+#include "hw/nvram/fw_cfg_keys.h"
typedef struct {
const char *args;
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index a2bb556906..ffffd872f2 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include <glib.h>
+#include "qapi/error.h"
#include "qom/object.h"
#include "qemu/module.h"
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 398643aada..b4392c2d38 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -14,8 +14,7 @@
#include <glib.h>
#include "libqtest.h"
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
+#include "hw/nvram/fw_cfg_keys.h"
#include "libqos/fw_cfg.h"
static uint64_t ram_size = 128 << 20;
diff --git a/tests/io-channel-helpers.c b/tests/io-channel-helpers.c
index a4dedbe0ad..05e5579cf8 100644
--- a/tests/io-channel-helpers.c
+++ b/tests/io-channel-helpers.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "io-channel-helpers.h"
+#include "qapi/error.h"
struct QIOChannelTest {
QIOChannel *src;
diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c
index 74f76c59db..eee706bd63 100644
--- a/tests/libqos/malloc-pc.c
+++ b/tests/libqos/malloc-pc.c
@@ -14,8 +14,7 @@
#include "libqos/malloc-pc.h"
#include "libqos/fw_cfg.h"
-#define NO_QEMU_PROTOS
-#include "hw/nvram/fw_cfg.h"
+#include "hw/nvram/fw_cfg_keys.h"
#include "qemu-common.h"
#include <glib.h>
diff --git a/tests/qom-test.c b/tests/qom-test.c
index 3c6cfca788..bd5cdde261 100644
--- a/tests/qom-test.c
+++ b/tests/qom-test.c
@@ -11,6 +11,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "libqtest.h"
#include "qapi/qmp/types.h"
diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c
index 1c6c01318e..5070d31446 100644
--- a/tests/tcg/linux-test.c
+++ b/tests/tcg/linux-test.c
@@ -39,6 +39,7 @@
#include <dirent.h>
#include <setjmp.h>
#include <sys/shm.h>
+#include "qemu/cutils.h"
#define TESTPATH "/tmp/linux-test.tmp"
#define TESTPORT 7654
diff --git a/tests/tcg/test-i386-fprem.c b/tests/tcg/test-i386-fprem.c
index e91fb1ae93..1a71623204 100644
--- a/tests/tcg/test-i386-fprem.c
+++ b/tests/tcg/test-i386-fprem.c
@@ -22,10 +22,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include "qemu/compiler.h"
+
#include "qemu/osdep.h"
-#include <stdio.h>
-#include <inttypes.h>
/*
* Inspired by <ieee754.h>'s union ieee854_long_double, but with single
diff --git a/tests/test-aio.c b/tests/test-aio.c
index a109bd0c42..687dfa062e 100644
--- a/tests/test-aio.c
+++ b/tests/test-aio.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include <glib.h>
#include "block/aio.h"
+#include "qapi/error.h"
#include "qemu/timer.h"
#include "qemu/sockets.h"
#include "qemu/error-report.h"
diff --git a/tests/test-base64.c b/tests/test-base64.c
index ae0c107c7d..922e839dd6 100644
--- a/tests/test-base64.c
+++ b/tests/test-base64.c
@@ -21,9 +21,9 @@
#include "qemu/osdep.h"
#include <glib.h>
+#include "qapi/error.h"
#include "qemu/base64.h"
-
static void test_base64_good(void)
{
const char input[] =
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c
index c866da66c8..55fad9507a 100644
--- a/tests/test-blockjob-txn.c
+++ b/tests/test-blockjob-txn.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include <glib.h>
+#include "qapi/error.h"
#include "qemu/main-loop.h"
#include "block/blockjob.h"
diff --git a/tests/test-crypto-afsplit.c b/tests/test-crypto-afsplit.c
index ceaac0a06d..f9f2fcd417 100644
--- a/tests/test-crypto-afsplit.c
+++ b/tests/test-crypto-afsplit.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "crypto/init.h"
#include "crypto/afsplit.h"
diff --git a/tests/test-crypto-block.c b/tests/test-crypto-block.c
index cdbe09d4ed..a38110d3ff 100644
--- a/tests/test-crypto-block.c
+++ b/tests/test-crypto-block.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "crypto/init.h"
#include "crypto/block.h"
#include "qemu/buffer.h"
diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c
index e52b741f87..66d1c63fd5 100644
--- a/tests/test-crypto-cipher.c
+++ b/tests/test-crypto-cipher.c
@@ -23,6 +23,7 @@
#include "crypto/init.h"
#include "crypto/cipher.h"
+#include "qapi/error.h"
typedef struct QCryptoCipherTestData QCryptoCipherTestData;
struct QCryptoCipherTestData {
diff --git a/tests/test-crypto-ivgen.c b/tests/test-crypto-ivgen.c
index 96129da367..a5ff5d3da6 100644
--- a/tests/test-crypto-ivgen.c
+++ b/tests/test-crypto-ivgen.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "crypto/ivgen.h"
diff --git a/tests/test-crypto-pbkdf.c b/tests/test-crypto-pbkdf.c
index bb9c14c110..8ceceb1827 100644
--- a/tests/test-crypto-pbkdf.c
+++ b/tests/test-crypto-pbkdf.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "crypto/init.h"
#ifndef _WIN32
#include <sys/resource.h>
diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c
index 2bbc4d9e3c..aa26c20499 100644
--- a/tests/test-crypto-secret.c
+++ b/tests/test-crypto-secret.c
@@ -23,6 +23,8 @@
#include "crypto/init.h"
#include "crypto/secret.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
static void test_secret_direct(void)
{
diff --git a/tests/test-crypto-tlscredsx509.c b/tests/test-crypto-tlscredsx509.c
index 7ca387db65..af2f80e89c 100644
--- a/tests/test-crypto-tlscredsx509.c
+++ b/tests/test-crypto-tlscredsx509.c
@@ -22,6 +22,7 @@
#include "crypto-tls-x509-helpers.h"
#include "crypto/tlscredsx509.h"
+#include "qapi/error.h"
#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
diff --git a/tests/test-crypto-tlssession.c b/tests/test-crypto-tlssession.c
index 036a86b0c3..1a4a066d76 100644
--- a/tests/test-crypto-tlssession.c
+++ b/tests/test-crypto-tlssession.c
@@ -24,6 +24,7 @@
#include "crypto/tlscredsx509.h"
#include "crypto/tlssession.h"
#include "qom/object_interfaces.h"
+#include "qapi/error.h"
#include "qemu/sockets.h"
#include "qemu/acl.h"
diff --git a/tests/test-cutils.c b/tests/test-cutils.c
index 398700df45..fb8f5b5321 100644
--- a/tests/test-cutils.c
+++ b/tests/test-cutils.c
@@ -28,8 +28,7 @@
#include "qemu/osdep.h"
#include <glib.h>
-#include "qemu-common.h"
-
+#include "qemu/cutils.h"
static void test_parse_uint_null(void)
{
diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c
index 885543760a..1d1f461bed 100644
--- a/tests/test-io-channel-command.c
+++ b/tests/test-io-channel-command.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "io/channel-command.h"
#include "io-channel-helpers.h"
+#include "qapi/error.h"
#ifndef WIN32
static void test_io_channel_command_fifo(bool async)
diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c
index 1e7f3c7f12..6bfede6bb7 100644
--- a/tests/test-io-channel-file.c
+++ b/tests/test-io-channel-file.c
@@ -22,7 +22,7 @@
#include "io/channel-file.h"
#include "io/channel-util.h"
#include "io-channel-helpers.h"
-
+#include "qapi/error.h"
static void test_io_channel_file(void)
{
diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c
index be0c3003d4..9d94adb9ac 100644
--- a/tests/test-io-channel-socket.c
+++ b/tests/test-io-channel-socket.c
@@ -22,6 +22,7 @@
#include "io/channel-socket.h"
#include "io/channel-util.h"
#include "io-channel-helpers.h"
+#include "qapi/error.h"
#ifndef AI_ADDRCONFIG
# define AI_ADDRCONFIG 0
diff --git a/tests/test-io-task.c b/tests/test-io-task.c
index ae46c56a47..5a9775086c 100644
--- a/tests/test-io-task.c
+++ b/tests/test-io-task.c
@@ -22,6 +22,7 @@
#include <glib.h>
#include "io/task.h"
+#include "qapi/error.h"
#define TYPE_DUMMY "qemu:dummy"
diff --git a/tests/test-logging.c b/tests/test-logging.c
new file mode 100644
index 0000000000..ac8deedc9a
--- /dev/null
+++ b/tests/test-logging.c
@@ -0,0 +1,141 @@
+/*
+ * logging unit-tests
+ *
+ * Copyright (C) 2016 Linaro Ltd.
+ *
+ * Author: Alex Bennée <alex.bennee@linaro.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include <glib.h>
+
+#include "qemu-common.h"
+#include "include/qemu/log.h"
+
+static void test_parse_range(void)
+{
+ qemu_set_dfilter_ranges("0x1000+0x100");
+
+ g_assert_false(qemu_log_in_addr_range(0xfff));
+ g_assert(qemu_log_in_addr_range(0x1000));
+ g_assert(qemu_log_in_addr_range(0x1001));
+ g_assert(qemu_log_in_addr_range(0x10ff));
+ g_assert_false(qemu_log_in_addr_range(0x1100));
+
+ qemu_set_dfilter_ranges("0x1000-0x100");
+
+ g_assert_false(qemu_log_in_addr_range(0x1001));
+ g_assert(qemu_log_in_addr_range(0x1000));
+ g_assert(qemu_log_in_addr_range(0x0f01));
+ g_assert_false(qemu_log_in_addr_range(0x0f00));
+
+ qemu_set_dfilter_ranges("0x1000..0x1100");
+
+ g_assert_false(qemu_log_in_addr_range(0xfff));
+ g_assert(qemu_log_in_addr_range(0x1000));
+ g_assert(qemu_log_in_addr_range(0x1100));
+ g_assert_false(qemu_log_in_addr_range(0x1101));
+
+ qemu_set_dfilter_ranges("0x1000..0x1000");
+
+ g_assert_false(qemu_log_in_addr_range(0xfff));
+ g_assert(qemu_log_in_addr_range(0x1000));
+ g_assert_false(qemu_log_in_addr_range(0x1001));
+
+ qemu_set_dfilter_ranges("0x1000+0x100,0x2100-0x100,0x3000..0x3100");
+ g_assert(qemu_log_in_addr_range(0x1050));
+ g_assert(qemu_log_in_addr_range(0x2050));
+ g_assert(qemu_log_in_addr_range(0x3050));
+}
+
+#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
+static void test_parse_invalid_range_subprocess(void)
+{
+ qemu_set_dfilter_ranges("0x1000+onehundred");
+}
+static void test_parse_invalid_range(void)
+{
+ g_test_trap_subprocess("/logging/parse_invalid_range/subprocess", 0, 0);
+ g_test_trap_assert_failed();
+ g_test_trap_assert_stdout("");
+ g_test_trap_assert_stderr("*Failed to parse range in: 0x1000+onehundred\n");
+}
+static void test_parse_zero_range_subprocess(void)
+{
+ qemu_set_dfilter_ranges("0x1000+0");
+}
+static void test_parse_zero_range(void)
+{
+ g_test_trap_subprocess("/logging/parse_zero_range/subprocess", 0, 0);
+ g_test_trap_assert_failed();
+ g_test_trap_assert_stdout("");
+ g_test_trap_assert_stderr("*Failed to parse range in: 0x1000+0\n");
+}
+
+/* As the only real failure from a bad log filename path spec is
+ * reporting to the user we have to use the g_test_trap_subprocess
+ * mechanism and check no errors reported on stderr.
+ */
+static void test_parse_path_subprocess(void)
+{
+ /* All these should work without issue */
+ qemu_set_log_filename("/tmp/qemu.log");
+ qemu_set_log_filename("/tmp/qemu-%d.log");
+ qemu_set_log_filename("/tmp/qemu.log.%d");
+}
+static void test_parse_path(void)
+{
+ g_test_trap_subprocess ("/logging/parse_path/subprocess", 0, 0);
+ g_test_trap_assert_passed();
+ g_test_trap_assert_stdout("");
+ g_test_trap_assert_stderr("");
+}
+static void test_parse_invalid_path_subprocess(void)
+{
+ qemu_set_log_filename("/tmp/qemu-%d%d.log");
+}
+static void test_parse_invalid_path(void)
+{
+ g_test_trap_subprocess ("/logging/parse_invalid_path/subprocess", 0, 0);
+ g_test_trap_assert_passed();
+ g_test_trap_assert_stdout("");
+ g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n");
+}
+#endif /* CONFIG_HAS_GLIB_SUBPROCESS_TESTS */
+
+int main(int argc, char **argv)
+{
+ g_test_init(&argc, &argv, NULL);
+
+ g_test_add_func("/logging/parse_range", test_parse_range);
+#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS
+ g_test_add_func("/logging/parse_invalid_range/subprocess", test_parse_invalid_range_subprocess);
+ g_test_add_func("/logging/parse_invalid_range", test_parse_invalid_range);
+ g_test_add_func("/logging/parse_zero_range/subprocess", test_parse_zero_range_subprocess);
+ g_test_add_func("/logging/parse_zero_range", test_parse_zero_range);
+ g_test_add_func("/logging/parse_path", test_parse_path);
+ g_test_add_func("/logging/parse_path/subprocess", test_parse_path_subprocess);
+ g_test_add_func("/logging/parse_invalid_path", test_parse_invalid_path);
+ g_test_add_func("/logging/parse_invalid_path/subprocess", test_parse_invalid_path_subprocess);
+#endif
+
+ return g_test_run();
+}
diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c
index 297a02d6a2..008e677388 100644
--- a/tests/test-opts-visitor.c
+++ b/tests/test-opts-visitor.c
@@ -15,6 +15,7 @@
#include "qemu/config-file.h" /* qemu_add_opts() */
#include "qemu/option.h" /* qemu_opts_parse() */
+#include "qapi/error.h"
#include "qapi/opts-visitor.h" /* opts_visitor_new() */
#include "test-qapi-visit.h" /* visit_type_UserDefOptions() */
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index 848374e2bd..32abed5ea1 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "qapi/qmp/qstring.h"
#include "qemu/config-file.h"
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index 6a33aa41e5..d71727e272 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -15,6 +15,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qapi/error.h"
#include "qapi/qmp-input-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
index 5941e90b35..80527eb850 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qmp-input-visitor.c
@@ -14,6 +14,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qapi/error.h"
#include "qapi/qmp-input-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c
index dc35752969..c70926793a 100644
--- a/tests/test-qmp-output-visitor.c
+++ b/tests/test-qmp-output-visitor.c
@@ -14,6 +14,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qapi/error.h"
#include "qapi/qmp-output-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 4b48ec25d3..9e6906a567 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -14,6 +14,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qapi/error.h"
#include "qapi/string-input-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 0beccf98c7..1ecd75b853 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -14,6 +14,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qapi/error.h"
#include "qapi/string-output-visitor.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index 40600b40bb..88dc7316b3 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -4,6 +4,7 @@
#include "block/aio.h"
#include "block/thread-pool.h"
#include "block/block.h"
+#include "qapi/error.h"
#include "qemu/timer.h"
#include "qemu/error-report.h"
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 59675fa57b..744a524368 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -16,6 +16,7 @@
#include <glib.h>
#include <math.h>
#include "block/aio.h"
+#include "qapi/error.h"
#include "qemu/throttle.h"
#include "qemu/error-report.h"
#include "block/throttle-groups.h"
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index ef4dac5e01..9adbc30a41 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -18,6 +18,7 @@
#include "qemu-common.h"
#include "test-qapi-types.h"
#include "test-qapi-visit.h"
+#include "qapi/error.h"
#include "qapi/qmp/types.h"
#include "qapi/qmp-input-visitor.h"
#include "qapi/qmp-output-visitor.h"
diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c
index abd309d418..49f64195a6 100644
--- a/tests/test-xbzrle.c
+++ b/tests/test-xbzrle.c
@@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "include/migration/migration.h"
#define PAGE_SIZE 4096