test_write_dont_preserve_timestamps fails

Bug #624999 reported by Matěj Cepl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
Medium
Olivier Tilloy

Bug Description

With the patch from revision 323 (http://pkgs.fedoraproject.org/gitweb/?p=pyexiv2.git;a=blob_plain;f=upstream-lp_bug_624283-Skip-unicode-unit-tests-for-unsupported-encodings.patch;hb=master) encoding tests go through, but I have still one test failing:

test_ascii_str (encoding.TestEncodings) ... ok
test_ascii_unicode (encoding.TestEncodings) ... ok
test_nonascii_unicode (encoding.TestEncodings) ... ok
test_nonascii_unicode_escaped (encoding.TestEncodings) ... ok

======================================================================
FAIL: test_write_dont_preserve_timestamps (metadata.TestImageMetadata)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/metadata.py", line 122, in test_write_dont_preserve_timestamps
    self.failIfEqual(atime2, atime)
AssertionError: 1282851765.0 == 1282851765.0

----------------------------------------------------------------------
Ran 131 tests in 2.409s

(BTW and just FYI, I have created a git mirror of pyexiv2 on gitorious at http://gitorious.org/pyexiv2/pyexiv2)

Related branches

Olivier Tilloy (osomon)
summary: - yet another failing test on Fedora
+ test_write_dont_preserve_timestamps fails
Revision history for this message
Olivier Tilloy (osomon) wrote :

I can observe the exact same failure on Windows 7 (NTFS).
I suspect this has to do with the filesystem type (and possibly the mount options). st_atime may not have the desired reliability everywhere…

Matěj, what are the FS in use and mount options on your build system?

On a related note, I uncovered a typo in the same unit tests and fixed it in the trunk (revision 324).

Changed in pyexiv2:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Matěj Cepl (mcepl) wrote : Re: [Bug 624999] Re: test_write_dont_preserve_timestamps fails

Dne 27.8.2010 10:15, Olivier Tilloy napsal(a):
> Matěj, what are the FS in use and mount options on your build system?

/dev/mapper/home on /home type ext4 (rw)

> On a related note, I uncovered a typo in the same unit tests and fixed
> it in the trunk (revision 324).

OK, I will take a look.

Matěj

Revision history for this message
Olivier Tilloy (osomon) wrote :

Is also /tmp on your build system ext4 mounted with the same options? Temporary files created by pyexiv2’s unit tests typically sit in /tmp.

Regarding the typo that I fixed, please note that it doesn’t make the situation better for this specific issue (at least in my tests on the win7 machine where I can reproduce the issue).

Revision history for this message
Matěj Cepl (mcepl) wrote :

That's tmpfs (/tmp on RAMDisk)

jakoubek:git$ mount |grep '\B/tmp'
tmpfs on /tmp type tmpfs (rw,rootcontext="system_u:object_r:tmp_t:s0")
/tmp on /tmp type none (rw,bind)
jakoubek:git$

Revision history for this message
Olivier Tilloy (osomon) wrote :

It looks like st_atime (the file’s last access time) is updated differently from one FS to the other and also depends on mount options. In short, it’s not safe to assume that atime will have been modified when the file has been read, especially if it had already been read previously (caching mechanism?).

Matěj, if you comment out the line "self.failIfEqual(atime2, atime)" in test_write_dont_preserve_timestamps (in test/metadata.py), do the unit tests pass?

Revision history for this message
Matěj Cepl (mcepl) wrote :

Dne 27.8.2010 13:02, Olivier Tilloy napsal(a):
> Matěj, if you comment out the line "self.failIfEqual(atime2, atime)" in
> test_write_dont_preserve_timestamps (in test/metadata.py), do the unit
> tests pass?

I had to comment out both tests on time (see attached patch) and then
the tests went through.

Matěj

Revision history for this message
Olivier Tilloy (osomon) wrote :

Right, I spoke too fast when I wrote in comment #3 that my typo fix in the trunk had no influence on this specific issue. Indeed the atime was used instead of the mtime.

Matěj, I’m sorry for the confusion. Could you try applying the typo fix from the trunk (revision 324) and the one I suggested in comment #5 (commenting out the line "self.failIfEqual(atime2, atime)" and see if that makes the unit tests pass? With the typo fix, commenting out the comparison on mtimes shouldn’t be needed. Thanks!

Revision history for this message
Matěj Cepl (mcepl) wrote :

Yes, with patch created from commit 324, unit tests go through without an error. Thanks.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I managed to observe the issue with pyexiv2 trunk (revision 337) on Ubuntu Maverick (10.10) 64 bits (kernel 2.6.35-23).

The root filesystem (/), including /tmp, is ext4:

    /dev/sda3 on / type ext4 (rw,errors=remount-ro,commit=0)

Revision history for this message
Olivier Tilloy (osomon) wrote :

In revision 339 of the trunk, I commented out the line that makes the unit test fail in certain conditions.
Its result depended on filesystem mount options that the unit test environment cannot control.

Changed in pyexiv2:
assignee: nobody → Olivier Tilloy (osomon)
milestone: none → 0.3
status: Confirmed → Fix Committed
Olivier Tilloy (osomon)
Changed in pyexiv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.