From owner-svn-src-projects@freebsd.org Thu Feb 22 22:24:02 2018 Return-Path: Delivered-To: svn-src-projects@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 689B8F06C26 for ; Thu, 22 Feb 2018 22:24:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE5F7C503; Thu, 22 Feb 2018 22:24:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A8D75EA4; Thu, 22 Feb 2018 22:24:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MMO1bL081315; Thu, 22 Feb 2018 22:24:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MMO1fl081314; Thu, 22 Feb 2018 22:24:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201802222224.w1MMO1fl081314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 22 Feb 2018 22:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r329840 - projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity X-SVN-Commit-Revision: 329840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 22:24:02 -0000 Author: asomers Date: Thu Feb 22 22:24:01 2018 New Revision: 329840 URL: https://svnweb.freebsd.org/changeset/base/329840 Log: apply PEP8 style to a python helper script Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/make_patterns.py Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/make_patterns.py ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/make_patterns.py Thu Feb 22 21:41:58 2018 (r329839) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/txg_integrity/make_patterns.py Thu Feb 22 22:24:01 2018 (r329840) @@ -1,51 +1,57 @@ #! /usr/bin/env python # Generate random IO patterns for the txg_integrity test -# We do this statically and embed the results into the code so that the +# We do this statically and embed the results into the code so that the # Testing will be more repeatable compared to generating the tables at runtime import random CLUSTERSIZE = (1 << 16) -NUM_CHUNKS = 64 +NUM_CHUNKS = 64 def rand_partition(): - partitions = [] - while len(partitions) != NUM_CHUNKS: - #We don't want any duplicates, so we make a set and then check that its - #length is correct - partitions = sorted( - list( - set( - [random.randrange(0, 2**31, (2**31) * 8 / (NUM_CHUNKS * CLUSTERSIZE)) - for i in range(NUM_CHUNKS - 1)] + [2**31]))) - return partitions + partitions = [] + while len(partitions) != NUM_CHUNKS: + # We don't want any duplicates, so we make a set and then check that + # its length is correct + partitions = sorted( + list( + set( + [random.randrange(0, + 2**31, + (2**31) * 8 / (NUM_CHUNKS * CLUSTERSIZE)) + for i in range(NUM_CHUNKS - 1)] + [2**31]))) + return partitions + def rand_permutation(): - perm = range(NUM_CHUNKS) - random.shuffle(perm) - return perm + perm = range(NUM_CHUNKS) + random.shuffle(perm) + return perm + def rand_follower_bitmap(): - bmp = 0; - chunks = random.sample(range(NUM_CHUNKS), NUM_CHUNKS / 2) - for chunk in chunks: - bmp |= (1 << chunk) - return bmp + bmp = 0 + chunks = random.sample(range(NUM_CHUNKS), NUM_CHUNKS / 2) + for chunk in chunks: + bmp |= (1 << chunk) + return bmp + def print_pattern(n): - print "const pattern_t pat%d = {" % n - print " {", - for p in rand_partition(): - print "%#x, " % p, - print " }," - print " {", - for p in rand_permutation(): - print "%d, " % p, - print " }," - print " %#x" % rand_follower_bitmap() - print "};" + print "const pattern_t pat%d = {" % n + print " {", + for p in rand_partition(): + print "%#x, " % p, + print " }," + print " {", + for p in rand_permutation(): + print "%d, " % p, + print " }," + print " %#x" % rand_follower_bitmap() + print "};" + for n in range(32): - print_pattern(n) + print_pattern(n)