From owner-freebsd-current@freebsd.org Fri Jul 5 21:37:26 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 D3CF015D536C for ; Fri, 5 Jul 2019 21:37:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660048.outbound.protection.outlook.com [40.107.66.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 983BE8B079; Fri, 5 Jul 2019 21:37:24 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM (10.165.219.7) by YTXPR01MB0288.CANPRD01.PROD.OUTLOOK.COM (10.165.219.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Fri, 5 Jul 2019 21:37:22 +0000 Received: from YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM ([fe80::9cc8:c3b7:19c2:7baf]) by YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM ([fe80::9cc8:c3b7:19c2:7baf%4]) with mapi id 15.20.2032.022; Fri, 5 Jul 2019 21:37:22 +0000 From: Rick Macklem To: Alan Somers CC: "freebsd-current@FreeBSD.org" , "kib@freebsd.org" Subject: Re: test program for copy_file_range(2) Thread-Topic: test program for copy_file_range(2) Thread-Index: AQHVMskgzujQNZ0SzEiZ5jXklpLAx6a8FweAgAAJc4iAAAiagIAAYYWb Date: Fri, 5 Jul 2019 21:37:22 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4c3219ff-f19c-4d54-fc1c-08d70190f70c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:YTXPR01MB0288; x-ms-traffictypediagnostic: YTXPR01MB0288: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 008960E8EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(346002)(39860400002)(376002)(189003)(199004)(68736007)(52536014)(91956017)(66946007)(76116006)(74316002)(33656002)(305945005)(66476007)(64756008)(11346002)(446003)(66446008)(478600001)(2906002)(66556008)(486006)(5660300002)(25786009)(450100002)(476003)(86362001)(73956011)(229853002)(46003)(53936002)(81156014)(14454004)(9686003)(6246003)(6436002)(256004)(186003)(76176011)(74482002)(5024004)(102836004)(316002)(54906003)(4326008)(8936002)(99286004)(55016002)(71190400001)(14444005)(71200400001)(8676002)(6916009)(6506007)(81166006)(786003)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0288; H:YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /TA4ZjxCv//ZSNL4+814sBsTOYsxETa/4JSLYpNmhvGS1sqqoCIeU60PfvOMuyBwzZeTsEtFXmh/4oR3kLzSZ8i6LTfK7cX0Pml0ihVvJMofmCddAafw6VGmDklTWifw+AhFhvw3PdL6I/Z88MY8DC3AkHlnPK3JnN48/dSE1IV8mmu4Vdx4r7zBH/rmAEAOTs2Xn6q8ju5vrz6ocViDtbxWBCyXyxn9xU8pka9YoUe4gm69sW7m4Si0M1UBCsuaKmSv1Y8bQJmLHxfH4w/h1UYCxpoXwimV1q3Ifoy9UY1pyH3kkcx8YjvXmmXhqFBrUOXQE9YUz+S16I8WjY2+P5jUEbu4RWEK36X+IOfvmaV7f+XZwHN1vcSfYNZErGcwyzCvkvznuPatMDBEfkHYdJYuT2OoaxELGUFO+eXBYnM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 4c3219ff-f19c-4d54-fc1c-08d70190f70c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2019 21:37:22.6575 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rmacklem@uoguelph.ca X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR01MB0288 X-Rspamd-Queue-Id: 983BE8B079 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.66.48 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-3.84 / 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:40.107.0.0/16]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.03)[ipnet: 40.64.0.0/10(-2.89), asn: 8075(-2.19), country: US(-0.06)]; MX_GOOD(-0.01)[cached: mx2.hc184-76.ca.iphmx.com]; NEURAL_HAM_SHORT(-0.50)[-0.504,0]; RCVD_IN_DNSWL_NONE(0.00)[48.66.107.40.list.dnswl.org : 127.0.3.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; RCVD_TLS_LAST(0.00)[] 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 21:37:26 -0000 Alan Somers wrote: >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 wrot= e: >> >> >> >> 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 inter= ested.) >> >> >> >> 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 a= s different byte >> >> ranges get copied, since "punching holes" is done via writes of 0 byt= es.) >> >> >> >> 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 i= f >> >> 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. I= f 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 w= ould 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). Good points. Now, I'm about as far from an expert on testing as they come, = but the problem in this case is that I have already written the code to handle = the edge cases I recognized. (Ideally the guy who writes the test program isn't= the guy who wrote the code, but...) By doing the "random" stuff, I am hoping to catch cases that I hadn't antic= ipated. (I put the "random" in quotes, since I use random(3) without seeding it, so= I actually get the same reproducible results.) I crank the # of cycles up so that it runs for hours/days/weeks. I do agree I should add some specific edge cases (which I have already chec= ked) to the test program. rick