Am 17.06.2014 10:04, schrieb arei.gong...@huawei.com: > From: Gonglei <arei.gong...@huawei.com> > > For simply add a new subtest in usb-hcd-ehci-test.c, > remove qtest_start and qtest_end to an absolute method > from main function. > > Signed-off-by: Gonglei <arei.gong...@huawei.com> > --- > tests/usb-hcd-ehci-test.c | 38 +++++++++++++++++++++++++------------- > 1 file changed, 25 insertions(+), 13 deletions(-) > > diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c > index bcdf62f..e1427f5 100644 > --- a/tests/usb-hcd-ehci-test.c > +++ b/tests/usb-hcd-ehci-test.c > @@ -154,32 +154,44 @@ static void pci_ehci_port_2(void) > } > } > > +static void pci_qtest_start(void) > +{ > + qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7," > + "multifunction=on,id=ich9-ehci-1 " > + "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0," > + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 " > + "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1," > + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 " > + "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2," > + "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 " > + "-drive if=none,id=usbcdrom,media=cdrom " > + "-device > usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 " > + "-device > usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom "); > + > +} > + > +static void pci_qtest_stop(void) > +{ > + qtest_end(); > +} > + > int main(int argc, char **argv) > { > int ret; > > g_test_init(&argc, &argv, NULL); > + > + /* NB: pci_qtest_start() must match with pci_qtest_stop() */ > + qtest_add_func("/ehci/pci/qtest_start", pci_qtest_start); > qtest_add_func("/ehci/pci/init", pci_init); > qtest_add_func("/ehci/pci/uhci-port-1", pci_uhci_port_1); > qtest_add_func("/ehci/pci/ehci-port-1", pci_ehci_port_1); > qtest_add_func("/ehci/pci/ehci-config", pci_ehci_config); > qtest_add_func("/ehci/pci/uhci-port-2", pci_uhci_port_2); > qtest_add_func("/ehci/pci/ehci-port-2", pci_ehci_port_2); > + qtest_add_func("/ehci/pci/qtest_stop", pci_qtest_stop);
This is wrong, see https://developer.gnome.org/glib/stable/glib-Testing.html#g-test-run Look for g_test_add() and similar functions that allow to specify proper setup and teardown functions with ordering guarantees. Do note that when using g_test_* functions directly, the QEMU architecture needs to be prepended to the path manually. Regards, Andreas > > - qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7," > - "multifunction=on,id=ich9-ehci-1 " > - "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0," > - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 " > - "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1," > - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 " > - "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2," > - "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 " > - "-drive if=none,id=usbcdrom,media=cdrom " > - "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 " > - "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom > "); > ret = g_test_run(); > > - qtest_end(); > - > return ret; > } > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg