From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pJ75z-00015J-OO for mharc-grub-devel@gnu.org; Sat, 21 Jan 2023 01:11:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJ75z-000150-1Z for grub-devel@gnu.org; Sat, 21 Jan 2023 01:11:19 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJ75u-0007eN-Bu for grub-devel@gnu.org; Sat, 21 Jan 2023 01:11:15 -0500 Received: by mail-pl1-x62c.google.com with SMTP id p24so7073316plw.11 for ; Fri, 20 Jan 2023 22:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P6ooMlSJUC8RPuMXBEZX9dzpij6HmQvJZKbLpKDK1u4=; b=hxWMDCi7A6pLCz8/0cWPeZaiIP5NpReZx3ZZXRiK/HdLJg6TOSBZK7xmD6fyEmMlw/ N8HDUNPbnhKx7JTxWwlwUNKpfFvyT1UfeoXs8ZY9Or6uyPb1LQ0YB7HWKac8uVooLlI8 +8mVtSrp4m1umCs8BYTn7jgOR5CP5YGlpFlGDHac03/xN8+QE9/Nhvt4H9i6wBa+G1aa lxPa5PlSkJ7vE2gpiaaBEYpU758/sBx98YSIaLu6kC0AOW7pNljI+EoeiHQhzpc/8j0K ALT2mRCh1djTtpBluBZtibmU2G6uzimIo+n7LPZxgqwxeYNdHk++zZN3grLNEbMvWlhp lHgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P6ooMlSJUC8RPuMXBEZX9dzpij6HmQvJZKbLpKDK1u4=; b=0LvoOij6Umx12IE3z8q0QKgRkPoBomSDGLq49abHcNytOxfMJAQ7+LDEIHFfOPaFnc wgigSCUEONlXDtJhlmquwloaG9WBVdICXORarcj22HiPA4NYgaj1z4qG0Ou2YfaRLEq+ vMg/4bb/s4HEiPAtVEe3ggRBrJ6RtffFkG5Xq75nDJBPHRfcUFnJe2nI+sxWZKzN1wuG 5PGj0EGeUvvD7AA7VqHbXZMfrwdkxLcWEAxkFcWQszMwF6RCj1U4QYykw4pBBUcEQ/L3 vsDg67HtY57WK0OW6/jhiniOD021YuPY3uxB8RyDVCtI6bv5ExTRfSBmc6Y9u2OEqnJH sIKA== X-Gm-Message-State: AFqh2kq+HBk6lMFgY17lB7tECIw3UvMEKVl2NDXed/jLI+heeT8IC09z ZAZci05AdLf6iUa8Xh8DzsyajtP1FCuvtfjY X-Google-Smtp-Source: AMrXdXvyj78WIDcTDHPsDNgqsVXISejG2y3AM88are3+/3YkUncs5ViffnAjWWLr0kwAvCQmcgOhnw== X-Received: by 2002:a17:902:b492:b0:194:c733:ea0f with SMTP id y18-20020a170902b49200b00194c733ea0fmr10184896plr.50.1674281472613; Fri, 20 Jan 2023 22:11:12 -0800 (PST) Received: from localhost.localdomain ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id u12-20020a17090341cc00b001888cadf8f6sm9241267ple.49.2023.01.20.22.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 22:11:11 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH 2/3] grub-shell: Create run.sh in working directory for easily running test again Date: Sat, 21 Jan 2023 00:10:45 -0600 Message-Id: <20230121061046.1619695-3-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230121061046.1619695-1-development@efficientek.com> References: <20230121061046.1619695-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=development@efficientek.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2023 06:11:19 -0000 Now it becomes trivial to re-run a test from the output in its working directory. This also makes it easy to send a reproducible failing test to the mailing list. This has allowed a refactor so that the duplicated code to call QEMU has be condensed (eg. the use of timeout and file descriptor redirection). The run.sh script will pass any arguments given to QEMU. This allows QEMU to be easily started in a state ready for GDB to be attached. Signed-off-by: Glenn Washburn --- tests/util/grub-shell.in | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 60494bcf1d..658485f7ea 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -521,8 +521,11 @@ if [ x$boot = xnet ]; then cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" [ -z "$files" ] || copy_extra_files "$netdir" $files - setup_qemu_logger - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic > "$work_directory/qemu-pipe" || ret=$? + cat >"$work_directory/run.sh" < "$work_directory/qemu-pipe" || ret=$? + cat >"$work_directory/run.sh" <"$work_directory/run.sh" < "$work_directory/qemu-pipe" || ret=$? + chmod +x "$work_directory/run.sh" + timeout -s KILL $timeout "$work_directory/run.sh" > "$work_directory/qemu-pipe" || ret=$? fi wait @@ -565,6 +582,7 @@ fi test -n "$debug" || rm -f "${isofile}" test -n "$debug" || rm -rf "${rom_directory}" test -n "$debug" || rm -f "${tmpfile}" "${cfgfile}" "${goutfile}" +test -n "$debug" || rm -f "$work_directory/run.sh" exit $ret -- 2.34.1