From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWWss-00061S-P8 for qemu-devel@nongnu.org; Fri, 02 Dec 2011 12:26:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWWsr-0004LO-Sq for qemu-devel@nongnu.org; Fri, 02 Dec 2011 12:26:50 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:34741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWWsr-0004LB-Ot for qemu-devel@nongnu.org; Fri, 02 Dec 2011 12:26:49 -0500 Received: by ghbz10 with SMTP id z10so136246ghb.4 for ; Fri, 02 Dec 2011 09:26:49 -0800 (PST) Message-ID: <4ED90A55.4010405@codemonkey.ws> Date: Fri, 02 Dec 2011 11:26:45 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1322765012-3164-1-git-send-email-aliguori@us.ibm.com> <1322765012-3164-7-git-send-email-aliguori@us.ibm.com> <4ED90A02.8080901@redhat.com> In-Reply-To: <4ED90A02.8080901@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v2 6/6] Add C version of rtc-test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, Luiz Capitulino On 12/02/2011 11:25 AM, Kevin Wolf wrote: > Am 01.12.2011 19:43, schrieb Anthony Liguori: >> --- >> Makefile | 4 + >> rtc-test.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 205 insertions(+), 0 deletions(-) >> create mode 100644 rtc-test.c >> >> diff --git a/Makefile b/Makefile >> index 301c75e..838cb01 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -215,6 +215,10 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) $(GENERATED_HEADERS) >> >> qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ) >> >> +libqtest.o: libqtest.c > > Did you forget to commit libqtest.c? Probably, sorry about that. > I think your series is a good start, but the examples only use port I/O. > Most other tests would probably need to access RAM (not sure if it's > convenient to do explicit read/write commands for that), interrupts and > some even QMP. libqtest.h has: bool qtest_get_irq(QTestState *s, int num); void qtest_outb(QTestState *s, uint16_t addr, uint8_t value); void qtest_outw(QTestState *s, uint16_t addr, uint16_t value); void qtest_outl(QTestState *s, uint16_t addr, uint32_t value); uint8_t qtest_inb(QTestState *s, uint16_t addr); uint16_t qtest_inw(QTestState *s, uint16_t addr); uint32_t qtest_inl(QTestState *s, uint16_t addr); void qtest_memread(QTestState *s, uint64_t addr, void *data, size_t size); void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size); So that's how you read/write memory. Likewise, for IRQs, you can poll the status of a given IRQ. I thought about doing some sort of signal magic around but when writing tests, polling the IRQ seems easier to deal with. > Should the framework and the tests live in the tests/ directory? Probably, except that tests/ has it's own Makefile which is sort of awkward. Any objections to moving tests/* to tests/tcg-test and then moving all of the various gtest/check tests to tests/ along with qtest? Regards, Anthony Liguori > Kevin >