summaryrefslogtreecommitdiffstats
path: root/tools/isolate/trace_inputs_test.py
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 01:17:19 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 01:17:19 +0000
commitbb6305b531bb0e5e714d16d6bf5bb0168c876d31 (patch)
tree971296be3701cf3f975133b416e2bd4aaa9f1f62 /tools/isolate/trace_inputs_test.py
parent8bca69fa37ae9ada2aa04a3a202ad38c70141ebd (diff)
downloadchromium_src-bb6305b531bb0e5e714d16d6bf5bb0168c876d31.zip
chromium_src-bb6305b531bb0e5e714d16d6bf5bb0168c876d31.tar.gz
chromium_src-bb6305b531bb0e5e714d16d6bf5bb0168c876d31.tar.bz2
Fix mode=hashtable without --outdir to create the directory at the right place.
Improve isolate_smoke_test.py to be more representative of what's happening in chromium's gyp files. Fix tests on windows. No need to run Strace tests on Windows, they fail because of os.path.sep differences. TBR=mad@chromium.org BUG=98636 TEST= Review URL: https://chromiumcodereview.appspot.com/10383154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/isolate/trace_inputs_test.py')
-rwxr-xr-xtools/isolate/trace_inputs_test.py140
1 files changed, 71 insertions, 69 deletions
diff --git a/tools/isolate/trace_inputs_test.py b/tools/isolate/trace_inputs_test.py
index d95518c..22edf52 100755
--- a/tools/isolate/trace_inputs_test.py
+++ b/tools/isolate/trace_inputs_test.py
@@ -95,76 +95,78 @@ class TraceInputs(unittest.TestCase):
self._test(value, expected)
-class StraceInputs(unittest.TestCase):
- def _test_lines(self, lines, files, non_existent):
- context = trace_inputs.Strace.Context(lambda _: False)
- for line in lines:
- context.on_line(line)
- self.assertEquals(sorted(files), sorted(context.files))
- self.assertEquals(sorted(non_existent), sorted(context.non_existent))
-
- def test_empty(self):
- self._test_lines([], [], [])
-
- def test_close(self):
- lines = [
- '31426 close(7) = 0',
- ]
- self._test_lines(lines, [], [])
-
- def test_clone(self):
- # Grand-child with relative directory.
- lines = [
- '86 chdir("%s") = 0' % ROOT_DIR,
- '86 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID'
- '|SIGCHLD, child_tidptr=0x7f5350f829d0) = 14',
- ') = ? <unavailable>',
- '14 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID'
- '|SIGCHLD, child_tidptr=0x7f5350f829d0) = 70',
- '14 close(75) = 0',
- '70 open("%s", O_RDONLY) = 76' % os.path.basename(FILE_NAME),
- ]
- files = [
- FILE_NAME,
- ]
- self._test_lines(lines, files, [])
-
- def test_open(self):
- lines = [
- '42 chdir("/home/foo_bar_user/src") = 0',
- '42 execve("../out/unittests", '
- '["../out/unittests"...], [/* 44 vars */]) = 0',
- '42 open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 8',
- ]
- files = [
- '/home/foo_bar_user/src/../out/unittests',
- '/home/foo_bar_user/src/out/unittests.log',
- ]
- self._test_lines(lines, [], files)
-
- def test_open_resumed(self):
- lines = [
- '42 chdir("/home/foo_bar_user/src") = 0',
- '42 execve("../out/unittests", '
- '["../out/unittests"...], [/* 44 vars */]) = 0',
- '42 open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND <unfinished ...>',
- '42 <... open resumed> ) = 3',
- ]
- files = [
- '/home/foo_bar_user/src/../out/unittests',
- '/home/foo_bar_user/src/out/unittests.log',
- ]
- self._test_lines(lines, [], files)
-
- def test_sig_unexpected(self):
- lines = [
- '27 exit_group(0) = ?',
- ]
- try:
+if trace_inputs.get_flavor() == 'linux':
+ class StraceInputs(unittest.TestCase):
+ def _test_lines(self, lines, files, non_existent):
+ context = trace_inputs.Strace.Context(lambda _: False)
+ for line in lines:
+ context.on_line(line)
+ self.assertEquals(sorted(files), sorted(context.files))
+ self.assertEquals(sorted(non_existent), sorted(context.non_existent))
+
+ def test_empty(self):
+ self._test_lines([], [], [])
+
+ def test_close(self):
+ lines = [
+ '31426 close(7) = 0',
+ ]
self._test_lines(lines, [], [])
- self.fail()
- except KeyError, e:
- self.assertEqual(27, e.args[0])
+
+ def test_clone(self):
+ # Grand-child with relative directory.
+ lines = [
+ '86 chdir("%s") = 0' % ROOT_DIR,
+ '86 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID'
+ '|SIGCHLD, child_tidptr=0x7f5350f829d0) = 14',
+ ') = ? <unavailable>',
+ '14 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID'
+ '|SIGCHLD, child_tidptr=0x7f5350f829d0) = 70',
+ '14 close(75) = 0',
+ '70 open("%s", O_RDONLY) = 76' % os.path.basename(FILE_NAME),
+ ]
+ files = [
+ FILE_NAME,
+ ]
+ self._test_lines(lines, files, [])
+
+ def test_open(self):
+ lines = [
+ '42 chdir("/home/foo_bar_user/src") = 0',
+ '42 execve("../out/unittests", '
+ '["../out/unittests"...], [/* 44 vars */]) = 0',
+ '42 open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 8',
+ ]
+ files = [
+ '/home/foo_bar_user/src/../out/unittests',
+ '/home/foo_bar_user/src/out/unittests.log',
+ ]
+ self._test_lines(lines, [], files)
+
+ def test_open_resumed(self):
+ lines = [
+ '42 chdir("/home/foo_bar_user/src") = 0',
+ '42 execve("../out/unittests", '
+ '["../out/unittests"...], [/* 44 vars */]) = 0',
+ '42 open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND '
+ '<unfinished ...>',
+ '42 <... open resumed> ) = 3',
+ ]
+ files = [
+ '/home/foo_bar_user/src/../out/unittests',
+ '/home/foo_bar_user/src/out/unittests.log',
+ ]
+ self._test_lines(lines, [], files)
+
+ def test_sig_unexpected(self):
+ lines = [
+ '27 exit_group(0) = ?',
+ ]
+ try:
+ self._test_lines(lines, [], [])
+ self.fail()
+ except KeyError, e:
+ self.assertEqual(27, e.args[0])
if __name__ == '__main__':