From patchwork Wed Mar 20 00:44:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10860605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 26E1B1390 for ; Wed, 20 Mar 2019 00:44:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE87928500 for ; Wed, 20 Mar 2019 00:44:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E091B2998B; Wed, 20 Mar 2019 00:44:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 765E228500 for ; Wed, 20 Mar 2019 00:44:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727154AbfCTAor (ORCPT ); Tue, 19 Mar 2019 20:44:47 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:57032 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbfCTAor (ORCPT ); Tue, 19 Mar 2019 20:44:47 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2K0cuWi008321; Wed, 20 Mar 2019 00:44:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=Ty3EFyvRKIIqM1dtJqYIhu8XzQUwQaRuYYC4GC2/TyE=; b=YRnunkikXmwjes2V7NCKB14ZBYOzGgM6kmbU/kiYv517hISUaTChNatO6vJZYHoNow04 AK47/k7YynYUO7P3LMxJywn5h8xaSyzE5HTLIcoS43+7se2qA0T3vr+EeySLPkZH4Awt 74G5PePtZ5qaiHwgGTXZd9BD9+qlhFHCaOjUObfzLc2SZyLGW0EqATUGFCYkVfc9rCZ7 Aum/JDSVKS4t9V4epkPq2m6w+nWLmOLnScVvkPDBoI2V+g5scurXP2yzVVPAC2rfzrX1 t6snKWMClx4eULyD6urRW31i9UpqUu+KYBTtSG6ZdjvOqcudE7dMcWTo9b95ddGMJbzM 3w== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2r8pner3wb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 00:44:44 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2K0igcb005274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Mar 2019 00:44:43 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2K0igjg022036; Wed, 20 Mar 2019 00:44:42 GMT Received: from localhost (/10.159.245.168) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Mar 2019 17:44:42 -0700 Subject: [PATCH 01/12] check: improve test list randomization From: "Darrick J. Wong" To: guaneryu@gmail.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org Date: Tue, 19 Mar 2019 17:44:42 -0700 Message-ID: <155304268284.31707.10338119992472996728.stgit@magnolia> In-Reply-To: <155304267647.31707.14180452399822113095.stgit@magnolia> References: <155304267647.31707.14180452399822113095.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9200 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=913 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903200003 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong awk doesn't have a particularly good random number generator -- it seeds from the Unix epoch time in seconds, which means that the run order across a bunch of VMs started at exactly the same time are unsettlingly predictable. Therefore, at least try to seed it with bash's $RANDOM, which is slightly less predictable. Signed-off-by: Darrick J. Wong --- check | 12 ++++++------ randomize.awk | 12 ++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/check b/check index 20e95302..ecd1d39a 100755 --- a/check +++ b/check @@ -242,13 +242,13 @@ _prepare_test_list() done # sort the list of tests into numeric order - list=`sort -n $tmp.list | uniq` - rm -f $tmp.list - - if $randomize - then - list=`echo $list | awk -f randomize.awk` + if $randomize; then + sorter="awk -v seed=$RANDOM -f randomize.awk" + else + sorter="cat" fi + list=`sort -n $tmp.list | uniq | $sorter` + rm -f $tmp.list } # Process command arguments first. diff --git a/randomize.awk b/randomize.awk index 0a8ad71a..d979fb03 100644 --- a/randomize.awk +++ b/randomize.awk @@ -15,10 +15,14 @@ function randomize(array, N) { return } +BEGIN { + srand(seed) +} { - srand() - for (i = 0; i < NF; i++ ) array[i] = $(i+1) - randomize(array, NF) - for (i = 0; i < NF; i++) printf("%s ", array[i]) + array[NR - 1] = $0 +} +END { + randomize(array, NR) + for (i = 0; i < NR; i++) printf("%s ", array[i]) }