Mesa (staging/19.2): Fix timespec_from_nsec test for 32-bit time_t

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 4 16:18:20 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 13768f3714a53fd6e599baa7fa10b64bb64c94fb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13768f3714a53fd6e599baa7fa10b64bb64c94fb

Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Mon Sep 16 15:25:33 2019 +0100

Fix timespec_from_nsec test for 32-bit time_t

Since struct timespec's tv_sec member is of type time_t, adjust the
expected value to allow for the truncation which will occur with 32-bit
time_t.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
(cherry picked from commit dd1dba80b9ee74ec8b90761285a8262e374bf8ef)
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2043

---

 src/util/tests/timespec/timespec_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/tests/timespec/timespec_test.cpp b/src/util/tests/timespec/timespec_test.cpp
index 4182af0771a..5005506f9fd 100644
--- a/src/util/tests/timespec/timespec_test.cpp
+++ b/src/util/tests/timespec/timespec_test.cpp
@@ -206,7 +206,7 @@ TEST(timespec_test, timespec_from_nsec)
 
    timespec_from_nsec(&a, UINT64_MAX);
    EXPECT_EQ(a.tv_nsec, UINT64_MAX % NSEC_PER_SEC);
-   EXPECT_EQ(a.tv_sec, UINT64_MAX / NSEC_PER_SEC);
+   EXPECT_EQ(a.tv_sec, (time_t)(UINT64_MAX / NSEC_PER_SEC));
 }
 
 TEST(timespec_test, timespec_from_usec)




More information about the mesa-commit mailing list