From owner-freebsd-current@freebsd.org Fri Jul 5 15:43:52 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D762815CE217 for ; Fri, 5 Jul 2019 15:43:51 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC841752AE; Fri, 5 Jul 2019 15:43:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f171.google.com with SMTP id z28so760884ljn.4; Fri, 05 Jul 2019 08:43:50 -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=GWF1IdI4lbevLLEIVgF4lUs34/f6UIUmdabSZ2svUDM=; b=s76PN+YJYyhxDWU7kGiBdtacGcodVT7pM63IDTNqzVQ023eOoZjCO6PoCr92NbhlrC b6+ANvvWb3qTjyP9Yh43Y0ybtVQTHchQyiddF1VLRUSRxJqx2JOZLBrWpExYPMt24948 ZzFkNiirIUDg1FFZt8Z8/FCxhFTEEfXih3/pcdVQrYR3yzQmCyO8wo8LhYJnmEaUNnqz 6333SKpf1/qnVjc/I1wEMsR57ZCrxM2YONVe2Fqhkc6VqVipTuHnHK/Vv+UduZ400anl /QMYqKyYmrDgjysiH3pfEo8zJVo3elEzvHjpH9gxw62iBVz551bh8mD5fsRVg2kdJw8Z LGRA== X-Gm-Message-State: APjAAAUQTxoGOf4CczJ051X4JnhBNWJs9ZCWedrC3JVWxha4KhaTDF6w vehClhwyQwoa9OZktYGb1JgfjcWXvDs63nAQpLY= X-Google-Smtp-Source: APXvYqzZlV++w63QiqTxguuV0QArsxjZ8MW2hubv6OfLLBKPHJhaji82clRNH8T9oDCaNJqG7afiHX7FM46M0PuTRdU= X-Received: by 2002:a2e:1290:: with SMTP id 16mr2447785ljs.88.1562340963587; Fri, 05 Jul 2019 08:36:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alan Somers Date: Fri, 5 Jul 2019 09:35:51 -0600 Message-ID: Subject: Re: test program for copy_file_range(2) To: Rick Macklem Cc: "freebsd-current@FreeBSD.org" , "kib@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: CC841752AE X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.208.171 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-3.56 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.26)[-0.262,0]; RCVD_IN_DNSWL_NONE(0.00)[171.208.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.29)[ip: (-0.53), ipnet: 209.85.128.0/17(-3.46), asn: 15169(-2.40), country: US(-0.06)]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2019 15:43:52 -0000 On Fri, Jul 5, 2019 at 9:11 AM Rick Macklem wrote: > > Alan Somers wrote: > >On Thu, Jul 4, 2019 at 6:38 PM Rick Macklem wrote: > >> > >> I have a little program for testing the copy_file_range(2) syscall I've been > >> working on. (The current version is attached, in case anyone is interested.) > >> > >> It take a few minutes to run on a slow system and uses about 6Gbytes of disk > >> space for the file system the output file is on. (It creates 2 files to use for testing. > >> The first one is sparse and the second is copied from it, but grows as different byte > >> ranges get copied, since "punching holes" is done via writes of 0 bytes.) > >> > >> My question is.. > >> What needs to be done to include this in FreeBSD? > >> I see some stuff under head/tests. I could probably figure out > >> what the macros in those files are, but I can only see tests to see if > >> arguments are valid and similar. As such, I'm not sure if this is the correct > >> place for a test like this? > >> > >> Thanks for any help with this, rick > > > >head/tests is for complete automated tests, mostly in ATF format. > >Your program sounds more like the kind of helper program that might be > >more suitable for head/tools/regression. Those programs all require > >some operator interaction. If you can automate your program then we > >should add it to head/tests/sys. Does it really need 6GB to get > >decent test coverage? > Well, I wanted the input file to exceed 4Gb and to have a > 4Gb hole in it, to catch > 32bit bugs (I test on i386). This did catch some problems during testing. > > Then, the program copies (random) ranges of the file to a second file. If the random > copy is done over the "big hole" for the case where it hasn't truncated the output > file (every second iteration), then it writes a "lot of 0s", growing the output file > up to 6Gb of data. > > I could limit the "random" ranges to not copy the "big hole", but that would avoid > testing that case. > > rick random ranges are another problem. Automated tests shouldn't use random behavior, because then failures won't be reproducible. It's best to test a set of hand selected edge cases. If you're going to test random ranges too, then the program should use a user-selectable random seed (perhaps seeding from the timer if the user doesn't specify a seed, and printing the seed that was chosen). -Alan