Add status.log file to failed test subdirectory for gtest suites.

Create the status.log file needed by generate_test_report.py to understand the failed gtest subtests.

BUG=None.
TEST=Running browsertests locally and verifying generate_test_report.py and run_generate emails.

Change-Id: I309ae36dc4018e7c274ba1446169d1a1b17f19b7
Reviewed-on: http://gerrit.chromium.org/gerrit/795
Reviewed-by: Dale Curtis <[email protected]>
Reviewed-by: Paul Pendlebury <[email protected]>
Tested-by: Paul Pendlebury <[email protected]>
diff --git a/server/gtest_runner.py b/server/gtest_runner.py
index 5efc0fb..42955e8 100644
--- a/server/gtest_runner.py
+++ b/server/gtest_runner.py
@@ -96,15 +96,25 @@
            message: Reason test failed, will be put in status.log file.
            error_lines: Additional failure info, will be put in ERROR log.
         """
-        self._host.record('START', None, failed_test)
-        self._host.record('INFO', None, 'FAILED: ' + failed_test)
-        self._host.record('END FAIL', None, failed_test, message)
+        # Create a test name subdirectory to hold the test status.log file.
+        test_dir = os.path.join(self._results_dir, failed_test)
+        if not os.path.exists(test_dir):
+            try:
+                os.makedirs(test_dir)
+            except OSError:
+                logging.exception('Failed to created test directory: %s',
+                                  test_dir)
+
+        # Record failure into the global job and test specific status files.
+        self._host.record('START', failed_test, failed_test)
+        self._host.record('INFO', failed_test, 'FAILED: ' + failed_test)
+        self._host.record('END FAIL', failed_test, failed_test, message)
 
         # If we have additional information on the failure, create an error log
         # file for this test in the location a normal autotest would have left
         # it so the frontend knows where to find it.
         if error_lines is not None:
-            fail_log_dir = os.path.join(self._results_dir, failed_test, 'debug')
+            fail_log_dir = os.path.join(test_dir, 'debug')
             fail_log_path = os.path.join(fail_log_dir, failed_test + '.ERROR')
 
             if not os.path.exists(fail_log_dir):