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

Unified Diff: build/android/pylib/gtest/gtest_test_instance_test.py

Issue 2014333002: [Android] Fix unknown handling in gtest_test_instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable failing tests Created 4 years, 7 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
Index: build/android/pylib/gtest/gtest_test_instance_test.py
diff --git a/build/android/pylib/gtest/gtest_test_instance_test.py b/build/android/pylib/gtest/gtest_test_instance_test.py
index c52b2354c4183663890327e471e6306c1db2997f..910ac40fe0709b38e4f5b009f2e6907c36adde40 100755
--- a/build/android/pylib/gtest/gtest_test_instance_test.py
+++ b/build/android/pylib/gtest/gtest_test_instance_test.py
@@ -5,6 +5,7 @@
import unittest
+from pylib.base import base_test_result
from pylib.gtest import gtest_test_instance
@@ -80,6 +81,77 @@ class GtestTestInstanceTests(unittest.TestCase):
]
self.assertEqual(expected, actual)
+ def testParseGTestOutput_pass(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ '[ OK ] FooTest.Bar (1 ms)',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(1, len(actual))
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(1, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.PASS, actual[0].GetType())
+
+ def testParseGTestOutput_fail(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ '[ FAILED ] FooTest.Bar (1 ms)',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(1, len(actual))
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(1, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.FAIL, actual[0].GetType())
+
+ def testParseGTestOutput_crash(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ '[ CRASHED ] FooTest.Bar (1 ms)',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(1, len(actual))
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(1, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.CRASH, actual[0].GetType())
+
+ def testParseGTestOutput_errorCrash(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ '[ERROR:blah] Currently running: FooTest.Bar',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(1, len(actual))
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(0, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.CRASH, actual[0].GetType())
+
+ def testParseGTestOutput_unknown(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(1, len(actual))
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(0, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.UNKNOWN, actual[0].GetType())
+
+ def testParseGTestOutput_nonterminalUnknown(self):
+ raw_output = [
+ '[ RUN ] FooTest.Bar',
+ '[ RUN ] FooTest.Baz',
+ '[ OK ] FooTest.Baz (1 ms)',
+ ]
+ actual = gtest_test_instance.ParseGTestOutput(raw_output)
+ self.assertEquals(2, len(actual))
+
+ self.assertEquals('FooTest.Bar', actual[0].GetName())
+ self.assertEquals(0, actual[0].GetDuration())
+ self.assertEquals(base_test_result.ResultType.UNKNOWN, actual[0].GetType())
+
+ self.assertEquals('FooTest.Baz', actual[1].GetName())
+ self.assertEquals(1, actual[1].GetDuration())
+ self.assertEquals(base_test_result.ResultType.PASS, actual[1].GetType())
+
if __name__ == '__main__':
unittest.main(verbosity=2)
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | build/android/pylib/local/device/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698