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

Unified Diff: tools/isolate/trace_inputs_test.py

Issue 9834052: [strace] Add support for interrupted calls and proper chdir handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix isolate.py --mode=trace to use the proper variables Created 8 years, 9 months 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
« tools/isolate/trace_inputs.py ('K') | « tools/isolate/trace_inputs.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/isolate/trace_inputs_test.py
diff --git a/tools/isolate/trace_inputs_test.py b/tools/isolate/trace_inputs_test.py
index d1887a182eff49035f07c8a6f39f1d956c9db6ec..783af25dc003c82823065cae2fa6fab3c4b8caa1 100755
--- a/tools/isolate/trace_inputs_test.py
+++ b/tools/isolate/trace_inputs_test.py
@@ -33,11 +33,9 @@ class TraceInputs(unittest.TestCase):
def _execute(self, args):
cmd = [
- sys.executable, os.path.join(ROOT_DIR, 'trace_inputs.py'),
- '--log', self.log,
- '--gyp', os.path.join('data', 'trace_inputs'),
- '--product', '.', # Not tested.
- '--root-dir', ROOT_DIR,
+ sys.executable, os.path.join(ROOT_DIR, 'trace_inputs.py'),
+ '--log', self.log,
+ '--root-dir', ROOT_DIR,
] + args
p = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=ROOT_DIR)
@@ -46,6 +44,13 @@ class TraceInputs(unittest.TestCase):
raise CalledProcessError(p.returncode, cmd, out)
return out
+ @staticmethod
+ def _gyp():
+ return [
+ '--gyp', os.path.join('data', 'trace_inputs'),
+ '--product', '.', # Not tested.
+ ]
+
def test_trace(self):
if sys.platform == 'linux2':
return self._test_trace_linux()
@@ -53,8 +58,28 @@ class TraceInputs(unittest.TestCase):
return self._test_trace_mac()
print 'Unsupported: %s' % sys.platform
+ def test_trace_gyp(self):
+ if sys.platform == 'linux2':
+ return self._test_trace_gyp_linux()
+ if sys.platform == 'darwin':
+ return self._test_trace_gyp_mac()
+ print 'Unsupported: %s' % sys.platform
+
def _test_trace_linux(self):
- # TODO(maruel): BUG: Note that child.py is missing.
+ expected = (
+ "Total: 4\n"
+ "Non existent: 0\n"
+ "Interesting: 4 reduced to 3\n"
+ " data/trace_inputs/\n"
+ " trace_inputs.py\n"
+ " trace_inputs_test.py\n")
+ actual = self._execute(
+ ['trace_inputs_test.py', '--child1']).splitlines(True)
+ self.assertTrue(actual[0].startswith('Tracing... ['))
+ self.assertTrue(actual[1].startswith('Loading traces... '))
+ self.assertEquals(expected, ''.join(actual[2:]))
+
+ def _test_trace_gyp_linux(self):
expected = (
"{\n"
" 'variables': {\n"
@@ -63,16 +88,32 @@ class TraceInputs(unittest.TestCase):
" '<(DEPTH)/trace_inputs_test.py',\n"
" ],\n"
" 'isolate_dirs': [\n"
+ " './',\n"
" ],\n"
" },\n"
"},\n")
- gyp = self._execute(['trace_inputs_test.py', '--child1'])
- self.assertEquals(expected, gyp)
+ actual = self._execute(self._gyp() + ['trace_inputs_test.py', '--child1'])
+ self.assertEquals(expected, actual)
def _test_trace_mac(self):
# It is annoying in the case of dtrace because it requires root access.
# TODO(maruel): BUG: Note that child.py is missing.
expected = (
+ "Total: 2\n"
+ "Non existent: 0\n"
+ "Interesting: 2 reduced to 2\n"
+ " trace_inputs.py\n"
+ " trace_inputs_test.py\n")
+ actual = self._execute(
+ ['trace_inputs_test.py', '--child1']).splitlines(True)
+ self.assertTrue(actual[0].startswith('Tracing... ['))
+ self.assertTrue(actual[1].startswith('Loading traces... '))
+ self.assertEquals(expected, ''.join(actual[2:]))
+
+ def _test_trace_gyp_mac(self):
+ # It is annoying in the case of dtrace because it requires root access.
+ # TODO(maruel): BUG: Note that child.py is missing.
+ expected = (
"{\n"
" 'variables': {\n"
" 'isolate_files': [\n"
@@ -83,8 +124,8 @@ class TraceInputs(unittest.TestCase):
" ],\n"
" },\n"
"},\n")
- gyp = self._execute(['trace_inputs_test.py', '--child1'])
- self.assertEquals(expected, gyp)
+ actual = self._execute(self._gyp() + ['trace_inputs_test.py', '--child1'])
+ self.assertEquals(expected, actual)
def child1():
« tools/isolate/trace_inputs.py ('K') | « tools/isolate/trace_inputs.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698