From patchwork Mon Apr 29 16:32:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jugurtha BELKALEM X-Patchwork-Id: 1092682 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="yudNZwkQ"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44t9Dy11pzz9sMM for ; Tue, 30 Apr 2019 02:32:50 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 63D062154C; Mon, 29 Apr 2019 16:32:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vol5ikn06Hag; Mon, 29 Apr 2019 16:32:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id A47A622782; Mon, 29 Apr 2019 16:32:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 917321BF964 for ; Mon, 29 Apr 2019 16:32:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8E7CD85734 for ; Mon, 29 Apr 2019 16:32:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NHkp0XdR-vxy for ; Mon, 29 Apr 2019 16:32:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by hemlock.osuosl.org (Postfix) with ESMTPS id 93364848AF for ; Mon, 29 Apr 2019 16:32:39 +0000 (UTC) Received: by mail-wm1-f49.google.com with SMTP id 4so71380wmf.1 for ; Mon, 29 Apr 2019 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+KvRWjTlKYLawZukynf92KHFK6vJ9cQSFUiOdcC+E8s=; b=yudNZwkQF3igfsWBgrvjlVbwMbZALJW9N/b0KmWAy+VCdCsfA3euhRehgBYJungaqU YDX0BcD3ZatPDb3v1ZBiJGyJmKv/38/Ir6OJTjW/DV8zE7e8I8pvilB87elxii5qJ/Xz tHXFD6nuta5pZMRNodrVtynQqs5Hj/v7NZe65m+KtDBfC7fpSSJSWN77wvhdJ1r/EJvx JL7Pwq/x1cGHY+XavS17vLUzdO67rSy/j5cCD7SKTPKMaE+G2pqf3LqMZjpcDNXWsJ9d MzBNfljfv7VWL+ln/BPmdyEi2dUS/jDJ5iCbsjEMtROQQUA3im6YKIvWgZ8iY62nkd50 3YdA== 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; bh=+KvRWjTlKYLawZukynf92KHFK6vJ9cQSFUiOdcC+E8s=; b=VGspdrwdwtbQtov8yGg0hz4BRsFIYZ9FMyStu06zWQhAU0Q+eGRMLdZS35HdJGIn6Z 03BQSsI9m0dtSQk6YHXLAoR3dpnttZCY3gDpDE9FzkG+WaJjaVZsIc40dMP3ZU0HxCNx ERlI0mRYt8h/zRo8rZuEkRxqX8b14Clpc+0t//fati46hGZizhkt6KHi1stoTNwwl3qn h5FHzzOPO6AELZefxSFxr69BWUEd3ZUxUaEhebKYC8pizEOmX59p44Et5h5MnvsfnSa4 oExolHtMfVQ6X2yjlouB+3pnhTMgbCCm3XGS/mIhywkYobxaGYY6WzhXl48DrZ1GI3E6 MQpQ== X-Gm-Message-State: APjAAAW+b8yYL3KrAyQt4Q9T99/Gv0qFJBifK180nBiCHOoWyq4Ztq10 KaY02f0W14amPOtqCA/jwyx2WZcEJM4= X-Google-Smtp-Source: APXvYqzmSFC2DQ7Jjtm41VBFDw3wErJMkwtT87PcSmBNlFbWb+bnwSpq3baIazlN8x+QYIW7AWA4Uw== X-Received: by 2002:a1c:a3c2:: with SMTP id m185mr7940264wme.17.1556555558059; Mon, 29 Apr 2019 09:32:38 -0700 (PDT) Received: from P-NAN-SUCRE.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id 67sm39198214wmz.41.2019.04.29.09.32.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Apr 2019 09:32:37 -0700 (PDT) From: Jugurtha BELKALEM To: buildroot@buildroot.org Date: Mon, 29 Apr 2019 18:32:25 +0200 Message-Id: <1556555546-9246-7-git-send-email-jugurtha.belkalem@smile.fr> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556555546-9246-1-git-send-email-jugurtha.belkalem@smile.fr> References: <1556555546-9246-1-git-send-email-jugurtha.belkalem@smile.fr> Subject: [Buildroot] [PATCH 6/7] support/scripts/qemu-boot: gitlab tests for Qemu X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jugurtha BELKALEM MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Enables to check various qemu architectures build states. These scripts were inspired from toolchain builder : https://github.com/bootlin/toolchains-builder/blob/master/build.sh to test qemu's build process. This allows to troubleshoot different issues that may be associated with defective qemu builds by lanching a qemu machine, sending root password, waiting for login shell and then perform a shutdown. The script expect.sh relies on expect package to automate the tests. We should mention that python-pexpect can be tweeked for the same job but seems like it does hide the automation process as well as any errors that may be encountered. The script qemu-boot-defconfig_config.sh is required for architectures that need special configuration before starting compilation (like setting the correct tty). On the other side, qemu-boot-checker.sh is used to read the qemu command used to launch a qemu machine (by reading board/qemu/qemu_architecture/readme.txt) as well as setting the path to the qemu host and calling expect.sh. Signed-off-by: Jugurtha BELKALEM --- support/scripts/expect.sh | 22 +++++++++++++++++ support/scripts/qemu-boot-checker.sh | 35 +++++++++++++++++++++++++++ support/scripts/qemu-boot-defconfig_config.sh | 11 +++++++++ 3 files changed, 68 insertions(+) create mode 100755 support/scripts/expect.sh create mode 100755 support/scripts/qemu-boot-checker.sh create mode 100755 support/scripts/qemu-boot-defconfig_config.sh diff --git a/support/scripts/expect.sh b/support/scripts/expect.sh new file mode 100755 index 0000000..6d65752 --- /dev/null +++ b/support/scripts/expect.sh @@ -0,0 +1,22 @@ +#!/usr/bin/expect +# + +set timeout 400 + +log_file /tmp/expect_session.log + +eval spawn $env(QEMU_COMMAND) + +expect { + eof {puts "Connection problem, exiting."; exit 1} + timeout {puts "System did not boot in time, exiting."; exit 1} + "buildroot login:" +} +send "root\r" +expect { + eof {puts "Connection problem, exiting."; exit 1} + timeout {puts "No shell, exiting."; exit 1} + "# " +} +send "poweroff\r" +expect "System halted" diff --git a/support/scripts/qemu-boot-checker.sh b/support/scripts/qemu-boot-checker.sh new file mode 100755 index 0000000..f036516 --- /dev/null +++ b/support/scripts/qemu-boot-checker.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if [[ $1 = qemu* ]]; then + device_name=$(echo $1 | sed -e 's#^qemu_##; s#_defconfig$##;' | sed -r 's/[_]/-/g') + if [ $device_name == "x86-64" ]; then + device_name="x86_64" + elif [ $device_name == "xtensa-lx60" ] || [ $device_name == "xtensa-lx60-nommu" ]; then + echo "xtensa cannot be tested" + exit 0 + elif [ $device_name == "m68k-q800" ] || [ $device_name == "ork1k" ]; then + archQemuNoSupport + fi + + test_qemu_cmd="$(grep qemu-system $2/board/qemu/${device_name}/readme.txt)" + qemu_command="$(echo "${test_qemu_cmd}"|tr -d '\n')" + + export QEMU_COMMAND="${qemu_command}" + + export PATH="$2/output/host/bin:$PATH" + echo $PATH + + function archQemuNoSupport { + echo "cannot boot under qemu, support out of tree!" + exit 0 + } + + function boot_test { + if ! expect expect.sh ; then + echo " booting test system ... FAILED" + return 1 + fi + echo " booting test system ... SUCCESS" + } + boot_test +fi diff --git a/support/scripts/qemu-boot-defconfig_config.sh b/support/scripts/qemu-boot-defconfig_config.sh new file mode 100755 index 0000000..526eee1 --- /dev/null +++ b/support/scripts/qemu-boot-defconfig_config.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [[ $1 = qemu* ]]; then + device_name=$(echo $1 | sed -e 's#^qemu_##; s#_defconfig$##;' | sed -r 's/[_]/-/g') + if [ $device_name == "x86-64" ]; then + device_name="x86_64" + sed -i "s/tty1/ttyS0/" $2/configs/$1 + elif [ $device_name == "x86" ]; then + sed -i "s/tty1/ttyS0/" $2/configs/$1 + fi +fi