diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-04-08 17:02:14 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-04-08 17:02:14 -0400 |
commit | a63bd877608cc9892c58ca8addbe18f9f7eff468 (patch) | |
tree | 60395f801ef424f842ca0e966595fc29d9394c45 /src/test/test_util.c | |
parent | 3b9e3cca94dbeb083bfd64dfd4eb22a905cd2748 (diff) | |
download | tor-a63bd877608cc9892c58ca8addbe18f9f7eff468.tar.gz tor-a63bd877608cc9892c58ca8addbe18f9f7eff468.zip |
Detect and suppress an additional gmtime() warning in test_util.c
Fixes bug 29922; bugfix on 0.2.9.3-alpha when we tried to capture
all these warnings. No need to backport any farther than 0.3.5,
though -- these warnings don't cause test failures before then.
This one was tricky to find because apparently it only happened on
_some_ windows builds.
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c index 4701fadf1a..1b8897a170 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -699,6 +699,13 @@ test_util_time(void *arg) #define CHECK_TIMEGM_ARG_OUT_OF_RANGE(msg) \ CHECK_TIMEGM_WARNING("Out-of-range argument to tor_timegm") +#define CHECK_POSSIBLE_TIMEGM_ARG_OUT_OF_RANGE(msg) \ + do { \ + if (mock_saved_log_n_entries()) { \ + expect_single_log_msg_containing("Out-of-range argument");\ + } \ + teardown_capture_of_logs(); \ + } while (0) /* year */ @@ -885,7 +892,9 @@ test_util_time(void *arg) * depending on whether the implementation of the system gmtime(_r) * sets struct tm (1) or not (1970) */ t_res = -1; + CAPTURE(); tor_gmtime_r(&t_res, &b_time); + CHECK_POSSIBLE_TIMEGM_ARG_OUT_OF_RANGE(); tt_assert(b_time.tm_year == (1970-1900) || b_time.tm_year == (1969-1900)); |