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

Unified Diff: tools/foozzie/v8_foozzie_test.py

Issue 2585193003: [foozzie] Add some system tests. (Closed)
Patch Set: Review Created 4 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/foozzie/v8_foozzie.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/foozzie/v8_foozzie_test.py
diff --git a/tools/foozzie/v8_foozzie_test.py b/tools/foozzie/v8_foozzie_test.py
index de5516f80685e9fce35dd568c9666a9e3a3881f2..be085035ac2d05cedf5b672d93edbb83afb74f89 100644
--- a/tools/foozzie/v8_foozzie_test.py
+++ b/tools/foozzie/v8_foozzie_test.py
@@ -2,11 +2,19 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
+import subprocess
+import sys
import unittest
+import v8_foozzie
import v8_suppressions
-class FuzzerTest(unittest.TestCase):
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+FOOZZIE = os.path.join(BASE_DIR, 'v8_foozzie.py')
+TEST_DATA = os.path.join(BASE_DIR, 'testdata')
+
+class UnitTest(unittest.TestCase):
def testDiff(self):
# TODO(machenbach): Mock out suppression configuration.
suppress = v8_suppressions.get_suppression(
@@ -75,3 +83,29 @@ otherfile.js: TypeError: undefined is not a constructor
diff = """- somefile.js: TypeError: undefined is not a constructor
+ otherfile.js: TypeError: undefined is not a constructor"""
self.assertEquals(diff, suppress.diff(one, two))
+
+
+def run_foozzie(first_d8, second_d8):
+ return subprocess.check_output([
+ sys.executable, FOOZZIE,
+ '--random-seed', '12345',
+ '--first-d8', os.path.join(TEST_DATA, first_d8),
+ '--second-d8', os.path.join(TEST_DATA, second_d8),
+ '--second-config', 'ignition_staging',
+ os.path.join(TEST_DATA, 'fuzz-test1.js'),
+ ])
+
+
+class SystemTest(unittest.TestCase):
+ def testSyntaxErrorDiffPass(self):
+ stdout = run_foozzie('test_d8_1.py', 'test_d8_2.py')
+ self.assertEquals('# V8 correctness - pass\n', stdout)
+
+ def testDifferentOutputFail(self):
+ with open(os.path.join(TEST_DATA, 'failure_output.txt')) as f:
+ expected_output = f.read()
+ with self.assertRaises(subprocess.CalledProcessError) as ctx:
+ run_foozzie('test_d8_1.py', 'test_d8_3.py')
+ e = ctx.exception
+ self.assertEquals(v8_foozzie.RETURN_FAIL, e.returncode)
+ self.assertEquals(expected_output, e.output)
« no previous file with comments | « tools/foozzie/v8_foozzie.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698