[PATCH] Let tests run inside a mock chroot & fix crypto test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the path code from run_tests.py to let whatever is running it
specify the location of anaconda to be tested (eg. git vs. installed)

Add check for existance of /var/log so it will run inside a mock chroot
without syslog

Fix crypto checks to replace RuntimeError with crypto.CryptoError

For the storage tests to work inside a mock chroot the loop devices need
to have been created, like this:

for i in $(seq 0 7); do
    mknod /dev/loop$i b 7 $i
done
---
 anaconda_log.py                    |    3 +++
 run_test.py                        |    6 ------
 tests/storage/devicelibs/crypto.py |    4 ++--
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/anaconda_log.py b/anaconda_log.py
index b6f26f4..c180eb3 100644
--- a/anaconda_log.py
+++ b/anaconda_log.py
@@ -140,6 +140,9 @@ class AnacondaLog:
     def forwardToSyslog(self, logger):
         """Forward everything that goes in the logger to the syslog daemon.
         """
+        if not os.access( "/dev/log", os.W_OK ):
+            return
+
         syslogHandler = AnacondaSyslogHandler(
             '/dev/log', 
             ANACONDA_SYSLOG_FACILITY,
diff --git a/run_test.py b/run_test.py
index 2a7ad2d..471e169 100755
--- a/run_test.py
+++ b/run_test.py
@@ -1,13 +1,7 @@
 #!/usr/bin/python
 #-*- coding:utf-8 -*-
 
-from distutils.sysconfig import get_python_lib
 import sys
-
-REQUIRED_PATHS = ["%s/pyanaconda" % get_python_lib(plat_specific=1),
-                  "/usr/share/system-config-date"]
-sys.path.extend(REQUIRED_PATHS)
-
 import unittest
 import tests
 import string
diff --git a/tests/storage/devicelibs/crypto.py b/tests/storage/devicelibs/crypto.py
index 772ef09..993a6fa 100755
--- a/tests/storage/devicelibs/crypto.py
+++ b/tests/storage/devicelibs/crypto.py
@@ -57,13 +57,13 @@ class CryptoTestCase(baseclass.DevicelibsTestCase):
         self.assertEqual(crypto.luks_add_key(self._LOOP_DEV1, new_key_file=new_keyfile, key_file=keyfile), None)
 
         # fail
-        self.assertRaises(RuntimeError, crypto.luks_add_key, self._LOOP_DEV0, new_passphrase="another-secret", passphrase="wrong-passphrase")
+        self.assertRaises(crypto.CryptoError, crypto.luks_add_key, self._LOOP_DEV0, new_passphrase="another-secret", passphrase="wrong-passphrase")
 
         ##
         ## luks_remove_key
         ##
         # fail
-        self.assertRaises(RuntimeError, crypto.luks_remove_key, self._LOOP_DEV0, del_passphrase="another-secret", passphrase="wrong-pasphrase")
+        self.assertRaises(crypto.CryptoError, crypto.luks_remove_key, self._LOOP_DEV0, del_passphrase="another-secret", passphrase="wrong-pasphrase")
 
         # pass
         self.assertEqual(crypto.luks_remove_key(self._LOOP_DEV0, del_passphrase="another-secret", passphrase="secret"), None)
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux