From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A90043858439 for ; Sun, 2 Oct 2022 14:44:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A90043858439 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-623-UCZhrY7zNW2aRpouRTVoAQ-1; Sun, 02 Oct 2022 10:44:03 -0400 X-MC-Unique: UCZhrY7zNW2aRpouRTVoAQ-1 Received: by mail-wm1-f71.google.com with SMTP id v130-20020a1cac88000000b003b56eabdf04so6594592wme.7 for ; Sun, 02 Oct 2022 07:44:03 -0700 (PDT) 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; bh=1zaeyr/zWyQUBxFdtXUBRJCalQwjp6t012qWQRuT5Ss=; b=K1Akuf7Xnnq+g/vVbvAxZrUtjQu962fHV7ktwjq09iH3DdyAwN9tJwEl0SIBWD5BNP YLLG+wpNLj8pHBW74fCgb9CkEK09VcFJWMABKR8q29CPyxSw5J1NqZomTuHSXI4HYL9D dDwXuzvfzno0U0DzE6uUeDLSIgFbbg6n5VC0FEHeFmvOoCk6Sc4uNmlk+M7flKG8jp6U VmGx7vk/2dp5MWgxhNByb+WfCUW8QCKun4OCzqi3rA/9VO4ETQzrRn2drbWJivqSWmQe qjUMPgDJIhm4bunGNNWHJ9CwRpoiqzccCSWddO9GYIv+AcfpY0N4TnkIQLzkROyl9wHI TenA== X-Gm-Message-State: ACrzQf29LKXzE0niz3LHoQCh/nQev34e0/na/j6CF43SZc5aptSolf/W HsMDiT5ZvF9Wr9AthsKJaWs4xHHarDzizBj2EMI+N3VFsIaoyUHIgruNO8WNvpuLOz2HoTw6rm1 +qN70i0zMOBuxQa2POXrn5kG1HWOzUbxe4kaEXW1fUpIHcNsXdf86po+Ymoy/Qr2Sk8jfYfcJFw == X-Received: by 2002:a5d:6f17:0:b0:22e:33e7:6f6c with SMTP id ay23-20020a5d6f17000000b0022e33e76f6cmr2753626wrb.201.1664721842046; Sun, 02 Oct 2022 07:44:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gwkHFMpx8fA1o31MNDEEsxq/uLHTIqXsJLqZ0ojmCeJNTX5sapPqf6As8Spn/GAaC4UpVSQ== X-Received: by 2002:a5d:6f17:0:b0:22e:33e7:6f6c with SMTP id ay23-20020a5d6f17000000b0022e33e76f6cmr2753610wrb.201.1664721841708; Sun, 02 Oct 2022 07:44:01 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id v1-20020a7bcb41000000b003b27f644488sm8557806wmj.29.2022.10.02.07.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Oct 2022 07:44:01 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 2/2] gdb/testsuite: avoid temporary file in gdb/testsuite Date: Sun, 2 Oct 2022 15:43:57 +0100 Message-Id: <47ee286ceedb3b59347e43743ecd1e2b0c0873be.1664721741.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2022 14:44:09 -0000 I spotted that the gdb.gdb/unittest.exp script causes a temporary file inserters_extractors-2.txt to be created in build/gdb/testsuite/ instead of in build/gdb/testsuite/output/gdb.gdb/unittest/. This is because some of the 'maint selftest' tests create temporary files in GDB's current directory, specifically, the two source files: gdb/unittests/basic_string_view/inserters/wchar_t/2.cc gdb/unittests/basic_string_view/inserters/char/2.cc both create a temporary file called inserters_extractors-2.txt, though we only run the second of these as part of GDB's selftests. I propose that in the gdb.gdb/unittest.exp we change GDB's current working directory to be the output directory for the specific test, that way the temporary file will be created in the correct place. After this change all the tests continue to pass, and the temporary file is no longer left in gdb/testsuite/. --- gdb/testsuite/gdb.gdb/unittest.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp index 2967b994cc3..a60cd70a259 100644 --- a/gdb/testsuite/gdb.gdb/unittest.exp +++ b/gdb/testsuite/gdb.gdb/unittest.exp @@ -40,6 +40,14 @@ proc run_selftests { binfile } { clean_restart ${binfile} } + # Some of the selftests create temporary files in GDB's current + # directory. So, while running the selftests, switch to the + # test's output directory to avoid leaving clutter in the + # gdb/testsuite root directory. + set dir [standard_output_file ""] + gdb_test "cd $dir" "Working directory $dir\\." \ + "switch to test output directory" + set enabled 1 set test "maintenance selftest" gdb_test_multiple $test $test { -- 2.25.4