From patchwork Wed Aug 30 14:51:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9929869 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 D7B5260383 for ; Wed, 30 Aug 2017 14:51:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C94B2286A9 for ; Wed, 30 Aug 2017 14:51:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE573286AD; Wed, 30 Aug 2017 14:51:45 +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=unavailable 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 779C9283FF for ; Wed, 30 Aug 2017 14:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751816AbdH3Ovg (ORCPT ); Wed, 30 Aug 2017 10:51:36 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37162 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751435AbdH3Ovc (ORCPT ); Wed, 30 Aug 2017 10:51:32 -0400 Received: by mail-wr0-f196.google.com with SMTP id k9so1568057wre.4; Wed, 30 Aug 2017 07:51:31 -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=Kco3UXs8BOTuOK/V0iprNaSmAKK+y+r4EHdN8jmvXfY=; b=tKbi+VyU0vKQU9ve45dpWj/OOBOwvRXb5p/C+uSOJ5WNTp24ja+I9dGJft2ub9Pn6/ AMxG+xHmQYIiEQb99t6yKwvsiX62ejPSwsCsy9v6jXL4VlwZPXebJBGQ20M7FJRVakiI 8XNk/3ALO58RtfKRhTxo7TvfbpCnEMlWg0p+JpT9RmNekqaqSCuvD0fK7M+fnsvc/g3o qaHbbQ07joubdj+kcMOwxl7+HE9R8u9hpl2igPPvnhshzN/X20sZgS5BBGAy5UKjb1cd sNyqiWIXGw76XXBFgooBVER66BHX6wD5x3tCuhqIp+NYMn8I80riLfq2LH80UsdQ/daW PpZw== 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=Kco3UXs8BOTuOK/V0iprNaSmAKK+y+r4EHdN8jmvXfY=; b=XkQ9AM9QY1AO/Yf4coPgUyYWYpbtFi7uWsAgCYk1WNRIwxTKpE2V8mEfAg4zNMheSN lgXWZ5IkD7nzJdS7/ga7if1jP/xjFgijyDaU4Noynl39vsgqCChfYI3cXHXPQFvl0GW3 FlJTyDaToc6OMUnsppZQLYTi6coYfTBKWbiK9kym+2GW4dJyc6WiVUHx/ku48QNMNS38 n9Fp0XHDgP+Vzy94sd04ifJPJ4TbV4Mis66DMU/Xmd3sX/05On4Vt3ipSFP+jrFulYXn UmhUUl4sk8dGrYRSOXP0sORK6VAWdU7B65TdapI0SVglmt8RkMQPX5Am8KLkzHh9ZJfV 5z8g== X-Gm-Message-State: AHYfb5iwHdd8Skvb4WPf1GuUNd7Rl1uOQGLL2F1Nw+QIRYfkxmSNqwPo fCBenJrpKtfnEA== X-Received: by 10.223.184.187 with SMTP id i56mr1213643wrf.323.1504104691043; Wed, 30 Aug 2017 07:51:31 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Aug 2017 07:51:30 -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 08/14] fsx: add support for --record-ops Date: Wed, 30 Aug 2017 17:51:40 +0300 Message-Id: <1504104706-11965-9-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 Usually, fsx dumps an .fsxops file on failure with same basename as work file and possibly under dirctory specified by -P dirpath. The --record-ops[=opsfile] flag can be use to dump ops file also on success and to optionally specify the ops file name. Signed-off-by: Amir Goldstein --- ltp/fsx.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index a6420f6..dd6b637 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -180,6 +180,7 @@ int aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset); #endif const char *replayops = NULL; +const char *recordops = NULL; FILE * fsxlogf = NULL; FILE * replayopsf = NULL; char opsfile[1024]; @@ -1677,6 +1678,8 @@ usage(void) -W: mapped write operations DISabled\n\ -R: read() system calls only (mapped reads disabled)\n\ -Z: O_DIRECT (use -R, -W, -r and -w too)\n\ + --replay-ops opsfile: replay ops from recorded .fsxops file\n\ + --record-ops[=opsfile]: dump ops file also on success. optionally specify ops file name\n\ fname: this filename is REQUIRED (no default)\n"); exit(90); } @@ -1845,6 +1848,7 @@ __test_fallocate(int mode, const char *mode_str) static struct option longopts[] = { {"replay-ops", required_argument, 0, 256}, + {"record-ops", optional_argument, 0, 255}, { } }; @@ -2034,6 +2038,11 @@ main(int argc, char **argv) case 'Z': o_direct = O_DIRECT; break; + case 255: /* --record-ops */ + if (optarg) + strncpy(opsfile, optarg, sizeof(opsfile)); + recordops = opsfile; + break; case 256: /* --replay-ops */ replayops = optarg; break; @@ -2113,8 +2122,10 @@ main(int argc, char **argv) prterr(logfile); exit(93); } - strncat(opsfile, dirpath ? bname : fname, 256); - strcat(opsfile, ".fsxops"); + if (!*opsfile) { + strncat(opsfile, dirpath ? bname : fname, 256); + strcat(opsfile, ".fsxops"); + } unlink(opsfile); if (replayops) { @@ -2195,6 +2206,8 @@ main(int argc, char **argv) report_failure(99); } prt("All %lu operations completed A-OK!\n", testcalls); + if (recordops) + logdump(); exit(0); return 0;