From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 36726398B847; Fri, 26 Feb 2021 20:41:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36726398B847 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: fee0c794daa3ef58ea9c4782ccb9a650f6308f51 X-Git-Newrev: 9ff5bd3559fe095b9703f1cbdf81b04f8474287f Message-Id: <20210226204129.36726398B847@sourceware.org> Date: Fri, 26 Feb 2021 20:41:29 +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: Fri, 26 Feb 2021 20:41:29 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ff5bd3559fe095b9703f1cbdf81b04f8474287f commit 9ff5bd3559fe095b9703f1cbdf81b04f8474287f 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]);