From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +JQMAoXJx2AYUQAAWB0awg (envelope-from ) for ; Mon, 14 Jun 2021 17:26:29 -0400 Received: by simark.ca (Postfix, from userid 112) id 05B3A1F163; Mon, 14 Jun 2021 17:26:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 33F1E1E54D for ; Mon, 14 Jun 2021 17:26:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F41A9397311A for ; Mon, 14 Jun 2021 21:26:27 +0000 (GMT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id F14803973033 for ; Mon, 14 Jun 2021 21:24:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F14803973033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id c9so15969738wrt.5 for ; Mon, 14 Jun 2021 14:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=66bXmPpW4fJG5IXVnY5NnOFxOAMmI5+ALdZs29RrpHw=; b=leXWXj4/MqCQYOOX5gK98AdI04HDyOzbWXhYhGL4A8781bvfFdAHml/OdHtYvWZTwj LiWDMTW4WyPpWUTAP6OEBhfJRk6VFTUNci23qyd9xAOUJdhevljp57QR2APhma6swuCJ yTzMUNTsMVnJS/qfP0luFbsSORrY1oqxdsGnCHfnp+Z9Dp0ezWJmkCHKQEMCIfXcxD8R 6l2p5gS39X7CGm14e7nWHIBJ/Omorge1AsHMevGTVQSXjZmFYVyCg5L8qJLILKgNXd1+ qyZ0Lj2u4yMcN/GT1hbgxsyLwbtSMSJJpNFSIjb1ut8Gdk6BRbUMC10tu/5zm+Ufw9jv ncOA== X-Gm-Message-State: AOAM532XgOUymYgGuuY8qRoiyYOT5l78lmVnNtAtt4cPohfx7etE1C6n nX4pZvh7t70khJIBPdW/yiSk7675IJpufw== X-Google-Smtp-Source: ABdhPJy4aCGbFcRf1S9s2N/W1ZesUgqGjjTVShztMPPk/ptinNfMQq3k0m4+9E4ZH7+qAZMwBItW5A== X-Received: by 2002:a05:6000:154c:: with SMTP id 12mr20638039wry.126.1623705868513; Mon, 14 Jun 2021 14:24:28 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id m6sm20492566wrw.9.2021.06.14.14.24.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Jun 2021 14:24:27 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 08/16] Make inferior/GDB share terminal in tests that exercise GDB/inferior reading same input Date: Mon, 14 Jun 2021 22:24:02 +0100 Message-Id: <20210614212410.1612666-9-pedro@palves.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210614212410.1612666-1-pedro@palves.net> References: <20210614212410.1612666-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Some testcases exercise some aspect that only makes sense when GDB and the inferior are sharing the same terminal, meaning GDB and the inferior are reading from the same input file. This commit makes sure that continues to be tested even after GDB changed to put inferiors in their own session/terminal by default, by issuing "tty /dev/tty". The tests would fail otherwise. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.base/annota-input-while-running.exp: Issue "tty /dev/tty" before starting program. * gdb.base/continue-all-already-running.exp: Likewise. * gdb.base/infcall-input.exp: Likewise. Change-Id: Ia5f9061bf28a5e780194aa75b37b6058de0614ee --- .../gdb.base/annota-input-while-running.exp | 4 ++++ .../gdb.base/continue-all-already-running.exp | 3 +++ gdb/testsuite/gdb.base/infcall-input.exp | 12 +++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/annota-input-while-running.exp b/gdb/testsuite/gdb.base/annota-input-while-running.exp index 389cb644517..912565806e8 100644 --- a/gdb/testsuite/gdb.base/annota-input-while-running.exp +++ b/gdb/testsuite/gdb.base/annota-input-while-running.exp @@ -22,6 +22,10 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} { return -1 } +# This testcase only makes sense when GDB and the inferior are reading +# from the same input file (aka sharing the terminal's input buffer). +gdb_test_no_output "tty /dev/tty" + # Because runto_main doesn't know how to handle the prompt with annotations, # run to main before we set the annotation level. if ![runto_main] then { diff --git a/gdb/testsuite/gdb.base/continue-all-already-running.exp b/gdb/testsuite/gdb.base/continue-all-already-running.exp index de84897c766..caff93ab425 100644 --- a/gdb/testsuite/gdb.base/continue-all-already-running.exp +++ b/gdb/testsuite/gdb.base/continue-all-already-running.exp @@ -20,6 +20,9 @@ standard_testfile save_vars { GDBFLAGS } { set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\"" + # This test only makes sense when GDB and the inferior are reading + # from the same input file / sharing the terminal. + append GDBFLAGS " -ex \"tty /dev/tty\"" if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } { return -1 } diff --git a/gdb/testsuite/gdb.base/infcall-input.exp b/gdb/testsuite/gdb.base/infcall-input.exp index fec0eb2a4d8..87bd049e139 100644 --- a/gdb/testsuite/gdb.base/infcall-input.exp +++ b/gdb/testsuite/gdb.base/infcall-input.exp @@ -23,10 +23,20 @@ if [target_info exists gdb,cannot_call_functions] { continue } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +if {[build_executable "failed to compile" $testfile $srcfile debug]} { return -1 } +save_vars { GDBFLAGS } { + # This test only makes sense when GDB and the inferior are reading + # from the same input file / sharing the terminal. If we instead + # let GDB put the inferior in its own session, then while the + # inferior is running in the foreground, input would be redirected + # to the inferior, and GDB would never see that input. + append GDBFLAGS " -ex \"tty /dev/tty\"" + clean_restart $binfile +} + if ![runto_main] then { fail "couldn't run to main" return -1 -- 2.26.2