From nobody Fri Dec 19 06:31:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571697801; cv=none; d=zoho.com; s=zohoarc; b=iyo+gbByFc/tA5O3Z4IuQWhCDkdUn9qcVrqZCL+hAkHx/SFDKbAfGfmEWPVv6uSPPYqrdUdNC27NntwXGjo59tjBXzBUr9iqx8dPtQP7wjM2iyiFo7UVmekXAX/p/cokaCp1vVjucGasKUckHqTT6x25S2in3RFxcPYFAmeXZmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571697801; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9d/uDGv85dLEv33nEDGWywNGXN8GQJeP0QFNxDLvG8o=; b=l4pmVqHXqRq1C8YkPecFyE/CzzSzDPZBMGt5REvRxMGKUuVgtJn0GH4p+sBYoQcPUrM5n+Iy0WMKNWkloaeltSKYU1/V2ocA8v1EM0qhwu3b0WOFS9yfx3kBDiIVGohfa0zvmQ4+JCsMYARmU41w/nukAK6wpQeeP+zi/Uzia5o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571697801431340.26743301720126; Mon, 21 Oct 2019 15:43:21 -0700 (PDT) Received: from localhost ([::1]:48550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMgOV-0008GV-Ua for importer@patchew.org; Mon, 21 Oct 2019 18:43:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52014) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMgJQ-0001wr-Us for qemu-devel@nongnu.org; Mon, 21 Oct 2019 18:38:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMgJO-00018Q-Sr for qemu-devel@nongnu.org; Mon, 21 Oct 2019 18:38:04 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:35692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMgJM-00016h-Tn for qemu-devel@nongnu.org; Mon, 21 Oct 2019 18:38:02 -0400 Received: by mail-wr1-x42a.google.com with SMTP id l10so15320807wrb.2 for ; Mon, 21 Oct 2019 15:38:00 -0700 (PDT) Received: from 8c859074c0ff.ant.amazon.com.com (bzq-109-65-50-254.red.bezeqint.net. [109.65.50.254]) by smtp.gmail.com with ESMTPSA id q66sm16951271wme.39.2019.10.21.15.37.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Oct 2019 15:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9d/uDGv85dLEv33nEDGWywNGXN8GQJeP0QFNxDLvG8o=; b=kyHt3QJu3Snzhu/9s52UEXkULD6ZWlIbn19KWhov1JGlpBpI9vLH8dxEeB5jbtKsbm Xm3r7j9sJP/E0oi6urTcPSYkjfewqdGVwNHibw4MwYYkjcU7bTpicjhYkSUa4+Os+7kz +BLthlSew+1a4S56Z9okmn7bFCCStJBOs7DCWdrfykALDXV6Q4X1TLv7Ho6HXY9FNNOb 2XbJYnuq0uD/0oSqY5C2ooGFW+knKx7dF5DkEjtcopYS0WqzB1UKKLmrHSVZCFzJaU6u R0sVLR3UViknFAwz1OT3oxUwk/DmyCxXMFGcLNZaejcFspzVEpxQ/OhHoqOUUNQT4SQ4 ttqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9d/uDGv85dLEv33nEDGWywNGXN8GQJeP0QFNxDLvG8o=; b=hTQHwKiDMxJENLZAT/VYn17Vow08RtIhPaeTis9yJ7ZHsOaASxxKfkKQic2McgGTrS S1GQLgBFbgonlGWLf2BqwchLDhcFUqmkOMBUpOl7Rck+P5bHI2RLyOzE4Lze9610NBsf B04qUs0/vWVssV6PHqka/G1tSqzh8A7Es3HDRjjXX23iKCi0qP/MI0o5EsmZHDWTWyNO EFLfWe/W+1ps0TB1JTTMPHKs5AME/dNibyBHQ4vdWZv13kVudVyWfy1pbBg/IuE8J7T2 HgrLjYCWeoxpzQuvVMgtjnrJCaRRQKs06OBHrClxrYigums2P+XqCH9TTpLeTBuYLm2Q KP7g== X-Gm-Message-State: APjAAAUZysDOwMF/rD1gyJ2uKA+prdxbBe3r9rhDD/5bV7cz4iS61K7v ouDIzswUWFyiKu+pc46LNQlvWRrB+ZFhkw== X-Google-Smtp-Source: APXvYqwJLNjlnOGe4dlWGGacczlSrFoGKhJPfqPpP1b5SXDuYw9GnpIwy7S9LN4yXECGGE1knTGuhg== X-Received: by 2002:adf:fe90:: with SMTP id l16mr443970wrr.81.1571697478664; Mon, 21 Oct 2019 15:37:58 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Subject: [PATCH v33 13/13] target/avr: Add tests Date: Tue, 22 Oct 2019 01:37:11 +0300 Message-Id: <20191021223711.66955-14-mrolnik@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20191021223711.66955-1-mrolnik@gmail.com> References: <20191021223711.66955-1-mrolnik@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Michael Rolnik , richard.henderson@linaro.org, dovgaluk@ispras.ru, imammedo@redhat.com, philmd@redhat.com, aleksandar.m.mail@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 1. Avocado test The test is based on https://github.com/seharris/qemu-avr-tests/tree/master/free-rtos/Demo demo which. If working correctly, prints 'ABCDEFGHIJKLMNOPQRSTUVWX' out. it also demostrates that timer and IRQ are working 2. Boot serial test Print out 'T' through serial port Signed-off-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Thomas Huth --- tests/Makefile.include | 2 ++ tests/acceptance/machine_avr6.py | 36 ++++++++++++++++++++++++++++++++ tests/boot-serial-test.c | 10 +++++++++ 3 files changed, 48 insertions(+) create mode 100644 tests/acceptance/machine_avr6.py diff --git a/tests/Makefile.include b/tests/Makefile.include index 3543451ed3..376d7dfea3 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -199,6 +199,8 @@ check-qtest-i386-y +=3D tests/test-x86-cpuid-compat$(EX= ESUF) check-qtest-i386-y +=3D tests/numa-test$(EXESUF) check-qtest-x86_64-y +=3D $(check-qtest-i386-y) =20 +check-qtest-avr-y +=3D tests/boot-serial-test$(EXESUF) + check-qtest-alpha-y +=3D tests/boot-serial-test$(EXESUF) check-qtest-alpha-$(CONFIG_VGA) +=3D tests/display-vga-test$(EXESUF) =20 diff --git a/tests/acceptance/machine_avr6.py b/tests/acceptance/machine_av= r6.py new file mode 100644 index 0000000000..0601080b01 --- /dev/null +++ b/tests/acceptance/machine_avr6.py @@ -0,0 +1,36 @@ +import logging +import time +import distutils.spawn + +from avocado import skipUnless +from avocado_qemu import Test +from avocado.utils import process + +class AVR6Machine(Test): + timeout =3D 5 + + def test_freertos(self): + """ + :avocado: tags=3Darch:avr + :avocado: tags=3Dmachine:sample + """ + """ + https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/De= mo/AVR_ATMega2560_GCC/demo.elf + constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRS= TUVWX' + """ + rom_url =3D 'https://github.com/seharris/qemu-avr-tests' + rom_url +=3D '/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.e= lf' + rom_hash =3D '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4' + rom_path =3D self.fetch_asset(rom_url, asset_hash=3Drom_hash) + + self.vm.set_machine('sample') + self.vm.add_args('-bios', rom_path) + self.vm.add_args('-nographic') + self.vm.launch() + + time.sleep(2) + self.vm.shutdown() + + match =3D 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX' + + self.assertIn(match, self.vm.get_log()) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index d3a54a0ba5..1121ed0db2 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -16,6 +16,15 @@ #include "qemu/osdep.h" #include "libqtest.h" =20 +static const uint8_t bios_avr[] =3D { + 0x88, 0xe0, /* ldi r24, 0x08 */ + 0x80, 0x93, 0xc1, 0x00, /* sts 0x00C1, r24 ; Enable tx */ + 0x86, 0xe0, /* ldi r24, 0x06 */ + 0x80, 0x93, 0xc2, 0x00, /* sts 0x00C2, r24 ; Set the data bits to 8 */ + 0x84, 0xe5, /* ldi r24, 0x54 */ + 0x80, 0x93, 0xc6, 0x00, /* sts 0x00C6, r24 ; Output 'T' */ +}; + static const uint8_t kernel_mcf5208[] =3D { 0x41, 0xf9, 0xfc, 0x06, 0x00, 0x00, /* lea 0xfc060000,%a0 */ 0x10, 0x3c, 0x00, 0x54, /* move.b #'T',%d0 */ @@ -103,6 +112,7 @@ typedef struct testdef { =20 static testdef_t tests[] =3D { { "alpha", "clipper", "", "PCI:" }, + { "avr", "sample", "", "T", sizeof(bios_avr), NULL, bios_avr }, { "ppc", "ppce500", "", "U-Boot" }, { "ppc", "40p", "-vga none -boot d", "Trying cd:," }, { "ppc", "g3beige", "", "PowerPC,750" }, --=20 2.17.2 (Apple Git-113)