From patchwork Tue Dec 12 17:44:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 81995 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC517385B525 for ; Tue, 12 Dec 2023 17:45:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 1764E3858000 for ; Tue, 12 Dec 2023 17:44:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1764E3858000 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1764E3858000 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702403088; cv=none; b=AVPSK1Q0pdIXcuKQ4g7hb84cog92H85iIXygOYhllgp4NHi1ovnRoHurfTTcep17RTwZWlRnh+6V+gLqmNWI9/MPJ7i4CdrEVir+l34o24CrEGg6oEMOnGiTUYRYckGrsLPOAN3Fo7hS+VbjRh5gQ7YJU/0+JfKsx07DwiO9TUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702403088; c=relaxed/simple; bh=/boCMQmQnA28aOjxMTmaAYVLNdn89tJzERiOJGBaYmw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=wYc10Vn8qoLVdoT0ZKo5lLvATAXNngAoUZN0rsnr6ISb9ONQhqODqRz10q8Z96OOcMGNcwh/fJW0Z3t4yzsGsIidSoxJO2Jq+KZIbZWEb59VX3lMBQAeqiqOlFWrxi/aZBTWdq9BjxeMX/jy/YMCspXMZcCQfZaZa4mIbC+zym4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-35d699ec3caso19100415ab.3 for ; Tue, 12 Dec 2023 09:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702403086; x=1703007886; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0srrMohV6K9467myCFYLVFDClWwrEvy/wKJgX8gBKrc=; b=b0n+osQQjID+pOMkg6NbFg+9VkzpchW4Sj0u3lDQEozD77FMUkNfZATygz7jfCSpQQ 3VC/H5u6bFagJBQgNepl92oVHahlC9hnsOWNIdRWyt9K+mxUWQ+9G+0qcZj7WewIPsze TBDg8Nbvg4/y+rOCK+ua5IiU0C+R2KLUNdcY2T0EUV8FSkXzgTPZfTS+GD15I1MbiFHv /MartXT0n0XAtm2HeFKTI5GpANLixj61FPXw8JeWew+KHA6g5emukvV+3jLtnxKEJ2an yZmt8urmn4ZDMVDzHq2YuLu7JMVYIQNGTCa8ImfzMrXjWgnSHPiCj3uqY0WxbMuxyrC1 MMiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702403086; x=1703007886; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0srrMohV6K9467myCFYLVFDClWwrEvy/wKJgX8gBKrc=; b=kSIJcyZrQi5inA1Tqn5y55yzzc9eJqGMVqDv/uQqLOQMDLSyRnesv3Rn9qiFYfA6Lm IMO5A9fpE3dFdmTxbb1cl4uWUDTuatyiUGiAyZzGPwB7eL8Jr8W3e2ynWaqZm/F92SGO BnUIwffZEWXBuZU1uaQx8sdn6odzffs8dy3uKAv5fxiTuQproQUpZxkbTpUgy2b0o7mN w81wKWoabAfnB55fBhUjbMNH5LeNygLOzG1EfaDGTnNMY31eTt7p54Lle25fHFagMX6W lPd8EIG8ycdq72bSoId08+n9r8U9gcLT7szhO1Vn6lawPfOCw4Rw8cvWv6Fecf374xO+ VAdg== X-Gm-Message-State: AOJu0YzQBkRzmOeN/KSI49ZfrRtKgFOlmZUhTzb0Ea9PDgno4pJgePIf h91PJJ9A5iu8Z2GHp8gdwsfT8Stfxx9isptEcCQ= X-Google-Smtp-Source: AGHT+IHv8j6trqLNrxacdgalKqlCCfCSzw5EuruOsnMeP5AMozHzLq7DY/8VzPX+unWu0/8cCJ2yoQ== X-Received: by 2002:a05:6e02:1a0c:b0:35d:50a8:8e00 with SMTP id s12-20020a056e021a0c00b0035d50a88e00mr10833521ild.18.1702403086295; Tue, 12 Dec 2023 09:44:46 -0800 (PST) Received: from localhost.localdomain (71-211-161-25.hlrn.qwest.net. [71.211.161.25]) by smtp.gmail.com with ESMTPSA id u26-20020a02aa9a000000b004693a30f295sm2479819jai.170.2023.12.12.09.44.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 09:44:45 -0800 (PST) From: Tom Tromey Date: Tue, 12 Dec 2023 10:44:45 -0700 Subject: [PATCH 4/4] Check for rogue DAP exceptions in test suite MIME-Version: 1.0 Message-Id: <20231212-dap-no-test-exceptions-v1-4-af0e33f10093@adacore.com> References: <20231212-dap-no-test-exceptions-v1-0-af0e33f10093@adacore.com> In-Reply-To: <20231212-dap-no-test-exceptions-v1-0-af0e33f10093@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This changes the test suite to look for rogue DAP exceptions in the log file, and issue a "fail" if one is found. --- gdb/testsuite/lib/dap-support.exp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index b9ac314fee5..4aaae637c45 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -16,6 +16,11 @@ # The JSON parser. load_lib ton.tcl +# The sequence number for the currently-executing instance of gdb +# launched via dap_gdb_start. This is used for log-file checking +# after the run is complete. Zero means gdb hasn't started yet. +set dap_gdb_instance 0 + # The sequence number for the next DAP request. This is used by the # automatic sequence-counting code below. It is reset each time GDB # is restarted. @@ -29,10 +34,13 @@ proc dap_gdb_start {} { gdb_stdin_log_init + global dap_gdb_instance + incr dap_gdb_instance + global GDBFLAGS stty_init save_vars { GDBFLAGS stty_init } { set stty_init "-echo raw" - set logfile [standard_output_file "dap.log.$gdb_instances"] + set logfile [standard_output_file "dap.log.$dap_gdb_instance"] append GDBFLAGS " -iex \"set debug dap-log-file $logfile\" -q -i=dap" set res [gdb_spawn] if {$res != 0} { @@ -325,11 +333,35 @@ proc dap_target_remote {target} { [format {o target [s %s]} $target]] } +# Read the most recent DAP log file and check it for exceptions. +proc _dap_check_log_file {} { + global dap_gdb_instance + + set fd [open [standard_output_file "dap.log.$dap_gdb_instance"]] + set contents [read $fd] + close $fd + + set ok 1 + foreach line [split $contents "\n"] { + if {[regexp "^Traceback" $line]} { + set ok 0 + break + } + } + + if {$ok} { + pass "exceptions in log file" + } else { + fail "exceptions in log file" + } +} + # Cleanly shut down gdb. TERMINATE is passed as the terminateDebuggee # parameter to the request. proc dap_shutdown {{terminate false}} { dap_check_request_and_response "shutdown" disconnect \ [format {o terminateDebuggee [l %s]} $terminate] + _dap_check_log_file } # Search the event list EVENTS for an output event matching the regexp