There's probably a more principled way to do this, but I think it's OK
while we fix all the other tests...

-----

The -newer check was failing about once in three times on my machine.
'stat' showed that 'file' and 'link' can have the exact same timestamp,
probably due to some metadata buffering in the kernel.

Also remove the testdata cleanup, since it makes it harder to debug, and
that's the job of the harness.
From d65559a01260966c6fb20763e0fe3a4cd8a7c3f0 Mon Sep 17 00:00:00 2001
From: Andy Chu <[email protected]>
Date: Fri, 18 Mar 2016 21:28:11 -0700
Subject: [PATCH] Fix a flaky test case in find.test.

The -newer check was failing about once in three times on my machine.
'stat' showed that 'file' and 'link' can have the exact same timestamp,
probably due to some metadata buffering in the kernel.

Also remove the testdata cleanup, since it makes it harder to debug, and
that's the job of the harness.
---
 tests/find.test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/find.test b/tests/find.test
index 580d195..7df62ff 100755
--- a/tests/find.test
+++ b/tests/find.test
@@ -5,8 +5,11 @@
 mkdir dir
 cd dir
 touch file
+
+sleep 0.1  # so that 'link' is newer than 'file'; tested below
 mkfifo fifo
 ln -s fifo link
+
 cd ..
 touch b
 
@@ -90,4 +93,3 @@ testing "-name (no arguments)" \
   "find dir -name 2>&1" "find: '-name' needs 1 arg\n" "" ""
 testing "-iname (no arguments)" \
   "find dir -iname 2>&1" "find: '-iname' needs 1 arg\n" "" ""
-rm -rf dir
-- 
1.9.1

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to