aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-01-03 21:32:32 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-01-03 21:32:32 +0000
commita273d4a37a4eb622a4dfe390731f8797c6bd5227 (patch)
tree6170191fede073d97e5c023fdb46bc3a51b0a36c
parentc2021eda480053e276d0f938b3ad4aa2ece5d574 (diff)
downloadpaludis-a273d4a37a4eb622a4dfe390731f8797c6bd5227.tar.gz
paludis-a273d4a37a4eb622a4dfe390731f8797c6bd5227.tar.xz
Make FSEntryTime tests a bit more reliable.
-rw-r--r--paludis/util/fs_entry_TEST.cc63
-rwxr-xr-xpaludis/util/fs_entry_TEST_setup.sh2
2 files changed, 38 insertions, 27 deletions
diff --git a/paludis/util/fs_entry_TEST.cc b/paludis/util/fs_entry_TEST.cc
index db7a3cd..746268c 100644
--- a/paludis/util/fs_entry_TEST.cc
+++ b/paludis/util/fs_entry_TEST.cc
@@ -41,6 +41,42 @@ using namespace test;
namespace test_cases
{
/**
+ * \test Test FSEntry ctime and mtime methods
+ *
+ * \ingroup grpfilesystem
+ */
+ struct FSEntryTime : TestCase
+ {
+ FSEntryTime() : TestCase("ctime and mtime") {}
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ FSEntry a("fs_entry_TEST_dir");
+ FSEntry b("fs_entry_TEST_dir/no_perms");
+ FSEntry c("fs_entry_TEST_dir/no_such_file");
+ FSEntry d("fs_entry_TEST_dir/dir_a/dir_in_a");
+
+ TEST_CHECK(a.ctime() < std::time(0));
+ TEST_CHECK(a.mtime() < std::time(0));
+ TEST_CHECK(b.ctime() < std::time(0));
+ TEST_CHECK(b.mtime() < std::time(0));
+ TEST_CHECK(d.ctime() < std::time(0));
+ TEST_CHECK(d.mtime() < std::time(0));
+
+ TEST_CHECK(b.mtime() < b.ctime());
+ TEST_CHECK(d.mtime() == d.ctime());
+
+ TEST_CHECK_THROWS(c.ctime(), FSError);
+ TEST_CHECK_THROWS(c.mtime(), FSError);
+ }
+ } test_fs_entry_time;
+
+ /**
* \test Test FSEntry construction and manipulation.
*
* \ingroup grpfilesystem
@@ -174,33 +210,6 @@ namespace test_cases
} test_fs_entry_permission;
/**
- * \test Test FSEntry ctime and mtime methods
- *
- * \ingroup grpfilesystem
- */
- struct FSEntryTime : TestCase
- {
- FSEntryTime() : TestCase("ctime and mtime") {}
-
- void run()
- {
- FSEntry a("fs_entry_TEST_dir");
- FSEntry b("fs_entry_TEST_dir/no_perms");
- FSEntry c("fs_entry_TEST_dir/no_such_file");
- FSEntry d("fs_entry_TEST_dir/dir_a/dir_in_a");
-
- TEST_CHECK(a.ctime() <= std::time(NULL));
- TEST_CHECK(b.ctime() <= std::time(NULL));
- TEST_CHECK((b.mtime() >= b.ctime()) && (b.mtime() <= std::time(NULL)));
- TEST_CHECK(d.ctime() <= std::time(NULL));
- TEST_CHECK((d.mtime() >= d.ctime()) && (d.mtime() <= std::time(NULL)));
-
- TEST_CHECK_THROWS(c.ctime(), FSError);
- TEST_CHECK_THROWS(c.mtime(), FSError);
- }
- } test_fs_entry_time;
-
- /**
* \test Test FSEntry file_size
*
* \ingroup grpfilesystem
diff --git a/paludis/util/fs_entry_TEST_setup.sh b/paludis/util/fs_entry_TEST_setup.sh
index 7d9e1e2..9c44686 100755
--- a/paludis/util/fs_entry_TEST_setup.sh
+++ b/paludis/util/fs_entry_TEST_setup.sh
@@ -10,9 +10,11 @@ touch dir_a/file_in_a || exit 6
touch all_perms || exit 7
chmod 777 all_perms || exit 8
touch no_perms || exit 9
+sleep 1
chmod 000 no_perms || exit 10
mkdir dir_a/dir_in_a
echo -n '0123456789' > ten_bytes || exit 11
ln -s dir_a/file_in_a symlink_to_file_in_a || exit 12
+sleep 1