From 4c828803cd88e8bee01c2b9312974ed7772b0bb5 Mon Sep 17 00:00:00 2001 From: Tomas Tomecek Date: Apr 25 2017 10:42:53 +0000 Subject: add a way to skip SELinux disabling Fixes https://pagure.io/modularity-testing-framework/issue/40 Signed-off-by: Tomas Tomecek --- diff --git a/README.md b/README.md index 2c8ad9d..7ea404b 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ dnf -y install docker python-pip * Your __run_tests.sh__ should contain: * __Docker based module testing:__ ```MODULE=docker avocado run /usr/share/moduleframework/tools/modulelint.py ./*.py``` * __Rpm based module testing:__ ```MODULE=rpm avocado run /usr/share/moduleframework/tools/modulelint.py ./*.py``` + * You can skip disabling SELinux by setting environment variable `MTF_SKIP_DISABLING_SELINUX`: + * `MTF_SKIP_DISABLING_SELINUX=true avocado run ...` * `make check` - runs tests in your module directory ## How to write tests diff --git a/moduleframework/module_framework.py b/moduleframework/module_framework.py index 133d88d..835ea5c 100644 --- a/moduleframework/module_framework.py +++ b/moduleframework/module_framework.py @@ -397,9 +397,10 @@ class NspawnHelper(RpmHelper): def setUp(self): self.installTestDependencies() -# TODO: workaround because systemd nspawn is now working well in F-25 -# (failing because of selinux) - self.runHost("setenforce 0", ignore_status=True) + if not os.environ.get('MTF_SKIP_DISABLING_SELINUX'): + # TODO: workaround because systemd nspawn is now working well in F-25 + # (failing because of selinux) + self.runHost("setenforce 0", ignore_status=True) self.__prepare() self.__prepareSetup() self.__callSetupFromConfig() @@ -509,9 +510,10 @@ gpgcheck=0 # self.nspawncont.stop() time.sleep(10) self.__callCleanupFromConfig() -# TODO: workaround because systemd nspawn is now working well in F-25 -# (failing because of selinux) - self.runHost("setenforce 1", ignore_status=True) + if not os.environ.get('MTF_SKIP_DISABLING_SELINUX'): + # TODO: workaround because systemd nspawn is now working well in F-25 + # (failing because of selinux) + self.runHost("setenforce 1", ignore_status=True) def __callSetupFromConfig(self): if self.info.get("setup"):