Bug#815519: haskell-mockery: testsuite fails on some filesystems

Steven Chamberlain steven at pyro.eu.org
Mon Feb 22 00:32:18 UTC 2016


Package: src:haskell-mockery
Version: 0.3.2-3
Severity: normal
Tags: patch

Hi,

haskell-mockery has a test that:
  * creates file 'foo'
  * gets its mtime (t0)
  * sleeps ~10ms
  * touches it
  * gets its mtime (t1)
  * asserts t1 > t0

This doesn't work on some filesystems, such as GNU/kFreeBSD's ufs or
GNU/Hurd's implementation of extfs, because those don't store mtime
with sub-second precision.  Maybe not all Linux filesystems do either.

| Test.Mockery.Directory
|   withFile
|     creates a temporary file with the given contents
|   touch
|     creates an empty file
|     creates any missing directories
|     when file already exists
|       updates modification time FAILED [1]
|       does not modify file content
| Test.Mockery.Logging
|   captureLogs
|     returns all log messages of an action
|     restores the original log sink
| 
| Failures:
| 
|   test/Test/Mockery/DirectorySpec.hs:42: 
|   1) Test.Mockery.Directory.touch, when file already exists, updates
| modification time
|        predicate failed on: 2016-02-22 00:15:19 UTC
| 
| Randomized with seed 569868309
| 
| Finished in 0.0244 seconds

Since the test ran for only a fraction of a second, it's very unlikely
the file mtime (in whole seconds) would increment during that time.
Please could you increase the delay to >= 1 second so that the test
works properly on such filesystems.

I've attached a patch, although I don't know Haskell and I wasn't sure
what the two different intervals mean.  So I added some extra zeros to
both, and it now runs for 1-2 seconds and it gets the expected result on
kfreebsd-amd64 with UFS.

Thanks!

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 10.1-0-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
-------------- next part --------------
A non-text attachment was scrubbed...
Name: haskell-mockery.patch
Type: text/x-diff
Size: 838 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20160222/dcc885b1/attachment.patch>


More information about the Pkg-haskell-maintainers mailing list