public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/y2038] time: Add basic timespec_get tests
Date: Tue,  2 Mar 2021 12:32:36 +0000 (GMT)	[thread overview]
Message-ID: <20210302123236.8CE6E3938C3F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9bf8d81540ff170161d549226ffee52ff65d6085

commit 9bf8d81540ff170161d549226ffee52ff65d6085
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Mon Mar 1 13:14:03 2021 -0300

    time: Add basic timespec_get tests
    
    Checkec on x86_64-linux-gnu and i686-linux-gnu.

Diff:
---
 time/Makefile           |  2 +-
 time/tst-timespec_get.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/time/Makefile b/time/Makefile
index 5d865a4054..29208f35c0 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-clock_settime \
-	   tst-itimer tst-gmtime tst-timegm
+	   tst-itimer 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <time.h>
+#include <support/check.h>
+
+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 <support/test-driver.c>


             reply	other threads:[~2021-03-02 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 12:32 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-05 19:18 Adhemerval Zanella
2021-03-04 17:38 Adhemerval Zanella
2021-03-04 11:30 Adhemerval Zanella
2021-03-01 17:37 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210302123236.8CE6E3938C3F@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).