From: Lars Schneider Date: Wed, 27 Jul 2016 16:50:40 GMT Subject: Re: [PATCH v2 4/5] convert: generate large test files only once Message-ID: <1D133FC4-032F-434A-882C-5931AA285CD9@gmail.com> In-Reply-To: <20160727133214.GA14928@sigill.intra.peff.net> > On 27 Jul 2016, at 15:32, Jeff King wrote: > > On Wed, Jul 27, 2016 at 04:35:32AM +0200, Torsten Bögershausen wrote: > >>> + mkdir -p generated-test-data && >>> + for i in $(test_seq 1 $T0021_LARGE_FILE_SIZE) >>> + do >>> + # Generate 1MB of empty data and 100 bytes of random characters >>> + printf "%1048576d" 1 >>> + printf "$(LC_ALL=C tr -dc "A-Za-z0-9" >8)) count=1 2>/dev/null)" >> I'm not sure how portable /dev/urandom is. >> The other thing, that "really random" numbers are an overkill, and >> it may be easier to use pre-defined numbers, > > Right, there are a few reasons not to use /dev/urandom: > > - it's not portable > > - if we have to generate a lot of numbers, it drains the system's > entropy pool, which is an unfriendly thing to do (and may also be > slow) > > - it makes our tests random! This sounds like a good thing, but it > means that if some input happens to cause failure, you are unlikely > to be able to reproduce it. > > Instead, use test-genrandom, which is an LCG that starts at a seed. So > you get a large amount of random-ish quickly and portably, and you get > the same data each time. Thank you! That's exactly what I need here :-) - Lars