Master gtest-gnc-datetime test fails.

Geert Janssens geert.gnucash at kobaltwit.be
Sat Apr 15 11:41:12 EDT 2017


On zaterdag 15 april 2017 16:15:00 CEST John Ralls wrote:
> > On Apr 15, 2017, at 4:27 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> > 
> > Hi,
> > 
> > Built current master on my Linux VM and tried to run the tests but it
> > fails
> > on the following test, if they are commented out all other tests run
> > successfully.
> > 
> > Checked my time zone information to be Europe/London
> > 
> > I think the offset is the difference between local time and utc time, so
> > the first two failures are comparing times in GMT to UTC which I think are
> > the same so expect 0 and the last one is after we have switched to BST and
> > so 3600 makes sense to me.
> > 
> > zdump /etc/localtime
> > /etc/localtime  Sat Apr 15 12:14:57 2017 BST
> > 
> > 
> > gtest-gnc-datetime.cpp:103: Failure
> > Value of: gncdt1.offset()
> > 
> >  Actual: 0
> > 
> > Expected: -28800
> > gtest-gnc-datetime.cpp:105: Failure
> > Value of: gncdt2.offset()
> > 
> >  Actual: 0
> > 
> > Expected: -25200
> > gtest-gnc-datetime.cpp:107: Failure
> > Value of: gncdt3.offset()
> > 
> >  Actual: 3600
> > 
> > Expected: -25200
> > 
> > Not sure how to fix apart from changing the expected values.
> 
> The tests are checking that the offset is calculated correctly and works
> only in Pacific Time (UTC - 8:00). If you run TZ=America/LosAngeles make
> check
> it will pass.
> 
Is setting the timezone something that's part of the Makefile/cmake invocation 
of this test ?

Or better yet is this something that could be made part of the test source 
itself ? Just wondering if we can set environment variable TZ at the beginning 
of the test code (not in the makefile/cmake script but really in the C++ 
source). Would the test then still pick this up as the timezone to use or 
would that be too late ?

Geert


More information about the gnucash-devel mailing list