From patchwork Tue Oct 5 23:31:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 45915 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 68392385802D for ; Tue, 5 Oct 2021 23:32:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68392385802D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633476721; bh=9Wl/2425E+L5duV40KVRhRT/tvz2rugcxL0hWulMjts=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SBMOl7P7M8QN0PIiSBRAsrbd3VYfLV7SAFYzqxTUgXboyzAxDBc7LzcY90KFVABSt DwYFXty9KDO5j+UfyfG7E4RMx59hQ2WrnZRTNwZZnJ+KvZO542WqaIYy0qRTzy3Ui/ 9plk8Dsx1kCSerNZJCZmBfnie7ZeXEsG5rroZoiA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id D7A7B385C40D for ; Tue, 5 Oct 2021 23:31:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D7A7B385C40D Received: by mail-pf1-x430.google.com with SMTP id g14so824432pfm.1 for ; Tue, 05 Oct 2021 16:31:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9Wl/2425E+L5duV40KVRhRT/tvz2rugcxL0hWulMjts=; b=qKCNvYOQqrQ4iHpUrhgjDWTAbH6RlpGZ4Y6Fq3O/++62Y+enccLogFzQzwiA4oFOLg rqWbw/m5HqviN9GMD+ibiUuR/foyU7B8QuvBkORvZxxH9FjWzFCLuGgG2HgUyP+qJj+S ZKX9l8zf85cPLLK9mRvt6GzUOlX+/PA2eKNSmEgbpr3+JYi6l3jROvmajJnwqc9CCPdp kdcUuX7jiSUC6eOXHIFlTcrUAJLDbNGFyBYkEr33UebkGnr2nADSZRvyOkcKhXnZv9rR sBORpRQZK8Lr/zd731G3NDlobaNOC5s7knPsmMRoyzsvXU81n7t8pueTIPZPrVq9n9kL QMfw== X-Gm-Message-State: AOAM531JZ4wZjQWMVP+So8ZCg5Eg+ffKOP+vRG8X2AbDmzcwl25+wg4A wGmQ01F12yr/3+5EhEkoE4diRLiVtfA= X-Google-Smtp-Source: ABdhPJwJDe3khrigq4FroB53Qp3Kva8VlDuw4ieveUun8OO9F9Ce1KezpqPnY2VHcnzimJC1y86LGw== X-Received: by 2002:a62:3603:0:b0:44b:b335:a7bf with SMTP id d3-20020a623603000000b0044bb335a7bfmr33280117pfa.80.1633476676562; Tue, 05 Oct 2021 16:31:16 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id h2sm3073073pjk.44.2021.10.05.16.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 16:31:15 -0700 (PDT) To: GLIBC patches Subject: [PATCH] libio: Update tst-wfile-sync to not depend on stdin Date: Wed, 6 Oct 2021 08:31:12 +0900 Message-Id: <20211005233112.2219886-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The test expects stdin to be a file which is not the case when running tests over ssh where stdin is piped in. The test fails with: error: xlseek.c:27: lseek64 (0, 0, 1): Illegal seek Update the test to create a temporary file and use that to perform the test. Reviewed-by: Adhemerval Zanella --- libio/tst-wfile-sync.c | 27 ++++++++++++++++++++++++--- libio/tst-wfile-sync.input | 1 - 2 files changed, 24 insertions(+), 4 deletions(-) delete mode 100644 libio/tst-wfile-sync.input diff --git a/libio/tst-wfile-sync.c b/libio/tst-wfile-sync.c index d279019349..f2415dbfca 100644 --- a/libio/tst-wfile-sync.c +++ b/libio/tst-wfile-sync.c @@ -16,22 +16,43 @@ License along with the GNU C Library; if not, see . */ +#include #include #include +#include +#include #include #include +#include #include +#include + +static const char test_data[] = "This is a test of _IO_wfile_sync."; static int do_test (void) { + static char *infile; + int infd; + FILE *infp; + + infd = create_temp_file ("tst-wfile-sync-in-", &infile); + xwrite (infd, test_data, strlen (test_data)); + xclose (infd); + + infd = xopen (infile, O_RDONLY, 0); + infp = fdopen (infd, "r"); + TEST_VERIFY_EXIT (setlocale (LC_ALL, "de_DE.UTF-8") != NULL); /* Fill the stdio buffer and advance the read pointer. */ - TEST_VERIFY_EXIT (fgetwc (stdin) != WEOF); + TEST_VERIFY_EXIT (fgetwc (infp) != WEOF); /* This calls _IO_wfile_sync, it should not crash. */ - TEST_VERIFY_EXIT (setvbuf (stdin, NULL, _IONBF, 0) == 0); + TEST_VERIFY_EXIT (setvbuf (infp, NULL, _IONBF, 0) == 0); /* Verify that the external file offset has been synchronized. */ - TEST_COMPARE (xlseek (0, 0, SEEK_CUR), 1); + TEST_COMPARE (xlseek (infd, 0, SEEK_CUR), 1); + + fclose (infp); + free (infile); return 0; } diff --git a/libio/tst-wfile-sync.input b/libio/tst-wfile-sync.input deleted file mode 100644 index 12d0958f7a..0000000000 --- a/libio/tst-wfile-sync.input +++ /dev/null @@ -1 +0,0 @@ -This is a test of _IO_wfile_sync.