From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [182.2.39.110]) by gnuweeb.org (Postfix) with ESMTPSA id 2F2747E254; Mon, 5 Sep 2022 07:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1662361967; bh=KNnxh4u9cUj673J8B4AGd0GRsIg4ioEtEBcVVBlMeA8=; h=From:To:Cc:Subject:Date:From; b=XUEAOMVty/REKqmrjuSz9M7+TP5GGAyIm5RudocDucCV8+b8LKzAuw7vDm1fLc0VF JHR14v8hFHdEC4ePoj0BeqzmqgvaPGWZbFQAjWGQyVCkGWEJvvnajotZ9bh9yt/Wuo D3We0gspErpHCpc1Guq0HbsMFgMdjuTKA4l25IImZKqZ0zqYubRC1FsSpyTrPPPfIe jjbkrOTufcIajuf2yVia2sFwSNvvwxHac8+brZKzSAjDyEXPxJkWCLaHX2AiuW0WZx +z6MaN7eT5BqQ/3nfM/MhpatPfWeSKr2RXBzG58UPP9sZ00qJvdnVMUkErb+Jf82be XZc2ctp5vyG5Q== From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Pavel Begunkov , io-uring Mailing List , GNU/Weeb Mailing List , Kanna Scarlet , Muhammad Rizki Subject: [PATCH liburing v1] test/ringbuf-read: Delete `.ringbuf-read.%d` before exit Date: Mon, 5 Sep 2022 14:12:28 +0700 Message-Id: <20220905070633.187725-1-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Ammar Faizi Running test/ringbuf-read.t leaves untracked files in git status: Untracked files: (use "git add ..." to include in what will be committed) .ringbuf-read.163521 .ringbuf-read.163564 .ringbuf-read.163605 .ringbuf-read.163648 Make sure we unlink it properly. Signed-off-by: Ammar Faizi --- test/ringbuf-read.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/test/ringbuf-read.c b/test/ringbuf-read.c index 673f2de..060eb1d 100644 --- a/test/ringbuf-read.c +++ b/test/ringbuf-read.c @@ -133,63 +133,64 @@ static int test(const char *filename, int dio, int async) int main(int argc, char *argv[]) { char buf[BUF_SIZE]; char fname[80]; int ret, fd, i, do_unlink; if (argc > 1) { strcpy(fname, argv[1]); do_unlink = 0; } else { sprintf(fname, ".ringbuf-read.%d", getpid()); t_create_file(fname, FSIZE); do_unlink = 1; } fd = open(fname, O_WRONLY); if (fd < 0) { perror("open"); - goto err; + ret = 1; + goto out; } for (i = 0; i < NR_BUFS; i++) { memset(buf, i + 1, BUF_SIZE); ret = write(fd, buf, BUF_SIZE); if (ret != BUF_SIZE) { fprintf(stderr, "bad file prep write\n"); - goto err; + ret = 1; + close(fd); + goto out; } } close(fd); ret = test(fname, 1, 0); if (ret) { fprintf(stderr, "dio test failed\n"); - return ret; + goto out; + } + if (no_buf_ring) { + ret = 0; + goto out; } - if (no_buf_ring) - return 0; ret = test(fname, 0, 0); if (ret) { fprintf(stderr, "buffered test failed\n"); - return ret; + goto out; } ret = test(fname, 1, 1); if (ret) { fprintf(stderr, "dio async test failed\n"); - return ret; + goto out; } ret = test(fname, 0, 1); - if (ret) { + if (ret) fprintf(stderr, "buffered async test failed\n"); - return ret; - } - - return 0; -err: +out: if (do_unlink) unlink(fname); - return 1; + return ret; } base-commit: 3bd7d6b27e6b7d7950bba1491bc9c385378fe4dd -- Ammar Faizi