From patchwork Tue Sep 5 19:11:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9939513 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 D187860350 for ; Tue, 5 Sep 2017 19:11:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3289289EB for ; Tue, 5 Sep 2017 19:11:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8426289F2; Tue, 5 Sep 2017 19:11:00 +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 70023289FF for ; Tue, 5 Sep 2017 19:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752297AbdIETK7 (ORCPT ); Tue, 5 Sep 2017 15:10:59 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37084 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752119AbdIETKz (ORCPT ); Tue, 5 Sep 2017 15:10:55 -0400 Received: by mail-wr0-f194.google.com with SMTP id y15so2137489wrc.4; Tue, 05 Sep 2017 12:10:54 -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=GFVlkYwk54sqqlAqvfU7+huLEe7Dt67+7vUvpEWEaSE=; b=mEJDL5edh9VkntxVG1VNGkbg6/VqyjXFUrkuzZnkC44VRE6/quajRFDYHSG4X8raMQ P4yd8txes9g8UvGVXv91ExTSb9GQ5DVhP6yNss2sobFufp9prH7cJG4XyQmfWqpTbik9 iEWHtQRfPw+jL2J7cW4MY9CgsCnm+7e3Y2KpeFG7aZm/Z8TN34DUSDeULEtWCzBj+bao vXvioXOCoa5x8+97cqKRK1m0izpV+ymE5u0NkkIJt5GRsSYWGLpwAgwOBfTRcJNlrNnX SQkvvP86SgRqdYaRcL8xOhyh+YKIOIAOKZsO0ZWcsICdVjDp1Gav06YM90w40+7ziINc VYdg== 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=GFVlkYwk54sqqlAqvfU7+huLEe7Dt67+7vUvpEWEaSE=; b=tjnznI5X6wl5Kpy57laRmz+bk5PB8zoqrLEMIGBtbeXSdPj/wsaFCg+2YWezVBihs2 cBlMMeC6R3kIyWux+0yXTSqUfEenuFOshg5hJIMfPshfP+1wa0CDrmC5PA6fk3auHM7z dvTgwLriYCsD4AoyVQwLBuHETWwD0vyqMRKb5/0yT0QwM76qCk4o+rQ+02qYkeHUS18j 1CE/xpr0xRFxu15A2Z2vZs7SFdlIu+PYw4MOM6FkvWGSvyDIzCue8CYxoB8alUMO21DZ N57TbzUmcz0+IgCBlAqum7tBlqPPKwXyfL+FXRuqYWaeCLdM0MRJ25io5LIEhGKVedcU DypA== X-Gm-Message-State: AHPjjUj7m1jhkB7qNsAJIQJhsWUNhIijzviVEOZKnI7o6zqQv4PFlNI3 IIZEZfoISonNvQ== X-Google-Smtp-Source: ADKCNb7N3KBmYoxcM/Hg5sGc5SZ4Wb2Bypvp7GaFoAyWd9eP3duP/D1QTIazD5pGm4kX/96VMGMItQ== X-Received: by 10.223.152.132 with SMTP id w4mr53849wrb.264.1504638654364; Tue, 05 Sep 2017 12:10:54 -0700 (PDT) Received: from localhost.localdomain (bzq-79-182-137-119.red.bezeqint.net. [79.182.137.119]) by smtp.gmail.com with ESMTPSA id 30sm1829015wry.34.2017.09.05.12.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 12:10:53 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Josef Bacik , fstests@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 03/13] fsx: add support for recording operations to a file Date: Tue, 5 Sep 2017 22:11:10 +0300 Message-Id: <1504638680-25682-4-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504638680-25682-1-git-send-email-amir73il@gmail.com> References: <1504638680-25682-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 16684cc..85fd50a 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;