Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1012452ybp; Thu, 17 Oct 2019 06:52:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjpMow5q98rNG+SaH3TP1l+zsI5B8e/qTmZq82SQfAhOo5swCxAgEf/fIGVSkGZE7KNts5 X-Received: by 2002:a17:906:1c87:: with SMTP id g7mr3617027ejh.189.1571320320891; Thu, 17 Oct 2019 06:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571320320; cv=none; d=google.com; s=arc-20160816; b=fVGSgX79xnPnBeoZcNDVLRMq3SF/aas1fwS5pRwkPuLMMYbojOqJ5NZzYdBlitkGZH +MLJchdlXT1uPn2eQKVBOm6ODlW7KBOc+lWkgPuPtX98mrSOm9NE8Ws0zYbxgwZzgcJv F8kEnit1k+uS5mW+YWgL5r6nac1Y4Y7pwbqDhSr43LRvcn2K75j4S+jr6+i2QEwqd98h VuX1tMpyTEALPuqqlBvmLYsGoI5zeaWl+PxMHMkt51X8v3sv8RC783oVEvuKHVwgNBcN 6eHQfCNNb2M35UHXUixwJxruP+GljsAzFZf5vg4v15bxLzgfC5R8k+a4nmYmQXraL6ZF d80Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=k203mYRk3o9LC/V1tcpExg7VLq73MMzCZRjo2DKcdiE=; b=JPlZ18mKG/GfJO/ZAHDY3trs6gt92KMHWjiwgnahsf9fM4gqUp4TAZbSLVJoR6MHgF 0OSNr8Mx7otnw6wqg5KJdRz17Ioce2Fbh9ZTyFX6EYSMLnLOCCNR9AZzFj1+yD9h8az+ 66whK9ivBUha4evktGC0E/BMT7xhHGv3BNyeZusN7cXKkw8LAUl1SQoPqxJjVLtv9dev CcayHjQCasOr2ZTjE0H49SJqjK4FUVd8mbRchNqP2Kk6JbCBcylQJRoioRYjJajBfUEp qe7p+I5nOLZsSRyC5EfMsULRmQ8x4XpMDWMxAhSSAiB4JpUH3b0wd7tjtwouoDZ63tiI amPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j8P+QRwl; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si1897106eda.144.2019.10.17.06.51.36; Thu, 17 Oct 2019 06:52:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j8P+QRwl; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403847AbfJPU7L (ORCPT + 99 others); Wed, 16 Oct 2019 16:59:11 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35653 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbfJPU7K (ORCPT ); Wed, 16 Oct 2019 16:59:10 -0400 Received: by mail-qt1-f194.google.com with SMTP id m15so196528qtq.2 for ; Wed, 16 Oct 2019 13:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k203mYRk3o9LC/V1tcpExg7VLq73MMzCZRjo2DKcdiE=; b=j8P+QRwlhgCn/rBxDc9fRjmj0qi32inxvje1T+yV3nFnRFUMVoQxiMnXKI+KB4qQm8 YUxzfQh1VNL86OJW8i5uJFf8sJOt8+2FHrMb1sRyhuzuW7Jau3wYnC/gSPjEOaV4A4f8 PvVKyp+0cyeG8Ko+mt1bcKgek8le9I4//k/FjBLc30KKSPUNmB9Hgme6l/bBduRjm73o CocIPvaON9MMjWAfPtwVenpzJ8JfrCOKNAU4YHgxwWsMto1Vg3RGXkhkrnjm+1xP+LGN Aslub47mNck2NNtg2Ecd012oVfYvR1JgQFktx640Iz0dU+rQPeh+LfJq1vSn5QU3y14s JO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k203mYRk3o9LC/V1tcpExg7VLq73MMzCZRjo2DKcdiE=; b=hIhw/QXjNTZZaHLJq6/U7JMqQpYM7MvmrDvunS+3Q9ZLUHMcTzUfBymPMasJYOEdkm WtcgqFwCdO5SpRPaX0Nc1dWIjXVWQQkIjnblfQMnr/J/B+Gb7EXvrDBNRHTfKNXofnhs m6wdONt8ylASKJHepMbYW2DestR8I+vBG6/deJ/gZH0cBK4PFrwXc3Sb7T1mC7my+EmB BC9s/052h7mnVg+295gjSISihVmBHTui9K8t3tN3KdbhBXXVjEnopqRmfLIAhKYaFlbp lW98jrYiq9KbIsZHlJBUhF7xZMRkmO9hqZEZ2MKObyNzBX/x98jbO4uHX8rLB6bsSRaW Jlzw== X-Gm-Message-State: APjAAAUxnf6Mg7Yyg8BkQLuXh7v7UwgzkMXMxBDMCwtsEacuoIxhBHjm lltBy9Q+gUb2N5J3YWkjR3r7UFwrTfmlDBPB+fDO X-Received: by 2002:ac8:610e:: with SMTP id a14mr25734qtm.189.1571259549648; Wed, 16 Oct 2019 13:59:09 -0700 (PDT) MIME-Version: 1.0 References: <20191012023757.172770-1-yzaikin@google.com> <20191016200304.GA49718@google.com> In-Reply-To: <20191016200304.GA49718@google.com> From: Iurii Zaikin Date: Wed, 16 Oct 2019 13:58:33 -0700 Message-ID: Subject: Re: [PATCH linux-kselftest/test v4] ext4: add kunit test for decoding extended timestamps To: Brendan Higgins Cc: "open list:KERNEL SELFTEST FRAMEWORK" , linux-ext4@vger.kernel.org, Shuah Khan , "Theodore Ts'o" , adilger.kernel@dilger.ca, "Bird, Timothy" , kunit-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Oct 16, 2019 at 1:03 PM Brendan Higgins wrote: > > On Fri, Oct 11, 2019 at 07:37:57PM -0700, Iurii Zaikin wrote: > > KUnit tests for decoding extended 64 bit timestamps > > that verify the seconds part of [a/c/m] > > timestamps in ext4 inode structs are decoded correctly. > > KUnit tests, which run on boot and output > > the results to the debug log in TAP format (http://testanything.org/). > > are only useful for kernel devs running KUnit test harness. Not for > > inclusion into a production build. > > Test data is derive from the table under > nit: ^ > Should be: derived from ... > Oops. Done. > > Documentation/filesystems/ext4/inodes.rst Inode Timestamps. > > > > Signed-off-by: Iurii Zaikin > > Reviewed-by: Brendan Higgins > Tested-by: Brendan Higgins > > > --- > > fs/ext4/Kconfig | 14 +++ > > fs/ext4/Makefile | 1 + > > fs/ext4/inode-test.c | 239 +++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 254 insertions(+) > > create mode 100644 fs/ext4/inode-test.c > > > [...] > > diff --git a/fs/ext4/inode-test.c b/fs/ext4/inode-test.c > > new file mode 100644 > > index 000000000000..3b3a453ff382 > > --- /dev/null > > +++ b/fs/ext4/inode-test.c > > @@ -0,0 +1,239 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * KUnit test of ext4 inode that verify the seconds part of [a/c/m] > > + * timestamps in ext4 inode structs are decoded correctly. > > + */ > > + > > +#include > > +#include > > +#include > > + > > +#include "ext4.h" > > + > > +/* binary: 00000000 00000000 00000000 00000000 */ > > +#define LOWER_MSB_0 0L > > +/* binary: 01111111 11111111 11111111 11111111 */ > > +#define UPPER_MSB_0 0x7fffffffL > > +/* binary: 10000000 00000000 00000000 00000000 */ > > +#define LOWER_MSB_1 (-0x80000000L) > > +/* binary: 11111111 11111111 11111111 11111111 */ > > +#define UPPER_MSB_1 (-1L) > > +/* binary: 00111111 11111111 11111111 11111111 */ > > +#define MAX_NANOSECONDS ((1L << 30) - 1) > > + > > +#define CASE_NAME_FORMAT "%s: msb:%x lower_bound:%x extra_bits: %x" > > + > > +struct timestamp_expectation { > > + const char *test_case_name; > > + struct timespec64 expected; > > + u32 extra_bits; > > + bool msb_set; > > + bool lower_bound; > > +}; > > + > > +static time64_t get_32bit_time(const struct timestamp_expectation * const test) > > +{ > > + if (test->msb_set) { > > + if (test->lower_bound) > > + return LOWER_MSB_1; > > + > > + return UPPER_MSB_1; > > + } > > + > > + if (test->lower_bound) > > + return LOWER_MSB_0; > > + return UPPER_MSB_0; > > +} > > + > > + > > +/* > > + * These tests are derived from the table under > > + * Documentation/filesystems/ext4/inodes.rst Inode Timestamps > > + */ > > +static void inode_test_xtimestamp_decoding(struct kunit *test) > > +{ > > + const struct timestamp_expectation test_data[] = { > > + { > > + .test_case_name = > > + "1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits.", > > nit: Maybe drop the period at the end (here and elsewhere)? Otherwise if > the test fails you have a period right next to a colon and it looks a > bit off. > Done > > + .msb_set = true, > > + .lower_bound = true, > > + .extra_bits = 0, > > + .expected = {.tv_sec = -0x80000000LL, .tv_nsec = 0L}, > > + }, > > Feel free to ignore my nits if you don't need to send another version. > Also note that Ted has given a Reviewed-by on an earlier revision. > > Thanks!