From nobody Tue May 21 04:14:44 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1563950785; cv=none; d=zoho.com; s=zohoarc; b=GKHSlDzW/zeS5tKpiDFX4Y4VRQ/2WjPj5vC7p95n94nibszDYn41nJwQ4F92lwQdVnycAuWg2kP56/DQN7qrFKel7PO+xzrSQYE1Jkns7ChT3dEuGqFLlSV9SQjwcM5QUZav/lztWxw/T9y/qHZNuWWfBcgQpLUJ1QgcbAjtBiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563950785; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=mQHYqjl7zwiKo7RpLdyEPwUd7jBGOinHVQZgIaKHPfc=; b=X+pEyvag77o8aa5QvPETO+43ZOeulOHmTQ5cOAh48YThiCaiBtcZ/Bu7bV3GcVfXmGL+AfAiNUM4l4DEYd9F6nPvH6Oz5yhhnCbHWGD5Mmnf9UbwGEb9biuykABKDDlTDBTA03FO/+dndKYy3O4yA7L2/GYU3Gy6SJUjS0h2tNc= 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 Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563950785696157.82841441291316; Tue, 23 Jul 2019 23:46:25 -0700 (PDT) Received: from localhost ([::1]:48924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqB2W-0004uq-9F for importer@patchew.org; Wed, 24 Jul 2019 02:46:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60839) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqB2H-0004Sa-VE for qemu-devel@nongnu.org; Wed, 24 Jul 2019 02:46:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqB2G-0006By-M4 for qemu-devel@nongnu.org; Wed, 24 Jul 2019 02:46:01 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:34904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hqB2G-0006BJ-Dj for qemu-devel@nongnu.org; Wed, 24 Jul 2019 02:46:00 -0400 Received: by mail-pg1-x533.google.com with SMTP id s1so14384875pgr.2 for ; Tue, 23 Jul 2019 23:45:59 -0700 (PDT) Received: from gamma06.internal.sifive.com ([64.62.193.194]) by smtp.gmail.com with ESMTPSA id f6sm47012449pga.50.2019.07.23.23.45.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jul 2019 23:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id; bh=mQHYqjl7zwiKo7RpLdyEPwUd7jBGOinHVQZgIaKHPfc=; b=EU1yyHcR5in3AvCrtLXBP7w6O64LWByXenVYpe1x121krfg2ZDSdMDzIDWWGnLAGtn XI/dFEQcMnDSCa5vODuc/46L1AJCdXI34sdvIWrqKsS3VABXf4KlVwISE5irpkQpHnor ZXA9aUR77BJNgE3ZxN1zjTlIiSgeqD2KBknskGqVC6jMukSWnY3unV69JV/IJ+Iib8MI xpAN4vIIwv5oqDm8nf4sL2FSSpG0U7oyOy9IpoMppPuHH+SvGaF4MEUAOgaBpFAesejb 8XQLjFTtIOf4GmDmj7iKMajXQDYc71CI7kOwcg5I8SrINb0ULF+bOoKW4GQ4Jgq1qo8/ Rpiw== 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; bh=mQHYqjl7zwiKo7RpLdyEPwUd7jBGOinHVQZgIaKHPfc=; b=mg3LeSSJ+RnMSDt/RSUl0UbfGtFnUnkxKQivGUfzsqmzAhJF+x7cbsu8vRgN5TooUf 6DGWGMrzSqNElGiexrf/6Vo6uk8hfY/EQIUx9iqt+rKE9US1gYpX/DaTQPDC5OIasHAd 0skgwWTkexIkSLXraTuc/Tk2cj+cXLWw5sU67BhIxREf6WBd3pc07HfD5+ceIDUt5dDM IZdWCTLe7eKZH+v+m/1nY14qDNuy9s3UvfkaaY85S09HYgVMf0Sjh4hQekrXfKyErqEP c1yJeGkLbp63FyT9CLntjrxn+VrYr9IaTbwXaFl7LEgwWuVoD8An5fIh2NQTVTBw4iaN JFIQ== X-Gm-Message-State: APjAAAWATE0dwGe353ivo7utO3evOk30ysNbLQptV4+XUZwMcus0u7VS 0d+QXVBdTfE+/CG3Hf0E6zDYEF9+Nb4= X-Google-Smtp-Source: APXvYqyTreHgev5fWt6Qa4+cwtVd1P9HGzKX8PoyRjV26G8pifoHznknjvDb3SDih/6U42Gobcw1ew== X-Received: by 2002:a17:90a:1ae1:: with SMTP id p88mr82664440pjp.26.1563950758640; Tue, 23 Jul 2019 23:45:58 -0700 (PDT) From: Chih-Min Chao To: qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Tue, 23 Jul 2019 23:45:34 -0700 Message-Id: <1563950742-22592-1-git-send-email-chihmin.chao@sifive.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::533 Subject: [Qemu-devel] [PATCH v3] tests/boot_linux_console: add a test for riscv64 + virt 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: Fam Zheng , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cornelia Huck , Chih-Min Chao , Cleber Rosa , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Similar to the mips + malta test, it boots a Linux kernel on a virt board and verify the serial is working. Also, it relies on the serial device set by the machine itself. If riscv64 is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:riscv64" tags. Alternatively, this test can be run using: $ avocado run -t arch:riscv64 tests/acceptance packages debian official binutils-riscv64-linux-gnu_2.32-8 opensbi_0.4-1_all linux-image-5.0.0-trunk-riscv64 5.0.2-1~exp1 third-party https://github.com/groeck/linux-build-test/rootfs/riscv64/rootfs.cpio.gz (the repo is also used in mips target acceptance) Signed-off-by: Chih-Min Chao --- .travis.yml | 2 +- tests/acceptance/boot_linux_console.py | 67 ++++++++++++++++++++++++++++++= ++++ 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index caf0a1f..7ba9952 100644 --- a/.travis.yml +++ b/.travis.yml @@ -232,7 +232,7 @@ matrix: =20 # Acceptance (Functional) tests - env: - - CONFIG=3D"--python=3D/usr/bin/python3 --target-list=3Dx86_64-sof= tmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmm= u,alpha-softmmu" + - CONFIG=3D"--python=3D/usr/bin/python3 --target-list=3Dx86_64-sof= tmmu,mips-softmmu,mips64el-softmmu,aarch64-softmmu,arm-softmmu,s390x-softmm= u,alpha-softmmu,riscv64-softmmu" - TEST_CMD=3D"make check-acceptance" after_failure: - cat tests/results/latest/job.log diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 3215950..b0569b9 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -354,3 +354,70 @@ class BootLinuxConsole(Test): self.vm.launch() console_pattern =3D 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + + def test_riscv64_virt(self): + """ + :avocado: tags=3Darch:riscv64 + :avocado: tags=3Dmachine:virt + """ + deb_url =3D ('https://snapshot.debian.org/archive/debian/' + '20190424T171759Z/pool/main/b/binutils/' + 'binutils-riscv64-linux-gnu_2.32-8_amd64.deb') + deb_hash =3D ('7fe376fd4452696c03acd508d6d613ca553ea15e') + deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) + objcopy_path =3D '/usr/bin/riscv64-linux-gnu-objcopy' + objcopy_path =3D self.extract_from_deb(deb_path, objcopy_path) + libbfd_path =3D '/usr/lib/x86_64-linux-gnu/libbfd-2.32-riscv64.so' + libbfd_path =3D self.extract_from_deb(deb_path, libbfd_path) + process.run('ls -al %s' % (objcopy_path)) + + deb_url =3D ('https://snapshot.debian.org/archive/debian/' + '20190708T032337Z/pool/main/o/opensbi/' + 'opensbi_0.4-1_all.deb') + deb_hash =3D ('2319dcd702958291d323acf5649fd98a11d90112') + deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) + opensbi_path =3D ('/usr/lib/riscv64-linux-gnu/opensbi/' + 'qemu/virt/fw_jump.elf') + opensbi_path =3D self.extract_from_deb(deb_path, opensbi_path) + + deb_url =3D ('https://snapshot.debian.org/archive/debian-ports/' + '20190319T205124Z/pool-riscv64/main/l/linux/' + 'linux-image-5.0.0-trunk-riscv64_5.0.2-1~exp1_riscv64.d= eb') + deb_hash =3D ('90155ed4b36673cbf7746a37cf3159c8f0b2857a') + deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) + kernel_path =3D '/boot/vmlinux-5.0.0-trunk-riscv64' + kernel_path =3D self.extract_from_deb(deb_path, kernel_path) + kimage_path =3D self.workdir + "/Image" + env =3D os.environ + env['LD_LIBRARY_PATH'] =3D ('%s:' % (os.path.dirname(libbfd_path))= + + env.get('LD_LIBRARY_PATH', '')) + process.run(('%s -O binary -O binary -R' + '.note -R .note.gnu.build-id -R .comment -S %s %s') % + (objcopy_path, kernel_path, kimage_path)) + + initrd_url =3D ('https://github.com/groeck/linux-build-test/raw/' + '8584a59ed9e5eb5ee7ca91f6d74bbb06619205b8/rootfs/' + 'riscv64/rootfs.cpio.gz') + initrd_hash =3D 'f4867d263754961b6f626cdcdc0cb334c47e3b49' + initrd_path =3D self.fetch_asset(initrd_url, asset_hash=3Dinitrd_h= ash) + + self.vm.set_machine('virt') + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0 noreboot') + self.vm.add_args('-bios', "none", + '-kernel', opensbi_path, + '-device', 'loader,file=3D%s,addr=3D0x80200000' % (kimage_= path), + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + self.exec_command_and_wait_for_pattern('cat /proc/cpuinfo', + 'isa') + self.exec_command_and_wait_for_pattern('uname -a', + 'SMP Debian') + self.exec_command_and_wait_for_pattern('reboot', + 'reboot: Restarting system') --=20 2.7.4