From patchwork Thu Mar 11 17:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 42455 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB7C93896C09; Thu, 11 Mar 2021 17:53:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB7C93896C09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1615485225; bh=uLUEYy/rczcVp56a6Vdtkn6RUgMwq2dQb3NGAaSMvUw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=U9G1+80Tbqj/Xj0ou5AFF2Wj8RMF+qXZ1Jn5CastbyVsqRBYn4wi8BvKNw6B4KYUs RXe4ebGsKBfhnqaiYyPJI4PzRVuEb9CRbNi1P+cNvet1PyKiHO57I8oVO2lr/raDqW bHmwM5Eac+8jLqsDFYneUYwlW4yoRoqp5EGkL9WQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 5FAFB38930FF for ; Thu, 11 Mar 2021 17:53:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5FAFB38930FF Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-kqcXFVTgPT-3svGOGggakw-1; Thu, 11 Mar 2021 12:53:41 -0500 X-MC-Unique: kqcXFVTgPT-3svGOGggakw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 639D61015C88 for ; Thu, 11 Mar 2021 17:53:40 +0000 (UTC) Received: from rhel8.vm.delorie.com (ovpn-112-66.rdu2.redhat.com [10.10.112.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 397D419704 for ; Thu, 11 Mar 2021 17:53:40 +0000 (UTC) Received: from rhel8.vm.redhat.com (localhost [127.0.0.1]) by rhel8.vm.delorie.com (8.15.2/8.15.2) with ESMTPS id 12BHrcTg126633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Thu, 11 Mar 2021 12:53:39 -0500 Date: Thu, 11 Mar 2021 12:53:38 -0500 Message-Id: To: libc-alpha@sourceware.org Subject: [PATCH v1] test-container: Always copy test-specific support files [BZ #27537] X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: DJ Delorie via Libc-alpha From: DJ Delorie Reply-To: DJ Delorie Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" There's a small chance that a fresh checkout will result in some of the test-specific container files will have the same timestamp and size, which breaks the rsync logic in test-container, resulting in tests running with the wrong support files. This patch changes the rsync logic to always copy the test-specific files, which normally would always be copied anyway. The rsync logic for the testroot itself is unchanged. --- support/test-container.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/support/test-container.c b/support/test-container.c index 28cc44d9f1..94498d3901 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -481,7 +481,7 @@ need_sync (char *ap, char *bp, struct stat *a, struct stat *b) } static void -rsync_1 (path_buf * src, path_buf * dest, int and_delete) +rsync_1 (path_buf * src, path_buf * dest, int and_delete, int force_copies) { DIR *dir; struct dirent *de; @@ -491,8 +491,9 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) r_append ("/", dest); if (verbose) - printf ("sync %s to %s %s\n", src->buf, dest->buf, - and_delete ? "and delete" : ""); + printf ("sync %s to %s%s%s\n", src->buf, dest->buf, + and_delete ? " and delete" : "", + force_copies ? " (forced)" : ""); size_t staillen = src->len; @@ -521,10 +522,10 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) missing. */ lstat (dest->buf, &d); - if (! need_sync (src->buf, dest->buf, &s, &d)) + if (! force_copies && ! need_sync (src->buf, dest->buf, &s, &d)) { if (S_ISDIR (s.st_mode)) - rsync_1 (src, dest, and_delete); + rsync_1 (src, dest, and_delete, force_copies); continue; } @@ -559,7 +560,7 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) if (verbose) printf ("+D %s\n", dest->buf); maybe_xmkdir (dest->buf, (s.st_mode & 0777) | 0700); - rsync_1 (src, dest, and_delete); + rsync_1 (src, dest, and_delete, force_copies); break; case S_IFLNK: @@ -639,12 +640,12 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) } static void -rsync (char *src, char *dest, int and_delete) +rsync (char *src, char *dest, int and_delete, int force_copies) { r_setup (src, &spath); r_setup (dest, &dpath); - rsync_1 (&spath, &dpath, and_delete); + rsync_1 (&spath, &dpath, and_delete, force_copies); } @@ -846,11 +847,11 @@ main (int argc, char **argv) do_ldconfig = true; rsync (pristine_root_path, new_root_path, - file_exists (concat (command_root, "/preclean.req", NULL))); + file_exists (concat (command_root, "/preclean.req", NULL)), 0); if (stat (command_root, &st) >= 0 && S_ISDIR (st.st_mode)) - rsync (command_root, new_root_path, 0); + rsync (command_root, new_root_path, 0, 1); new_objdir_path = xstrdup (concat (new_root_path, support_objdir_root, NULL)); @@ -1044,7 +1045,7 @@ main (int argc, char **argv) /* Child has exited, we can post-clean the test root. */ printf("running post-clean rsync\n"); - rsync (pristine_root_path, new_root_path, 1); + rsync (pristine_root_path, new_root_path, 1, 0); if (WIFEXITED (status)) exit (WEXITSTATUS (status));