* Fix global variable shadowing in test code

* Avoid recompiling libfdt in the FreeBSD VM
 * Mark old pc machine types as deprecated
 * Force IPv4 in the ipmi-bt-test
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmU7g+wRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbWzIQ//WkiEtXAB4zn/b8H0KfRF283FoFMstBPu
 xrF90WcXMidAPRK8iFhwlae0rVyo40V6A3+/0rntMZ6WPJ3pVvFhmM4zIQgX+1+F
 HT8To7ngngeEey5gJNbOs9GdAFSmF8HwB+HWnEGf2fjWsUvIWgm458ikPUWvhXaJ
 08wH4V+bmEAKYgny8/ys70E1iFeMwfg+LKXHzVAavaQ8GjM9xFXOjRe8XEq2P7/8
 T99O+hn1iGJfrvZTdJ01awRuOUzA1YTKLCYNSzfRc/j0eYwI28CBm12/sZn4dUA8
 4rV33ISPw55QmxdVLCfGhAJ6Ih0trOgf8eDBkhcgqWt26ymcKyVL/7kJHcuoY9Q2
 onaN3XT39lVz/HmcuTl9a0sePsZd4d7p0vRsccwTSisX8RpLDab8I8oU8Nvs3VQG
 t23K3XLrdSyMbxsbi9b5BdXJVgkz4irEKG1dX8laIGMGD5zVi/LX2BWjP6QaIOZi
 OyopRQN2uTi6cry5NmblpeLDNJwQdQVxJKlqcvDQQl8TjPXleNtIXL4dr+IpNC5T
 Uo8GJ6+b+AzUI4EaNFybVDPAYHFMJKxvN/QUEjExKV1QTP3V2V9jCbGCF8nio8pp
 ISo11Lo/Z4Z39NwDBH13UuSOdD1rlrU2uuq6LaiRTBfCOTYumzUMvlDTNYqGuSLr
 +1q1GTGsHO0=
 =A6CT
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2023-10-27' of https://gitlab.com/thuth/qemu into staging

* Fix global variable shadowing in test code
* Avoid recompiling libfdt in the FreeBSD VM
* Mark old pc machine types as deprecated
* Force IPv4 in the ipmi-bt-test

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmU7g+wRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbWzIQ//WkiEtXAB4zn/b8H0KfRF283FoFMstBPu
# xrF90WcXMidAPRK8iFhwlae0rVyo40V6A3+/0rntMZ6WPJ3pVvFhmM4zIQgX+1+F
# HT8To7ngngeEey5gJNbOs9GdAFSmF8HwB+HWnEGf2fjWsUvIWgm458ikPUWvhXaJ
# 08wH4V+bmEAKYgny8/ys70E1iFeMwfg+LKXHzVAavaQ8GjM9xFXOjRe8XEq2P7/8
# T99O+hn1iGJfrvZTdJ01awRuOUzA1YTKLCYNSzfRc/j0eYwI28CBm12/sZn4dUA8
# 4rV33ISPw55QmxdVLCfGhAJ6Ih0trOgf8eDBkhcgqWt26ymcKyVL/7kJHcuoY9Q2
# onaN3XT39lVz/HmcuTl9a0sePsZd4d7p0vRsccwTSisX8RpLDab8I8oU8Nvs3VQG
# t23K3XLrdSyMbxsbi9b5BdXJVgkz4irEKG1dX8laIGMGD5zVi/LX2BWjP6QaIOZi
# OyopRQN2uTi6cry5NmblpeLDNJwQdQVxJKlqcvDQQl8TjPXleNtIXL4dr+IpNC5T
# Uo8GJ6+b+AzUI4EaNFybVDPAYHFMJKxvN/QUEjExKV1QTP3V2V9jCbGCF8nio8pp
# ISo11Lo/Z4Z39NwDBH13UuSOdD1rlrU2uuq6LaiRTBfCOTYumzUMvlDTNYqGuSLr
# +1q1GTGsHO0=
# =A6CT
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 27 Oct 2023 18:33:32 JST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2023-10-27' of https://gitlab.com/thuth/qemu:
  ipmi-bt-test: force ipv4
  tests/vm/freebsd: Add additional library paths for libfdt
  docs/about: Mark the old pc-i440fx-2.0 - 2.3 machine types as deprecated
  tests/coroutine: Clean up global variable shadowing
  tests/aio: Clean up global variable shadowing
  tests/npcm7xx_adc: Clean up global variable shadowing
  tests/rtl8139: Clean up global variable shadowing
  tests/cdrom-test: Clean up global variable shadowing in prepare_image()
  tests/virtio-scsi: Clean up global variable shadowing
  tests/throttle: Clean up global variable shadowing
  system/qtest: Clean up global variable shadowing in qtest_server_init()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2023-10-30 08:08:18 +09:00
commit f09cc2b50c
12 changed files with 46 additions and 37 deletions

View File

@ -247,6 +247,14 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
better reflects the way this property affects all random data within
the device tree blob, not just the ``kaslr-seed`` node.
``pc-i440fx-2.0`` up to ``pc-i440fx-2.3`` (since 8.2)
'''''''''''''''''''''''''''''''''''''''''''''''''''''
These old machine types are quite neglected nowadays and thus might have
various pitfalls with regards to live migration. Use a newer machine type
instead.
Backend options
---------------

View File

@ -849,6 +849,7 @@ static void pc_i440fx_2_3_machine_options(MachineClass *m)
{
pc_i440fx_2_4_machine_options(m);
m->hw_version = "2.3.0";
m->deprecation_reason = "old and unattended - use a newer version instead";
compat_props_add(m->compat_props, hw_compat_2_3, hw_compat_2_3_len);
compat_props_add(m->compat_props, pc_compat_2_3, pc_compat_2_3_len);
}

View File

@ -866,7 +866,7 @@ void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error **
{
ERRP_GUARD();
Chardev *chr;
Object *qtest;
Object *qobj;
chr = qemu_chr_new("qtest", qtest_chrdev, NULL);
if (chr == NULL) {
@ -875,18 +875,18 @@ void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error **
return;
}
qtest = object_new(TYPE_QTEST);
object_property_set_str(qtest, "chardev", chr->label, &error_abort);
qobj = object_new(TYPE_QTEST);
object_property_set_str(qobj, "chardev", chr->label, &error_abort);
if (qtest_log) {
object_property_set_str(qtest, "log", qtest_log, &error_abort);
object_property_set_str(qobj, "log", qtest_log, &error_abort);
}
object_property_add_child(qdev_get_machine(), "qtest", qtest);
user_creatable_complete(USER_CREATABLE(qtest), errp);
object_property_add_child(qdev_get_machine(), "qtest", qobj);
user_creatable_complete(USER_CREATABLE(qobj), errp);
if (*errp) {
object_unparent(qtest);
object_unparent(qobj);
}
object_unref(OBJECT(chr));
object_unref(qtest);
object_unref(qobj);
}
static bool qtest_server_start(QTest *q, Error **errp)

View File

@ -37,17 +37,17 @@ static int exec_xorrisofs(const char **args)
return exit_status;
}
static int prepare_image(const char *arch, char *isoimage)
static int prepare_image(const char *arch, char *isoimagepath)
{
char srcdir[] = "cdrom-test-dir-XXXXXX";
char *codefile = NULL;
int ifh, ret = -1;
const char *args[] = {
"xorrisofs", "-quiet", "-l", "-no-emul-boot",
"-b", NULL, "-o", isoimage, srcdir, NULL
"-b", NULL, "-o", isoimagepath, srcdir, NULL
};
ifh = mkstemp(isoimage);
ifh = mkstemp(isoimagepath);
if (ifh < 0) {
perror("Error creating temporary iso image file");
return -1;

View File

@ -411,7 +411,7 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
global_qtest = qtest_initf(
" -chardev socket,id=ipmi0,host=localhost,port=%d,reconnect=10"
" -chardev socket,id=ipmi0,host=127.0.0.1,port=%d,reconnect=10"
" -device ipmi-bmc-extern,chardev=ipmi0,id=bmc0"
" -device isa-ipmi-bt,bmc=bmc0", emu_port);
qtest_irq_intercept_in(global_qtest, "ioapic");

View File

@ -90,7 +90,7 @@ typedef struct ADC {
uint64_t base_addr;
} ADC;
ADC adc = {
ADC adc_defs = {
.irq = 0,
.base_addr = 0xf000c000
};
@ -367,12 +367,12 @@ int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
add_test(init, &adc);
add_test(convert_internal, &adc);
add_test(convert_external, &adc);
add_test(interrupt, &adc);
add_test(reset, &adc);
add_test(calibrate, &adc);
add_test(init, &adc_defs);
add_test(convert_internal, &adc_defs);
add_test(convert_external, &adc_defs);
add_test(interrupt, &adc_defs);
add_test(reset, &adc_defs);
add_test(calibrate, &adc_defs);
return g_test_run();
}

View File

@ -22,7 +22,7 @@ static void nop(void)
#define CLK 33333333
static QPCIBus *pcibus;
static QPCIDevice *dev;
static QPCIDevice *pcidev;
static QPCIBar dev_bar;
static void save_fn(QPCIDevice *dev, int devfn, void *data)
@ -46,7 +46,7 @@ static QPCIDevice *get_device(void)
#define PORT(name, len, val) \
static unsigned __attribute__((unused)) in_##name(void) \
{ \
unsigned res = qpci_io_read##len(dev, dev_bar, (val)); \
unsigned res = qpci_io_read##len(pcidev, dev_bar, (val)); \
if (verbosity_level >= 2) { \
g_test_message("*%s -> %x", #name, res); \
} \
@ -57,7 +57,7 @@ static void out_##name(unsigned v) \
if (verbosity_level >= 2) { \
g_test_message("%x -> *%s", v, #name); \
} \
qpci_io_write##len(dev, dev_bar, (val), v); \
qpci_io_write##len(pcidev, dev_bar, (val), v); \
}
PORT(Timer, l, 0x48)
@ -189,11 +189,11 @@ static void test_init(void)
{
uint64_t barsize;
dev = get_device();
pcidev = get_device();
dev_bar = qpci_iomap(dev, 0, &barsize);
dev_bar = qpci_iomap(pcidev, 0, &barsize);
qpci_device_enable(dev);
qpci_device_enable(pcidev);
test_timer();
}

View File

@ -156,7 +156,7 @@ static QVirtioSCSIQueues *qvirtio_scsi_init(QVirtioDevice *dev)
return vs;
}
static void hotplug(void *obj, void *data, QGuestAllocator *alloc)
static void hotplug(void *obj, void *data, QGuestAllocator *t_alloc)
{
QTestState *qts = global_qtest;

View File

@ -127,10 +127,10 @@ static void *test_acquire_thread(void *opaque)
return NULL;
}
static void set_event_notifier(AioContext *ctx, EventNotifier *notifier,
static void set_event_notifier(AioContext *nctx, EventNotifier *notifier,
EventNotifierHandler *handler)
{
aio_set_event_notifier(ctx, notifier, handler, NULL, NULL);
aio_set_event_notifier(nctx, notifier, handler, NULL, NULL);
}
static void dummy_notifier_read(EventNotifier *n)

View File

@ -195,7 +195,7 @@ static void test_no_dangling_access(void)
}
static bool locked;
static int done;
static int done_count;
static void coroutine_fn mutex_fn(void *opaque)
{
@ -206,7 +206,7 @@ static void coroutine_fn mutex_fn(void *opaque)
qemu_coroutine_yield();
locked = false;
qemu_co_mutex_unlock(m);
done++;
done_count++;
}
static void coroutine_fn lockable_fn(void *opaque)
@ -218,7 +218,7 @@ static void coroutine_fn lockable_fn(void *opaque)
qemu_coroutine_yield();
locked = false;
qemu_lockable_unlock(x);
done++;
done_count++;
}
static void do_test_co_mutex(CoroutineEntry *entry, void *opaque)
@ -226,7 +226,7 @@ static void do_test_co_mutex(CoroutineEntry *entry, void *opaque)
Coroutine *c1 = qemu_coroutine_create(entry, opaque);
Coroutine *c2 = qemu_coroutine_create(entry, opaque);
done = 0;
done_count = 0;
qemu_coroutine_enter(c1);
g_assert(locked);
qemu_coroutine_enter(c2);
@ -235,11 +235,11 @@ static void do_test_co_mutex(CoroutineEntry *entry, void *opaque)
* terminates.
*/
qemu_coroutine_enter(c1);
g_assert_cmpint(done, ==, 1);
g_assert_cmpint(done_count, ==, 1);
g_assert(locked);
qemu_coroutine_enter(c2);
g_assert_cmpint(done, ==, 2);
g_assert_cmpint(done_count, ==, 2);
g_assert(!locked);
}

View File

@ -618,7 +618,6 @@ static bool do_test_accounting(bool is_ops, /* are we testing bps or ops */
{ THROTTLE_OPS_TOTAL,
THROTTLE_OPS_READ,
THROTTLE_OPS_WRITE, } };
ThrottleConfig cfg;
BucketType index;
int i;

View File

@ -38,8 +38,9 @@ class FreeBSDVM(basevm.BaseVM):
cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
mkdir src build; cd src;
tar -xf /dev/vtbd1;
cd ../build
../src/configure --python=python3.9 {configure_opts};
cd ../build;
../src/configure --python=python3.9 --extra-ldflags=-L/usr/local/lib \
--extra-cflags=-I/usr/local/include {configure_opts};
gmake --output-sync -j{jobs} {target} {verbose};
"""