From patchwork Fri Mar 5 20:14:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 42299 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 9694E399C02A; Fri, 5 Mar 2021 20:15:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9694E399C02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614975346; bh=DFc92L40JDRdAlfuvzLefh2174ou269jlR3ufwTVj0I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=rCPhv+Kp1zUz4+SLR3+G0kjHitcxv+zUrWjhJ7go023SkQf1KjEKi39WfpJir58Rb 8r0J175o0zP9ztdkdIYAM0sLDcij8DHZXE8qdePySLZwBF/OZ5N023tykmL2jhzEtJ h43kf20P/vcD0vS4WRRvTnlNHG5ePM/lltKDR2IU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by sourceware.org (Postfix) with ESMTPS id 92ACD382D435 for ; Fri, 5 Mar 2021 20:15:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 92ACD382D435 Received: by mail-qt1-x836.google.com with SMTP id h9so2760246qtq.7 for ; Fri, 05 Mar 2021 12:15:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DFc92L40JDRdAlfuvzLefh2174ou269jlR3ufwTVj0I=; b=LoijWdOgSQYTtnhtaCpC70UINISD22dzS/DY6zVdXsmK5z4vO15Tx9rxq1503qvWOz RwMIq3L/suNYE0LOzMIktw8hsT/5AhpUjqeEeqUKErG+wcuhuTKH07uc+M7drEWgTMJx NWyfCTTP3W11BCDc3CrDrhxBsB8VyFABP4/fjZ3KUal/OMz+65YsS28F223KNPOEXCi6 q8cVxv0exEVUGHp9TxVsG6upEy6JBYoQhDdTepX3Rl6ofa5gQpBmssnG+/mwqL28hoWA W+YLgNyZddgFGOqmHGruMXTNTmyZ9OhSY5NoKx5/QUJp77aKKH9HUwpG+6pw/m7onWJ3 SgZQ== X-Gm-Message-State: AOAM532DCS44hKIUdA8jaaflSJyOzfV03/tcsaVEGGFaVNa+S5bQPycR Fu4SJIIMswii//P50lmBGIreeQqJ0thPSw== X-Google-Smtp-Source: ABdhPJzJNjF1b5FhLyHLBeZ7/v8jHDwz77uSr/1H9bYQnjEMRhSJRD+TALY7uX08KDTdmD+DAqRIrA== X-Received: by 2002:ac8:4710:: with SMTP id f16mr3493754qtp.165.1614975344048; Fri, 05 Mar 2021 12:15:44 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id c5sm2526145qkl.21.2021.03.05.12.15.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 12:15:43 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 18/52] support: Add 'touch' command Date: Fri, 5 Mar 2021 17:14:44 -0300 Message-Id: <20210305201518.798584-19-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210305201518.798584-1-adhemerval.zanella@linaro.org> References: <20210305201518.798584-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It allow creates empty files with an specific mode. --- 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]);