Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 754280 Details for
Bug 968255
MIMEUtilTest fails if performed in wrong timezone (east to UTC)
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch for the TZ-sensitive test
libdap-tz-test.patch (text/plain), 2.17 KB, created by
Eugene Syromyatnikov
on 2013-05-29 10:19:10 UTC
(
hide
)
Description:
Patch for the TZ-sensitive test
Filename:
MIME Type:
Creator:
Eugene Syromyatnikov
Created:
2013-05-29 10:19:10 UTC
Size:
2.17 KB
patch
obsolete
>--- libdap-3.11.0/unit-tests/MIMEUtilTest.cc.orig 2013-05-29 12:06:05.630000000 +0400 >+++ libdap-3.11.0/unit-tests/MIMEUtilTest.cc 2013-05-29 13:43:03.762000000 +0400 >@@ -37,6 +37,8 @@ > #include <unistd.h> // for stat > #include <string> > #include <sstream> >+#include <cstdlib> >+#include <cstring> > > //#define DODS_DEBUG > >@@ -63,6 +65,49 @@ > return match == (int) s.length(); > } > >+ char *saved_tz; >+ >+ void save_tz() >+ { >+ char *tz_val; >+ tz_val = getenv("TZ"); >+ >+ if (tz_val != NULL) >+ { >+ int tz_size; >+ >+ tz_size = strlen(tz_val) + 1; >+ >+ // We expect that environment is sane and we have lots of memory. >+ // What a carelessness. >+ saved_tz = (char *)malloc(tz_size); >+ strncpy(saved_tz, tz_val, tz_size); >+ } >+ else >+ { >+ if (saved_tz) >+ { >+ free(saved_tz); >+ } >+ >+ saved_tz = tz_val; >+ } >+ >+ setenv("TZ", "GMT+0000", 1); >+ } >+ >+ void restore_tz() >+ { >+ if (saved_tz) >+ { >+ setenv("TZ", saved_tz, 1); >+ } >+ else >+ { >+ unsetenv("TZ"); >+ } >+ } >+ > public: > cgiUtilTest() > { >@@ -140,6 +185,8 @@ > CPPUNIT_ASSERT(re_match(r2, oss.str())); > > struct tm tm = { 0, 0, 0, 1, 0, 100, 0, 0, 0, 0, 0 }; // 1 Jan 2000 >+ >+ save_tz(); > time_t t = mktime(&tm); > Regex > r3( >@@ -148,7 +195,7 @@ > XOPeNDAP-Server: dods-test/0.00\r\n\ > XDAP: .*\r\n\ > Date: .*\r\n\ >-Last-Modified: Sat, 01 Jan 2000 ..:00:00 GMT\r\n\ >+Last-Modified: Sat, 01 Jan 2000 00:00:00 GMT\r\n\ > Content-Type: text/plain\r\n\ > Content-Description: dods_dds\r\n\ > \r\n.*"); >@@ -156,6 +203,7 @@ > oss.str(""); > set_mime_text(oss, dods_dds, "dods-test/0.00", x_plain, t); > CPPUNIT_ASSERT(re_match(r3, oss.str())); >+ restore_tz(); > } > > void rfc822_date_test() >@@ -163,10 +211,14 @@ > time_t t = 0; > CPPUNIT_ASSERT(rfc822_date(t) == "Thu, 01 Jan 1970 00:00:00 GMT"); > struct tm tm = { 0, 0, 0, 1, 0, 100, 0, 0, 0, 0, 0 }; // 1 Jan 2000 >+ >+ save_tz(); > t = mktime(&tm); >+ restore_tz(); >+ > // This test may fail for some locations since mktime interprets t as > // the local time and returns the corresponding GMT time. >- Regex r1("Sat, 01 Jan 2000 ..:00:00 GMT"); >+ Regex r1("Sat, 01 Jan 2000 00:00:00 GMT"); > CPPUNIT_ASSERT(re_match(r1, rfc822_date(t))); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 968255
: 754280