aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 21:18:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 21:52:37 +0000
commitdf7b85671449a10ca41f9fbe6a1fffa3f1a1fc82 (patch)
tree30c3156e9d0337877869d7efc4b4c5c9f5a1adf5
parentb03059d8a8d899ba40137b0781fba0df20c9b741 (diff)
downloadpaludis-df7b85671449a10ca41f9fbe6a1fffa3f1a1fc82.tar.gz
paludis-df7b85671449a10ca41f9fbe6a1fffa3f1a1fc82.tar.xz
Skip permission-related tests when root.
Fixes: ticket:718
-rw-r--r--paludis/util/safe_ifstream_TEST.cc7
-rw-r--r--paludis/util/safe_ofstream_TEST.cc7
2 files changed, 14 insertions, 0 deletions
diff --git a/paludis/util/safe_ifstream_TEST.cc b/paludis/util/safe_ifstream_TEST.cc
index ab3ed17..8456b51 100644
--- a/paludis/util/safe_ifstream_TEST.cc
+++ b/paludis/util/safe_ifstream_TEST.cc
@@ -21,6 +21,8 @@
#include <paludis/util/fs_entry.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
+#include <unistd.h>
+#include <sys/types.h>
using namespace test;
using namespace paludis;
@@ -85,6 +87,11 @@ namespace test_cases
{
ExistingPermTest() : TestCase("existing unreadable file") { }
+ bool skip() const
+ {
+ return 0 == getuid();
+ }
+
void run()
{
TEST_CHECK_THROWS(SafeIFStream(FSEntry::cwd() / "safe_ifstream_TEST_dir" / "existing_perm"), SafeIFStreamError);
diff --git a/paludis/util/safe_ofstream_TEST.cc b/paludis/util/safe_ofstream_TEST.cc
index 720d823..739d0f4 100644
--- a/paludis/util/safe_ofstream_TEST.cc
+++ b/paludis/util/safe_ofstream_TEST.cc
@@ -21,6 +21,8 @@
#include <paludis/util/fs_entry.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
+#include <unistd.h>
+#include <sys/types.h>
using namespace test;
using namespace paludis;
@@ -105,6 +107,11 @@ namespace test_cases
TEST_CHECK_THROWS(SafeOFStream(FSEntry::cwd() / "safe_ofstream_TEST_dir" / "existing_perm"), SafeOFStreamError);
}
+ bool skip() const
+ {
+ return 0 == getuid();
+ }
+
bool repeatable() const
{
return false;