From patchwork Wed Oct 10 23:34:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 982144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GKXP2pVT"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Vr7B5S3Lz9s3l for ; Thu, 11 Oct 2018 10:35:18 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4694C3E70D2 for ; Thu, 11 Oct 2018 01:35:16 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 304093E708A for ; Thu, 11 Oct 2018 01:34:54 +0200 (CEST) Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id A5FC8600704 for ; Thu, 11 Oct 2018 01:34:53 +0200 (CEST) Received: by mail-wm1-x343.google.com with SMTP id 189-v6so7142458wmw.2 for ; Wed, 10 Oct 2018 16:34:53 -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=C13AiG3HS0KXQvkRrgcd24JHcNbH3rjSJLiutVIPscE=; b=GKXP2pVT4nnD2jr74Jizetx8tBpcEwdSALviCWqdxZyQsKTDcxxwmlxCJtdC+WGSIG /N66xti15d7DyhOWzPZ1ix3bz6sGsJC1Iao8W8uNLSdpvbQ+rbO17iFtbBI2X6YBld2c ur/Jc5mE+CaiC3JgDNqyrQVKCnubEk4H3W6sI5CvR2uonTkl17pHP0gwOdywsTxPrWrx fgAM6fPhn4ULb3Ab2T9WnkzrGVYSb1+yE0EO98vh6auf1FoxEUPzSRr2dMwpB3ZdpkCz CUSIKeuVxc0yrGyXq5eQunFUcqJsqF/2qTStjhwSx1EHewD2TNxF5GqZus8WybuU3BXV pi6Q== 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=C13AiG3HS0KXQvkRrgcd24JHcNbH3rjSJLiutVIPscE=; b=t6DRQZ6iT1TK1CcZ7anE0dkM3ZXBw+64Q0siOgq66ULhJ+nnrMBYjJVSp8ZjpCe+3a zbD6IAb+czu+1ne05TJfTx+yt5AUsq11iWpAt12t7r/9ks0a3yD2Z/075TEO1NeSbddn RLmLJghVPgziqcW3XSWNfopB9aBZ+53rQccsykaPcdXQ+CPvWb2ave91IChHCuMzWNC9 oQvLA7sL7rZ57OLaaA5PnnWVZupXDRFVVFxcds23oNuWkppSLupPSkAnn3Wyo6CshzR5 n0VtJjFF975JkPdZ34gCGRkPZfTV+IWtINN7YRgcjugdNRDku3Z0vLbqZhmCAV1jN9UB Zdiw== X-Gm-Message-State: ABuFfogQpTPlnNh8g3KYyYkRJGtanir/6HzCB//gqU47KbHRqvFybcNJ 3PhzXWmKK1CXGPjBx+HypeZznrw2 X-Google-Smtp-Source: ACcGV63kaWmY9DdBXiqnoTvHgsLUrGGWe3vGt/Kp20AhUmGRyvO7841tQN8NX0M1ifYu8gZXL3KmMw== X-Received: by 2002:a1c:288a:: with SMTP id o132-v6mr2328292wmo.28.1539214493271; Wed, 10 Oct 2018 16:34:53 -0700 (PDT) Received: from localhost.localdomain ([141.226.14.107]) by smtp.gmail.com with ESMTPSA id h2-v6sm21768484wrs.34.2018.10.10.16.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Oct 2018 16:34:52 -0700 (PDT) From: Amir Goldstein To: Cyril Hrubis Date: Thu, 11 Oct 2018 02:34:38 +0300 Message-Id: <20181010233441.5337-4-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181010233441.5337-1-amir73il@gmail.com> References: <20181010233441.5337-1-amir73il@gmail.com> X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Cc: linux-unionfs@vger.kernel.org, ltp@lists.linux.it, Miklos Szeredi Subject: [LTP] [PATCH v3 3/6] syscalls/readahead02: abort test if readahead syscall fails X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" There is no reason to continue the test if readahead syscall fails and we can also check and report TCONF if filesystem does not support readahead. Signed-off-by: Amir Goldstein --- .../kernel/syscalls/readahead/readahead02.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c index c739d3ba2..f77e7c66c 100644 --- a/testcases/kernel/syscalls/readahead/readahead02.c +++ b/testcases/kernel/syscalls/readahead/readahead02.c @@ -45,16 +45,17 @@ static struct tst_option options[] = { {NULL, NULL, NULL} }; -static int check_ret(long expected_ret) +static int check_ret(void) { - if (expected_ret == TST_RET) { - tst_res(TPASS, "expected ret success - " - "returned value = %ld", TST_RET); + if (TST_RET == 0) return 0; + if (TST_ERR == EINVAL) { + tst_res(TCONF, "readahead not supported on %s", + tst_device->fs_type); + } else { + tst_res(TFAIL | TTERRNO, "readahead failed on %s", + tst_device->fs_type); } - tst_res(TFAIL | TTERRNO, "unexpected failure - " - "returned value = %ld, expected: %ld", - TST_RET, expected_ret); return 1; } @@ -163,8 +164,8 @@ static void read_testfile(int do_readahead, const char *fname, size_t fsize, do { TEST(readahead(fd, offset, fsize - offset)); if (TST_RET != 0) { - check_ret(0); - break; + SAFE_CLOSE(fd); + return; } /* estimate max readahead size based on first call */ @@ -252,6 +253,8 @@ static void test_readahead(void) tst_res(TINFO, "read_testfile(1)"); read_testfile(1, testfile, testfile_size, &read_bytes_ra, &usec_ra, &cached_ra); + if (check_ret()) + return; if (cached_ra > cached_low) cached_ra = cached_ra - cached_low; else