From patchwork Thu Apr 19 20:26:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 153863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 049B2B6FF9 for ; Fri, 20 Apr 2012 06:27:45 +1000 (EST) Received: from localhost ([::1]:47510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKxx8-0000Rm-SW for incoming@patchwork.ozlabs.org; Thu, 19 Apr 2012 16:27:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKxwp-0008EF-M3 for qemu-devel@nongnu.org; Thu, 19 Apr 2012 16:27:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKxwn-0000kK-UK for qemu-devel@nongnu.org; Thu, 19 Apr 2012 16:27:23 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:53008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKxwn-0000k1-NB for qemu-devel@nongnu.org; Thu, 19 Apr 2012 16:27:21 -0400 Received: by ghrr14 with SMTP id r14so6167901ghr.4 for ; Thu, 19 Apr 2012 13:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=/i+JTlpCU3AWx99tvEVNVZh/ms6yCGnb6ICj6EH+WHk=; b=o2YxkCdtRAR2N6Kk3y3xa9fhg09N+eFgRvk+a9Q3efR+pBnj5rj0bExfmOhFVssYbd Mu35UZvqVYIgjbvVtropeIL9Sbu5MCJ79/yZrUDzzZA/gEjXY3VJZ/A+ZZD49aOkbLzQ i4/C1suRHXBloTx0bI4CN5MwGptrXXNjdjqEbwW58BnArX1LPig/XP2O5XnievRYRaP0 yPv6YDsVXeCOvO/nOs20BczoXxfq2SIo89+oymY16MD3P63lJHf1zU34YrO4uYb4Nil7 n5CmA7+VoLOfI7ZasC3STvOD+YYXs7sH+okRo2kbvISRgywpbx3m9VruKwfx+3mZOBga 3TbQ== Received: by 10.50.222.202 with SMTP id qo10mr18747757igc.0.1334867238812; Thu, 19 Apr 2012 13:27:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.197.194 with HTTP; Thu, 19 Apr 2012 13:26:58 -0700 (PDT) From: Blue Swirl Date: Thu, 19 Apr 2012 20:26:58 +0000 Message-ID: To: Anthony Liguori , Paolo Bonzini , qemu-devel X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.173 Subject: [Qemu-devel] [PATCH 1/4] qtest: add register fuzzing to RTC test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Anthony Liguori Signed-off-by: Blue Swirl --- tests/rtc-test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) From 85215d419b17aeedbfe93ff8d739b27937f72739 Mon Sep 17 00:00:00 2001 Message-Id: <85215d419b17aeedbfe93ff8d739b27937f72739.1334866660.git.blauwirbel@gmail.com> From: Blue Swirl Date: Sun, 15 Apr 2012 07:36:49 +0000 Subject: [PATCH 1/4] qtest: add register fuzzing to RTC test Reviewed-by: Anthony Liguori Signed-off-by: Blue Swirl --- tests/rtc-test.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 983a980..f23ac3a 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -240,6 +240,22 @@ static void alarm_time(void) g_assert(cmos_read(RTC_REG_C) == 0); } +/* success if no crash or abort */ +static void fuzz_registers(void) +{ + unsigned int i; + + for (i = 0; i < 1000; i++) { + uint8_t reg, val; + + reg = (uint8_t)g_test_rand_int_range(0, 16); + val = (uint8_t)g_test_rand_int_range(0, 256); + + cmos_write(reg, val); + cmos_read(reg); + } +} + int main(int argc, char **argv) { QTestState *s = NULL; @@ -253,6 +269,7 @@ int main(int argc, char **argv) qtest_add_func("/rtc/bcd/check-time", bcd_check_time); qtest_add_func("/rtc/dec/check-time", dec_check_time); qtest_add_func("/rtc/alarm-time", alarm_time); + qtest_add_func("/rtc/fuzz-registers", fuzz_registers); ret = g_test_run(); if (s) { -- 1.7.2.5