cros deploy: set selinux to permissive.
File labels are not recovered on `cros deploy` currently. It may
prevent processes accessing to some file, executing some executables, or
automatic domain transition upon execution.
Before fixing the bug to recover SELinux file labels. We workaround to
set SELinux to permissive to make quick test and checking possible again
on enforced domains with `cros deploy` without the need to build_images.
BUG=chromium:932156
TEST=cros deploy crash-reporter
TEST=getenforce => Permissive
TEST=grep permissive /etc/selinux/config
Change-Id: Ie2b482d992db4ecabe208037fad48d1942a59788
Reviewed-on: https://chromium-review.googlesource.com/1485632
Commit-Ready: Qijiang Fan <fqj@google.com>
Tested-by: Qijiang Fan <fqj@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/cli/deploy_unittest.py b/cli/deploy_unittest.py
index 555decc..b104102 100644
--- a/cli/deploy_unittest.py
+++ b/cli/deploy_unittest.py
@@ -298,6 +298,8 @@
deploy, '_GetPackagesByCPV', side_effect=self.FakeGetPackagesByCPV)
self.emerge = self.PatchObject(deploy, '_Emerge', return_value=None)
self.unmerge = self.PatchObject(deploy, '_Unmerge', return_value=None)
+ self.selinux = self.PatchObject(
+ deploy, '_SetSELinuxPermissive', return_value=None)
def testDeployEmerge(self):
"""Test that deploy._Emerge is called for each package."""
@@ -319,6 +321,7 @@
# Check that deploy._Emerge is called the right number of times.
self.assertEqual(self.emerge.call_count, len(packages))
self.assertEqual(self.unmerge.call_count, 0)
+ self.assertEqual(self.selinux.call_count, 1)
def testDeployUnmerge(self):
"""Test that deploy._Unmerge is called for each package."""
@@ -331,6 +334,7 @@
# Check that deploy._Unmerge is called the right number of times.
self.assertEqual(self.emerge.call_count, 0)
self.assertEqual(self.unmerge.call_count, len(packages))
+ self.assertEqual(self.selinux.call_count, 1)
def testDeployMergeWithProgressBar(self):
"""Test that BrilloDeployOperation.Run() is called for merge."""