From patchwork Fri Mar 5 20:14:33 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: 42289 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 2F2C73892456; Fri, 5 Mar 2021 20:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F2C73892456 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614975336; bh=06Wcu6CwU+ELTBgP7pQwz8hAnSqC7y7c+LJfE48ghBQ=; 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=tld1W0cTxCbjcrcQOLfb3z7ooWlxrkB2bI1PWJcbYIOqsK5zKXiAP4HjCCkKbLrzu auG4ixFEdhoeWdS1NQxg1lg/F5cRIc/zNqyfdFONaEjjZ3vvWzHTNm3KevNg9edUbu JM10Xoz1gWykwsxZTc0zqsXXnblzMDSZM97FgX1M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id BC32D382D435 for ; Fri, 5 Mar 2021 20:15:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC32D382D435 Received: by mail-qk1-x731.google.com with SMTP id d20so3309099qkc.2 for ; Fri, 05 Mar 2021 12:15:31 -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=06Wcu6CwU+ELTBgP7pQwz8hAnSqC7y7c+LJfE48ghBQ=; b=fRetOyW/+4TYEGddHnzHDFg+GY31Hz0pTb5osZ9Js2sEfyTLwZDetCHoYFKFR+VwDQ 0GaRM7yseKHjTy4W64cLrPfpIE+CAS81qi2xswVsOTdW1f6/9PtEm0FKEpcsEAPNuDHy +WY7YDVTGKvBiGIzrZlPuTBcdTfhrGJscx1eJ1J2v7baQKD5m5LdBewpCKwfRyqPNft7 6LL3GiqAIl4MGrAcvTqN4H/nUJbQXXHvFook7BHCjXfDnev09hKkKoiS6BbTZNlasxs/ TXn1v+ZqCVjWnPJDWRxG/gQ6hFAwT+ilABQLl8zMqB6v7aBux8HXaj6Vgq2oUOrpzI21 dotg== X-Gm-Message-State: AOAM532eLgLLd9G7vxBl1Dc3T4TFt9BOZBUGoEfk29AZ9aiftkAXSMqt 25yaI2esoedKGArkJDSxp2oLqJlqCbUyGQ== X-Google-Smtp-Source: ABdhPJwCEnrLVMcCJ/ggIdbdui8NETwFhr6vZd2U+w1iqhXk/+uDVahTvMJkghbRUga/EYtNeAXnXg== X-Received: by 2002:a37:56c5:: with SMTP id k188mr10542158qkb.18.1614975331243; Fri, 05 Mar 2021 12:15:31 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id c5sm2526145qkl.21.2021.03.05.12.15.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 12:15:31 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 07/52] time: Add basic timespec_get tests Date: Fri, 5 Mar 2021 17:14:33 -0300 Message-Id: <20210305201518.798584-8-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, KAM_SHORT, 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" Checkec on x86_64-linux-gnu and i686-linux-gnu. --- time/Makefile | 2 +- time/tst-timespec_get.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 time/tst-timespec_get.c diff --git a/time/Makefile b/time/Makefile index 786dc45b51..f14022b334 100644 --- a/time/Makefile +++ b/time/Makefile @@ -49,7 +49,7 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \ tst-tzname tst-y2039 bug-mktime4 tst-strftime2 tst-strftime3 \ tst-clock tst-clock2 tst-clock_nanosleep tst-cpuclock1 \ tst-adjtime tst-ctime tst-difftime tst-mktime4 tst-itimer \ - tst-gmtime tst-timegm + tst-gmtime tst-timegm tst-timespec_get include ../Rules diff --git a/time/tst-timespec_get.c b/time/tst-timespec_get.c new file mode 100644 index 0000000000..7389927db4 --- /dev/null +++ b/time/tst-timespec_get.c @@ -0,0 +1,40 @@ +/* Basic tests for timespec_get. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +static int +do_test (void) +{ + { + struct timespec ts; + TEST_COMPARE (timespec_get (&ts, 0), 0); + } + + { + struct timespec ts; + TEST_COMPARE (timespec_get (&ts, TIME_UTC), TIME_UTC); + TEST_VERIFY (ts.tv_nsec >= 0); + TEST_VERIFY (ts.tv_nsec < 1000000000); + } + + return 0; +} + +#include