From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id SN1HBjAouWBoIwAAWB0awg (envelope-from ) for ; Thu, 03 Jun 2021 15:06:24 -0400 Received: by simark.ca (Postfix, from userid 112) id 180FB1F163; Thu, 3 Jun 2021 15:06:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 5A6F51E01F for ; Thu, 3 Jun 2021 15:06:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 232C5398FC3D for ; Thu, 3 Jun 2021 19:06:23 +0000 (GMT) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by sourceware.org (Postfix) with ESMTPS id 52CFF398FC3D for ; Thu, 3 Jun 2021 19:03:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52CFF398FC3D 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-f50.google.com with SMTP id h8so6871912wrz.8 for ; Thu, 03 Jun 2021 12:03:07 -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=tBFU9u8YmKKY44y8+5i6QDIkZFQEatMmBrvcktu57hI=; b=hZ3eC4tGYaZY0x6OTCu36ClWHKjmxJ8LyNbcgSVQXj3ltAa04Qc4I+mFkPIMeh7Fvw IpPb8TCoY6mYp7WQolJn4M4wII5uzQcSs1jrGYYIppjcN0fn/Z3TZQanVyolVP87ZKWz LHXy2ODTPb3InaJ9BBW0KRcOnV250sGMFkNgaN+McJa8dv8yIC2uitfZ3Wun9A+S2FyB 2783SSskxZixworqDnTQ5D5E7TAlWRfLbc1wJW6WTRX6F1PTpIE0ELbIerX8veFxVvwm Wz2FKmiZ7MaYA2pHeQp6gkk7RI23g3nuzUvX4NZrH/GWVDinR2AMLo87ev+wvwZpznVq viWw== X-Gm-Message-State: AOAM531OdwGtlCw7Co34v6eJWA7FELegReypSUbnwE3URkInLWbNlpLC 2fSj8SQ49JuvSTDQqIFv8SSqQAQzDz/l2A== X-Google-Smtp-Source: ABdhPJxaWo81NCduuibWLbVA+C+eycneCwHjU+eYiYGG6lUy7NfJESqhpFLkzdctM3i0cf7mmBoeCw== X-Received: by 2002:adf:e846:: with SMTP id d6mr425568wrn.189.1622746985772; Thu, 03 Jun 2021 12:03:05 -0700 (PDT) Received: from localhost ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id a123sm7811242wmd.2.2021.06.03.12.03.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 12:03:05 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 09/17] Make inferior/GDB share terminal in tests that exercise GDB/inferior reading same input Date: Thu, 3 Jun 2021 20:02:35 +0100 Message-Id: <20210603190243.2609886-10-pedro@palves.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210603190243.2609886-1-pedro@palves.net> References: <20210603190243.2609886-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 23cd9920bc7..e0651bd4d76 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