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

Unified Diff: lib/cros_build_lib_unittest.py

Issue 6672007: Add logs for update_engine and image_to_live to test artifacts. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fix bug in RunCommand Created 9 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
« no previous file with comments | « lib/cros_build_lib.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cros_build_lib_unittest.py
diff --git a/lib/cros_build_lib_unittest.py b/lib/cros_build_lib_unittest.py
index bb3f9d6e4e2d3ba734ad800e6b8c30e4a74b0237..293bff15ab004515c9ddac04f5c5bbbd2b4e105a 100755
--- a/lib/cros_build_lib_unittest.py
+++ b/lib/cros_build_lib_unittest.py
@@ -6,6 +6,8 @@
"""Unit tests for cros_build_lib."""
+import os
+import tempfile
import unittest
import cros_build_lib
@@ -87,6 +89,20 @@ class CrosBuildLibTest(unittest.TestCase):
redirect_stderr=True)
self.assertEqual(result, 'Hi')
+ def testRunCommandLogToFile(self):
+ """Test that RunCommand can log output to a file correctly."""
+ log_file = tempfile.mktemp()
+ cros_build_lib.RunCommand(['echo', '-n', 'Hi'],
+ # Keep the test quiet options
+ print_cmd=False,
+ # Test specific options
+ log_to_file=log_file)
+ log_fh = open(log_file)
+ log_data = log_fh.read()
+ self.assertEquals('Hi', log_data)
+ log_fh.close()
+ os.remove(log_file)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « lib/cros_build_lib.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698