From patchwork Wed Aug 30 14:51:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9929845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D59860383 for ; Wed, 30 Aug 2017 14:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2CB7283FF for ; Wed, 30 Aug 2017 14:51:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7BA7286A9; Wed, 30 Aug 2017 14:51:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC09528691 for ; Wed, 30 Aug 2017 14:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751805AbdH3Ovc (ORCPT ); Wed, 30 Aug 2017 10:51:32 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35703 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbdH3Ov1 (ORCPT ); Wed, 30 Aug 2017 10:51:27 -0400 Received: by mail-wm0-f65.google.com with SMTP id e204so2056937wma.2; Wed, 30 Aug 2017 07:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/F5zwKq5bG9gpIkvCv05N/BJP1v1hh4tyzatdx06Of0=; b=Mlk4lWCCWlfYMuhrNDQhL3i5jNl2dUVnUhfwrieY7CucMSkQHfqIYc0Ie1XxztTppY AIILTL04OmuEPee7SEZlegFuQn4UvCNya8ukmE9J3LnYoLac3mlTvITsfj9nTBhtvX+T hOYlE4fa4l44zaM+EHOkpBmbE6jj3v+Y+y61pQ75hXpMf565LYO5Wv58f6oPONOPoXQs SUazpNcv474PGI1W/Bs8a9QpuKaNRXPEs540VD6bREN63DG6AEGVURX0ippiQtRc2VPc Rm+L3hTZ+ippXgtLCb56wLZIbYMFFS2H29LwVXho/hEH1+l7JovwXpbmWpq7qpSFm3IS gdKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/F5zwKq5bG9gpIkvCv05N/BJP1v1hh4tyzatdx06Of0=; b=bPyKJb+n0xm4yF8ZBM8z2vM2aaOowHJ1OJXcOAZ+agcBAPz7qpSP5F+PK0UJ3roT6B Pt6J+mr8ZsJy+fK7gBEJgG/jjn7/LbiYxXE40un4gSSE7Zvi6g9WkORtIt8mP3P7vnnF Hut0vd3+LKvOdNJJwljOTVS3NMfJTlz71eczOqMEv8EOWIj1txOOueheo5cHD5XAZnrC B/kcZ6QRTLHvD/FoUZXx4m7Y++RqG95IBzoeC5jNAxt3ugjJPmqPPRXx7P4yynj+FTJK m+Fak9RSXrsXn+yWehurOp2mNxlPa5Fhj014r/tdaEzJUpcNmugb3pVNqDcRJslgQ2+m XzCQ== X-Gm-Message-State: AHYfb5gNJY2BnA+fPlBkhshCXWDWhDDZGzUUIO69eH8wQm1mji4ry4n4 vYQJFVuHEif6ng== X-Received: by 10.28.203.205 with SMTP id b196mr1361184wmg.105.1504104685700; Wed, 30 Aug 2017 07:51:25 -0700 (PDT) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id f42sm2606306wrf.27.2017.08.30.07.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Aug 2017 07:51:25 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Josef Bacik , "Darrick J . Wong" , Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH v2 04/14] fsx: fix path of .fsx* files Date: Wed, 30 Aug 2017 17:51:36 +0300 Message-Id: <1504104706-11965-5-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504104706-11965-1-git-send-email-amir73il@gmail.com> References: <1504104706-11965-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When command line arg -P is used, compose the path for .fsxgood .fsxlog .fsxops files from dirpath and work file basename. This fix is ported from LTP. Signed-off-by: Amir Goldstein --- ltp/fsx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 572df75..1502905 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1581,7 +1581,7 @@ usage(void) " -L: fsxLite - no file creations & no file size changes\n\ -N numops: total # operations to do (default infinity)\n\ -O: use oplen (see -o flag) for every op (default random)\n\ - -P: save .fsxlog and .fsxgood files in dirpath (default ./)\n\ + -P: save .fsxlog .fsxops and .fsxgood files in dirpath (default ./)\n\ -S seed: for random # generator (default 1) 0 gets timestamp\n\ -W: mapped write operations DISabled\n\ -R: read() system calls only (mapped reads disabled)\n\ @@ -1761,6 +1761,7 @@ main(int argc, char **argv) char *endp; char goodfile[1024]; char logfile[1024]; + int dirpath = 0; struct stat statbuf; goodfile[0] = 0; @@ -1902,6 +1903,9 @@ main(int argc, char **argv) strcat(goodfile, "/"); strncpy(logfile, optarg, sizeof(logfile)); strcat(logfile, "/"); + strncpy(opsfile, optarg, sizeof(logfile)); + strcat(opsfile, "/"); + dirpath = 1; break; case 'R': mapped_reads = 0; @@ -1978,21 +1982,21 @@ main(int argc, char **argv) } } #endif - strncat(goodfile, fname, 256); + strncat(goodfile, dirpath ? basename(fname) : fname, 256); strcat (goodfile, ".fsxgood"); fsxgoodfd = open(goodfile, O_RDWR|O_CREAT|O_TRUNC, 0666); if (fsxgoodfd < 0) { prterr(goodfile); exit(92); } - strncat(logfile, fname, 256); + strncat(logfile, dirpath ? basename(fname) : fname, 256); strcat (logfile, ".fsxlog"); fsxlogf = fopen(logfile, "w"); if (fsxlogf == NULL) { prterr(logfile); exit(93); } - strncat(opsfile, fname, 256); + strncat(opsfile, dirpath ? basename(fname) : fname, 256); strcat(opsfile, ".fsxops"); unlink(opsfile);