Submitter | Yuya Nishihara |
---|---|
Date | April 19, 2018, 1:54 p.m. |
Message ID | <769bd30988035d0c802c.1524146042@mimosa> |
Download | mbox | patch |
Permalink | /patch/31201/ |
State | Accepted |
Headers | show |
Comments
On Thu, Apr 19, 2018 at 10:54:02PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1524143530 -32400 > # Thu Apr 19 22:12:10 2018 +0900 > # Branch stable > # Node ID 769bd30988035d0c802cd5c8acaece16ebb3d024 > # Parent 3866a9af240cc01e5eab12ffeac668f61cfa2a13 > test-fix: fix use of 'f --newer' to check that foo.whole is not updated queued for stable, thanks
On Thu, 19 Apr 2018 09:54:02 -0400, Yuya Nishihara <yuya@tcha.org> wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1524143530 -32400 > # Thu Apr 19 22:12:10 2018 +0900 > # Branch stable > # Node ID 769bd30988035d0c802cd5c8acaece16ebb3d024 > # Parent 3866a9af240cc01e5eab12ffeac668f61cfa2a13 > test-fix: fix use of 'f --newer' to check that foo.whole is not updated > > Here we want to assert not 'mtime(foo.whole.orig) < mtime(foo.whole)'. > The condition has to be inverted since 'f --newer' says "newer" if the > mtimes match. > > Alternatively, we could insert 'sleep 2' before 'cp' to ensure that > foo.whole.orig is newer than foo.whole, but a fewer sleeps should be > better. This fails on Windows. I added code to `f` to print st_mtime, and got results (with `cp -p`) like: foo.whole foo.whole.orig 1524449468.91 1524449469.0 1524449707.08 1524449707.0 Should `f` be rounding to a whole number before comparing? Seems not great, but if tests already have to delay 2 seconds for some filesystems, it doesn't seem unreasonable. > diff --git a/tests/test-fix.t b/tests/test-fix.t > --- a/tests/test-fix.t > +++ b/tests/test-fix.t > @@ -493,11 +493,11 @@ write back to the file, so for example t > $ printf "NO FIX NEEDED\n" > foo.whole > $ hg add > adding foo.whole > - $ cp foo.whole foo.whole.orig > + $ cp -p foo.whole foo.whole.orig > $ sleep 2 # mtime has a resolution of one or two seconds. > $ hg fix --working-dir > - $ f foo.whole --newer foo.whole.orig > - foo.whole: older than foo.whole.orig > + $ f foo.whole.orig --newer foo.whole > + foo.whole.orig: newer than foo.whole > $ cd .. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/tests/test-fix.t b/tests/test-fix.t --- a/tests/test-fix.t +++ b/tests/test-fix.t @@ -493,11 +493,11 @@ write back to the file, so for example t $ printf "NO FIX NEEDED\n" > foo.whole $ hg add adding foo.whole - $ cp foo.whole foo.whole.orig + $ cp -p foo.whole foo.whole.orig $ sleep 2 # mtime has a resolution of one or two seconds. $ hg fix --working-dir - $ f foo.whole --newer foo.whole.orig - foo.whole: older than foo.whole.orig + $ f foo.whole.orig --newer foo.whole + foo.whole.orig: newer than foo.whole $ cd ..