From patchwork Tue Oct 29 21:24:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Rolnik X-Patchwork-Id: 11218641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FAB114DB for ; Tue, 29 Oct 2019 21:44:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34F4320717 for ; Tue, 29 Oct 2019 21:44:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HSQYkoeb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34F4320717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:34074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPZHy-0006UL-9e for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 Oct 2019 17:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36803) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iPYzz-0002Ln-Oz for qemu-devel@nongnu.org; Tue, 29 Oct 2019 17:25:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iPYzx-0008VK-IQ for qemu-devel@nongnu.org; Tue, 29 Oct 2019 17:25:55 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:41795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iPYzv-0008Ro-Fa for qemu-devel@nongnu.org; Tue, 29 Oct 2019 17:25:53 -0400 Received: by mail-wr1-x431.google.com with SMTP id p4so15236849wrm.8 for ; Tue, 29 Oct 2019 14:25:50 -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=iKfEk+z+TXN2xvp7jmgdiUZVCFR1Of+sYzS2Fb4La04=; b=HSQYkoebLry9gFjZG1tGHZLzc19fxpf68LfGqWys1bC7uiVoRJmeZql8aA7FgDLu8V 79kSvgoLJHlgzXIc18dLNclWyYteUqZhuCDeQZVgVpPuAS4PbRsRlPvd2AER8uscViZJ 5/Gmk4CecbmTP3W1+7ZW1S+Au9WZA3FTbwmr+L+ay6He3FqRAT0Z401XKmfXN++0qUeK LbFDuUhSxMWyNi99Ry2Cg+LSiH2VaWitwkBJSkhVVA7NmLVTYtdeTXCl+UPi4GGphOQi aWz2XAZYcTk+AxsDPj03ize9H0YC+z6QUXWte18unZeDxBxRnd0iGoTH1+UiSveN5amg bb5Q== 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=iKfEk+z+TXN2xvp7jmgdiUZVCFR1Of+sYzS2Fb4La04=; b=tR2G6+dNmhDWNdM/J9iPNN8Ui9ArpV0Pxset8c4JVmCMq6Y/vSK3evj0XNlJJeosdI l5gyTySrNu8ddnmEOiyl+E3vUuoqFrfAQea2FzFHfYyXkUiNyZwCgUbeqrrmZUXs/F9l xjRptYz9WT87u7an+IT4QsexPVH7JPeGW2l+u4ug/tDK4e4ycE3Gprld5scawnFJ1V4J vvhNUU0D8ZrE32QLxAQ74xH2Dice0nWo9pRnWTg7zhuiQ7hhdJ7zTAUC6fNyvpcxu4vH qaX6tnLtJ4Kh6noTiuB2pYJ9yEofH/gBhVJY2mnljVpJLOuQiW68UHIldmJsRjU3JBQn 8gkw== X-Gm-Message-State: APjAAAVu4zC2dlZsLoP+nHFbAj3XHIlLvK6Vg7nkwDwBXyNhyyFS5Dx3 pjYeCBL74E+tMNb/fl+1zhK66x6LlhMDxA== X-Google-Smtp-Source: APXvYqz64Je3TRfa5x0+86t+xoNK1QIi3SRLorUzmUjlLPE39u9uqSUHW4MZHhXMwTcYPx78CSHQfg== X-Received: by 2002:adf:9f08:: with SMTP id l8mr20784081wrf.325.1572384349470; Tue, 29 Oct 2019 14:25:49 -0700 (PDT) Received: from 8c859074c0ff.ant.amazon.com.com (bzq-79-178-97-184.red.bezeqint.net. [79.178.97.184]) by smtp.gmail.com with ESMTPSA id 200sm4924730wme.32.2019.10.29.14.25.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Oct 2019 14:25:49 -0700 (PDT) From: Michael Rolnik To: qemu-devel@nongnu.org Subject: [PATCH v35 13/13] target/avr: Add tests Date: Tue, 29 Oct 2019 23:24:30 +0200 Message-Id: <20191029212430.20617-14-mrolnik@gmail.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20191029212430.20617-1-mrolnik@gmail.com> References: <20191029212430.20617-1-mrolnik@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Tested-by: Philippe Mathieu-Daudé Acked-by: Thomas Huth Acked-by: Aleksandar Markovic --- 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 7f487f65e7..3c077f6ca4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -206,6 +206,8 @@ check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF) check-qtest-i386-y += tests/numa-test$(EXESUF) check-qtest-x86_64-y += $(check-qtest-i386-y) +check-qtest-avr-y += tests/boot-serial-test$(EXESUF) + check-qtest-alpha-y += tests/boot-serial-test$(EXESUF) check-qtest-alpha-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF) diff --git a/tests/acceptance/machine_avr6.py b/tests/acceptance/machine_avr6.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 = 5 + + def test_freertos(self): + """ + :avocado: tags=arch:avr + :avocado: tags=machine:sample + """ + """ + https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf + constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX' + """ + rom_url = 'https://github.com/seharris/qemu-avr-tests' + rom_url += '/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf' + rom_hash = '7eb521f511ca8f2622e0a3c5e8dd686efbb911d4' + rom_path = self.fetch_asset(rom_url, asset_hash=rom_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 = '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" +static const uint8_t bios_avr[] = { + 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[] = { 0x41, 0xf9, 0xfc, 0x06, 0x00, 0x00, /* lea 0xfc060000,%a0 */ 0x10, 0x3c, 0x00, 0x54, /* move.b #'T',%d0 */ @@ -103,6 +112,7 @@ typedef struct testdef { static testdef_t tests[] = { { "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" },