cbuildbot_launch: Setup umask before starting build.
When cbuildbot_launch is invoked, umask may be set to an arbitrary
value, so fix it up to a known value.
Added a new unittest, and it passes in isolation, but fails when run
in parallel with other tests, so I marked it as skip, for now.
BUG=chromium:710900
TEST=cbuildbot_launch_test
Change-Id: I67dddde806813332782eeecf7d5c8d9921e8cb26
Reviewed-on: https://chromium-review.googlesource.com/476073
Tested-by: Don Garrett <dgarrett@chromium.org>
Trybot-Ready: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cbuildbot_launch_unittest.py b/scripts/cbuildbot_launch_unittest.py
index 38319eb..b7d8263 100644
--- a/scripts/cbuildbot_launch_unittest.py
+++ b/scripts/cbuildbot_launch_unittest.py
@@ -8,6 +8,7 @@
import mock
import os
+import unittest
from chromite.cbuildbot import repository
from chromite.lib import cros_build_lib
@@ -78,6 +79,26 @@
])
+class CbuildbotLaunchGlobalTest(cros_test_lib.TestCase):
+ """Validate our global setup function."""
+ def setUp(self):
+ self.originalSudo = cros_build_lib.STRICT_SUDO
+ self.originalUmask = os.umask(0) # Have to set it to read it, make it bogus
+
+ def teardown(self):
+ cros_build_lib.STRICT_SUDO = self.originalSudo
+ os.umask(self.originalUmask)
+
+ @unittest.skip("Global side effects break other tests. Run serially?")
+ def testConfigureGlobalEnvironment(self):
+ cros_build_lib.STRICT_SUDO = False
+
+ cbuildbot_launch.ConfigureGlobalEnvironment()
+
+ self.assertTrue(cros_build_lib.STRICT_SUDO)
+ self.assertEqual(os.umask(0), 0o22)
+
+
class RunTests(cros_build_lib_unittest.RunCommandTestCase):
"""Tests for cbuildbot_launch script."""