From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 77857384B0C0 for ; Sun, 26 Apr 2020 19:17:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77857384B0C0 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-YD20vwr5OuuPHoGmNlsFCg-1; Sun, 26 Apr 2020 15:17:16 -0400 X-MC-Unique: YD20vwr5OuuPHoGmNlsFCg-1 Received: by mail-qk1-f200.google.com with SMTP id o21so17147721qkm.4 for ; Sun, 26 Apr 2020 12:17:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:organization:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=bpeyD8WpCZnbL4decTNnlKuzCMLPYFEHbmCX7YUuFzw=; b=H9uX+jcbqxZ1qlJg8dDhSF3Z165P2pLY+T/CNTsrVsQ9G9IyDfTcPwlCqhj+KkuIXO Z/ghqee24UwCbR3NEPpEorPl2t7lHxnQLvdLY8nZtpXf0GIuYYj1ChdvvjOR7vsHHPlt iRfVXtYLTS01L6aCo6em7BFlUcWDWdFTfKA5lk/hm+LH0zj5eMpOvyGFAHnWE7Ntr2Yl THpTvsoiWisbK4EbjtFD5FuXnyarTvA3dNFLNYiw8GHyvx8L4cPu6pUHbfdefQLFi6Li hc6+Vte5Pi2iTJOtxoumINiHetSFExctaIcMkfHIN6/A5+XEDE+53Z4uzsfr2+uaAXuw eHbQ== X-Gm-Message-State: AGi0PuZJXGAef/DjFweYm/Xl9aClkXJwC9kB3bTVXBbdbZKNqHFxL6EE al4Msdq5SRQ9o0UFiCaLhqaKcYCJK//7QPoGR/ncwncEyjGjeXx1ruZrVtABVLVqJJ9gyTywf1T TeuXyixxXeHjveCfzcRMf X-Received: by 2002:a05:620a:228:: with SMTP id u8mr19354673qkm.309.1587928636153; Sun, 26 Apr 2020 12:17:16 -0700 (PDT) X-Google-Smtp-Source: APiQypLGvvH+wZu68KRjRPnW/dEBYPgcuolsYAVuOFQeYQlop8SZbhy0K5ghOPHGFcrEIm5DiC3Gzg== X-Received: by 2002:a05:620a:228:: with SMTP id u8mr19354659qkm.309.1587928635890; Sun, 26 Apr 2020 12:17:15 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id 202sm7980653qko.135.2020.04.26.12.17.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Apr 2020 12:17:15 -0700 (PDT) To: libc-alpha , DJ Delorie From: Carlos O'Donell Subject: [PATCH] test-container: Add $complocaledir and mkdirp. Organization: Red Hat Message-ID: <6cf7432e-53ff-7c13-cb7a-55316faab495@redhat.com> Date: Sun, 26 Apr 2020 15:17:14 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-21.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, 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-List-Received-Date: Sun, 26 Apr 2020 19:17:19 -0000 Despite me writing "necessary" in the commit message, it's obviously not entirely required since you can just use: + xmkdirp (support_complocaledir_prefix, 0777); in the test. The above does exactly the same as running the following from the script: mkdirp 0755 $complocaledir/ However, the patch below enables the test developer to choose how they want to create the directory, via a script (patch enalbes this), or inside the test. One might argue that locales should just be installed by default in the test chroot, but I would argue against it. I would say the framework should do: * Container tests by default should have no locales (as we have it today, fastest chroot creation). * Container tests should be able to specify they want a specific locale installed or all locales (enhancement request, not supported today). OK for master? 8< --- 8< --- 8< >From 925c47b47d597663606486402c38e2e729ed663c Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Thu, 23 Jan 2020 09:45:00 -0500 Subject: [PATCH] test-container: Add $complocaledir and mkdirp. In order to test localedef in the test-container framework it is necessary to add support for one new variable and one new command. For localedef to install a compiled locale in the default location the directory needs to be created e.g. mkdir -p $complocaledir/dir. This command requires both the new command 'mkdirp' e.g. mkdir -p, and the new variable $complocaledir. The only way to avoid this would be to install locales into the pristine container root, but that would slow down container testing (currently only has builtin C/POSIX available). These new features will be used by the new tst-localedef-hardlinks test. --- support/test-container.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/support/test-container.c b/support/test-container.c index dff2ff379e..deb2cc3ff5 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -97,9 +97,13 @@ int verbose = 0; rm FILE cwd PATH exec FILE - FILE must start with $B/, $S/, $I/, $L/, or / - (expands to build dir, source dir, install dir, library dir - (in container), or container's root) + mkdirp MODE DIR + + FILE must start with $B/, $S/, $I/, $L/, $complocaledir/ + or / (expands to build dir, source dir, install dir, + library dir (in container), compiled locale dir + (in container), or container's root) + details: - '#': A comment. - 'su': Enables running test as root in the container. @@ -108,6 +112,8 @@ int verbose = 0; - 'rm': A minimal remove files command. - 'cwd': set test working directory - 'exec': change test binary location (may end in /) + - 'mkdirp': A minimal "mkdir -p FILE" command. + * mytest.root/postclean.req causes fresh rsync (with delete) after test if present @@ -859,6 +865,7 @@ main (int argc, char **argv) int nt = tokenize (the_line, the_words, 3); int i; + /* Expand variables. */ for (i = 1; i < nt; ++i) { if (memcmp (the_words[i], "$B/", 3) == 0) @@ -875,6 +882,10 @@ main (int argc, char **argv) the_words[i] = concat (new_root_path, support_libdir_prefix, the_words[i] + 2, NULL); + else if (memcmp (the_words[i], "$complocaledir/", 15) == 0) + the_words[i] = concat (new_root_path, + support_complocaledir_prefix, + the_words[i] + 14, NULL); /* "exec" and "cwd" use inside-root paths. */ else if (strcmp (the_words[0], "exec") != 0 && strcmp (the_words[0], "cwd") != 0 @@ -892,6 +903,8 @@ main (int argc, char **argv) the_words[2] = concat (the_words[2], the_words[1], NULL); } + /* Run the command in the_words[0] with NT number of arguments + (including the command). */ if (nt == 2 && strcmp (the_words[0], "so") == 0) { the_words[2] = concat (new_root_path, support_libdir_prefix, @@ -961,6 +974,12 @@ main (int argc, char **argv) { be_su = 1; } + else if (nt == 3 && strcmp (the_words[0], "mkdirp") == 0) + { + long int m; + m = strtol (the_words[1], NULL, 0); + xmkdirp (the_words[2], m); + } else if (nt > 0 && the_words[0][0] != '#') { fprintf (stderr, "\033[31minvalid [%s]\033[0m\n", the_words[0]); -- 2.21.1 -- Cheers, Carlos.