Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3280724ybt; Sat, 4 Jul 2020 11:39:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM04jLLarlLazyCtHTe13iULWw9chaAPtj15SWBotW2pNCxy9CA14mkht4PKSV5UO4qVcd X-Received: by 2002:a05:6402:1777:: with SMTP id da23mr46198917edb.260.1593887949922; Sat, 04 Jul 2020 11:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593887949; cv=none; d=google.com; s=arc-20160816; b=ShO8o+6edzl1At2bxsQ3nqISuUiwgT1oCtC5lmiheL0VTZJaa6szitI33RVRBF4jWI lZP5aHH+41NlJm2FIEsyrC7SmE85vKLUgeteC+hzYocu7pBzTr6NJC1q+tmmLLiNoFH5 xpIrcQCoAZQ6OqJetOmqPbqsvR+DX58qDYk8fBim56KyTKaF+6H8+imH4oE1vi8toQ0h YzcJvSDY2qS5FJP6JLYH+hMiKGFSTa83fIzMCFlRVeaTzy0FtJsjh8P3SeESn5/QrqLE XFcMIkZ80oswWu+d6siO+Yp+CQoP3+LZJ468TUj3fkPz2XFyTSGSk2LcrjuouDp9EHTn pw2g== 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; bh=DfjUpuKXHj7Ihv4sk2DDkgXbkuhS8XCG6LKodnrJh+c=; b=nq8zj4LrDZf4NgwVO77isc9aB2YbbK0XiJhT6i9N3h53mrFLC/Pss/pJn2+edkv7kH y/2/7Qdu1fr4WyuyKvN/XVry8mX98ACsRliRSks0VhTLu6MnrQUegbW2KiPx56cY+E+F 6IYIxNUQyRqAxRJUiUR5CVkAy65gNWCo1rYnSPGhRsC4lgeRmRo2MQvJ0CekMW6v3qox W5CfUaK//WjUHO2i1Swrof8m1y8VurS26Ox8vv6POQJOlc8bkUyGgF223dDc6utkB069 xKucpMeJgKYgrfxirH9s9q4ueNrnEkENsg232gMY5ZpahBWm5/91aRX8iJdMdSl+AlO2 Bi1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si9466725eju.78.2020.07.04.11.38.46; Sat, 04 Jul 2020 11:39:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbgGDSii (ORCPT + 99 others); Sat, 4 Jul 2020 14:38:38 -0400 Received: from mail-oo1-f66.google.com ([209.85.161.66]:33260 "EHLO mail-oo1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgGDSih (ORCPT ); Sat, 4 Jul 2020 14:38:37 -0400 Received: by mail-oo1-f66.google.com with SMTP id d125so3237499oob.0; Sat, 04 Jul 2020 11:38:37 -0700 (PDT) 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=DfjUpuKXHj7Ihv4sk2DDkgXbkuhS8XCG6LKodnrJh+c=; b=JECf44xHCIihKYBcPeNL0ar5fG6lddhDEiZ5nhZSa6Awvav4fHs1/ZMbVaOAnSeWEz 1ldzVZyq9x7hOxqMpuJRgVfQap7Kg25yYpWf0vzd8+Nphkf3CT8Mioy7MAbc5vRadSYm qvCBv7aKKcRd7/rt0l7+EnkG2AavPSgEVOibhYUGcCNq8I/cn9RCPQtP19nHzQe61AxU rbiDzWFKpjt6//Iha3J5kzjRgHQteaBUdCm5TVd0UTryKkEafkyzeDMt7uIV5SPRX3u5 APwuoq9KPoWsSYEu+/TJ5hM3xgsqw8n+H3naNlOhtawbSGKSkZ9BcSGPUSK/Di4spUu7 nXBA== X-Gm-Message-State: AOAM530qpZwiofwejZNy/D/20Cn8ODJFF/sxyjb9IrV5tHwre4g3dj3j UT2lZa0yxnTLY4M4vuwn+1vv6jfkChF15Co55Y0= X-Received: by 2002:a4a:5744:: with SMTP id u65mr36264557ooa.1.1593887917099; Sat, 04 Jul 2020 11:38:37 -0700 (PDT) MIME-Version: 1.0 References: <20200704140250.423345-1-gregkh@linuxfoundation.org> <20200704140250.423345-4-gregkh@linuxfoundation.org> In-Reply-To: <20200704140250.423345-4-gregkh@linuxfoundation.org> From: Geert Uytterhoeven Date: Sat, 4 Jul 2020 20:38:26 +0200 Message-ID: Subject: Re: [PATCH 3/3] selftests: add readfile(2) selftests To: Greg Kroah-Hartman Cc: Al Viro , "Michael Kerrisk (man-pages)" , Shuah Khan , Linux API , Linux FS Devel , Linux Kernel Mailing List , linux-man@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Sat, Jul 4, 2020 at 4:05 PM Greg Kroah-Hartman wrote: > Test the functionality of readfile(2) in various ways. > > Also provide a simple speed test program to benchmark using readfile() > instead of using open()/read()/close(). > > Signed-off-by: Greg Kroah-Hartman Any benchmark results to share? > --- /dev/null > +++ b/tools/testing/selftests/readfile/readfile.c > +static void readfile(const char *filename) > +{ > +// int root_fd; ??? > + unsigned char buffer[16000]; > + int retval; > + > + memset(buffer, 0x00, sizeof(buffer)); > + > +// root_fd = open("/", O_DIRECTORY); > +// if (root_fd == -1) > +// ksft_exit_fail_msg("error with root_fd\n"); ??? > + > + retval = sys_readfile(root_fd, filename, &buffer[0], sizeof(buffer), 0); > + > +// close(root_fd); > + > + if (retval <= 0) > + ksft_test_result_fail("readfile() test of filename=%s failed with retval %d\n", > + filename, retval); > + else > + ksft_test_result_pass("readfile() test of filename=%s succeeded with retval=%d\n", > + filename, retval); > +// buffer='%s'\n", > +// filename, retval, &buffer[0]); > + > +} > + > + > +int main(int argc, char *argv[]) > +{ > + ksft_print_header(); > + ksft_set_plan(10); > + > + test_readfile_supported(); // 1 test > + > + test_sysfs_files(); // 1 test > + > + test_filesizes(); // 6 tests > + > + setup_tmpdir(); > + > + readfile(TEST_FILE1); > + readfile(TEST_FILE2); > +// readfile(TEST_FILE4); ??? > + > + teardown_tmpdir(); > + > + if (ksft_get_fail_cnt()) > + return ksft_exit_fail(); > + > + return ksft_exit_pass(); > +} Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds