Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py

Issue 750093007: [Telemetry] Fix sudoers file parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CL to land Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/platform/posix_platform_backend.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py
diff --git a/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py b/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py
index 4c83697da1453af97dc2df364610b2a6c4a19a58..eed5c0cd27e387f45fe66effa75d190036165332 100644
--- a/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py
+++ b/tools/telemetry/telemetry/core/platform/posix_platform_backend_unittest.py
@@ -51,6 +51,31 @@ class PosixPlatformBackendTest(unittest.TestCase):
result = backend.GetChildPids(1)
self.assertEquals(set(result), set([2, 3]))
+ def testSudoersFileParsing(self):
+ binary_path = '/usr/bin/pkill'
+ self.assertFalse(
+ posix_platform_backend._BinaryExistsInSudoersFiles(binary_path, ''))
+ self.assertFalse(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,' (ALL) ALL'))
+ self.assertFalse(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,' (root) NOPASSWD: /usr/bin/pkill_DUMMY'))
+ self.assertFalse(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,' (root) NOPASSWD: pkill'))
+
+
+ self.assertTrue(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,'(root) NOPASSWD: /usr/bin/pkill'))
+ self.assertTrue(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,' (root) NOPASSWD: /usr/bin/pkill'))
+ self.assertTrue(
+ posix_platform_backend._BinaryExistsInSudoersFiles(
+ binary_path,' (root) NOPASSWD: /usr/bin/pkill arg1 arg2'))
+
@benchmark.Enabled('linux', 'mac')
def testIsApplicationRunning(self):
platform = platform_module.GetHostPlatform()
« no previous file with comments | « tools/telemetry/telemetry/core/platform/posix_platform_backend.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698