From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id C952E3870897; Tue, 2 Mar 2021 12:30:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C952E3870897 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/y2038] support: Add 'touch' command X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/y2038 X-Git-Oldrev: a778890ca0cc4f495d0272183e12fb0cca31fe60 X-Git-Newrev: 7a8b4e7a0f4386d47bbed960d4da9e165c45749b Message-Id: <20210302123054.C952E3870897@sourceware.org> Date: Tue, 2 Mar 2021 12:30:54 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Mar 2021 12:30:54 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7a8b4e7a0f4386d47bbed960d4da9e165c45749b commit 7a8b4e7a0f4386d47bbed960d4da9e165c45749b Author: Adhemerval Zanella Date: Wed Aug 5 14:05:54 2020 -0300 support: Add 'touch' command It allow creates empty files with an specific mode. Diff: --- support/test-container.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/support/test-container.c b/support/test-container.c index 28cc44d9f1..0d85bfb357 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -104,6 +104,7 @@ int verbose = 0; cwd PATH exec FILE mkdirp MODE DIR + touch MODE FILE variables: $B/ build dir, equivalent to $(common-objpfx) @@ -129,6 +130,7 @@ int verbose = 0; - 'cwd': set test working directory - 'exec': change test binary location (may end in /) - 'mkdirp': A minimal "mkdir -p FILE" command. + - 'touch': A minimal 'touch' command to create empty files. * mytest.root/postclean.req causes fresh rsync (with delete) after test if present @@ -1018,6 +1020,15 @@ main (int argc, char **argv) TEST_COMPARE (errno, 0); xmkdirp (the_words[2], m); } + else if (nt == 3 && strcmp (the_words[0], "touch") == 0) + { + long int m; + errno = 0; + m = strtol (the_words[1], NULL, 0); + TEST_COMPARE (errno, 0); + + xclose (xopen (the_words[2], O_WRONLY | O_TRUNC | O_CREAT, m)); + } else if (nt > 0 && the_words[0][0] != '#') { fprintf (stderr, "\033[31minvalid [%s]\033[0m\n", the_words[0]);