static void setup_vm_cmd(IVState *s, const char *cmd, bool msix) { uint64_t barsize; const char *arch = qtest_get_arch(); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { s->qs = qtest_pc_boot(cmd); } else if (strcmp(arch, "ppc64") == 0) { s->qs = qtest_spapr_boot(cmd); } else { g_printerr("ivshmem-test tests are only available on x86 or ppc64\n"); exit(EXIT_FAILURE); } s->dev = get_device(s->qs->pcibus); s->reg_bar = qpci_iomap(s->dev, 0, &barsize); g_assert_cmpuint(barsize, ==, 256); if (msix) { qpci_msix_enable(s->dev); } s->mem_bar = qpci_iomap(s->dev, 2, &barsize); g_assert_cmpuint(barsize, ==, TMPSHMSIZE); qpci_device_enable(s->dev); }
int main(int argc, char **argv) { const char *arch = qtest_get_arch(); const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0" " -drive id=drive0,if=none,file=/dev/null,format=raw" " -device usb-tablet,bus=uhci.0,port=1"; int ret; g_test_init(&argc, &argv, NULL); qtest_add_func("/uhci/pci/init", test_uhci_init); qtest_add_func("/uhci/pci/port1", test_port_1); qtest_add_func("/uhci/pci/hotplug", test_uhci_hotplug); qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { qs = qtest_pc_boot(cmd); } else if (strcmp(arch, "ppc64") == 0) { qs = qtest_spapr_boot(cmd); } else { g_printerr("usb-hcd-uhci-test tests are only " "available on x86 or ppc64\n"); exit(EXIT_FAILURE); } ret = g_test_run(); qtest_shutdown(qs); return ret; }
static QOSState *qvirtio_9p_start(void) { const char *arch = qtest_get_arch(); const char *cmd = "-fsdev local,id=fsdev0,security_model=none,path=%s " "-device virtio-9p-pci,fsdev=fsdev0,mount_tag=%s"; test_share = g_strdup("/tmp/qtest.XXXXXX"); g_assert_nonnull(mkdtemp(test_share)); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { return qtest_pc_boot(cmd, test_share, mount_tag); } if (strcmp(arch, "ppc64") == 0) { return qtest_spapr_boot(cmd, test_share, mount_tag); } g_printerr("virtio-9p tests are only available on x86 or ppc64\n"); exit(EXIT_FAILURE); }
static QVirtIO9P *qvirtio_9p_start(const char *driver) { const char *arch = qtest_get_arch(); const char *cmd = "-fsdev local,id=fsdev0,security_model=none,path=%s " "-device %s,fsdev=fsdev0,mount_tag=%s"; QVirtIO9P *v9p = g_new0(QVirtIO9P, 1); v9p->test_share = g_strdup("/tmp/qtest.XXXXXX"); g_assert_nonnull(mkdtemp(v9p->test_share)); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { v9p->qs = qtest_pc_boot(cmd, v9p->test_share, driver, mount_tag); } else if (strcmp(arch, "ppc64") == 0) { v9p->qs = qtest_spapr_boot(cmd, v9p->test_share, driver, mount_tag); } else { g_printerr("virtio-9p tests are only available on x86 or ppc64\n"); exit(EXIT_FAILURE); } return v9p; }