| Index: visual_studio/NativeClientVSAddIn/check_test_results.py
 | 
| diff --git a/visual_studio/NativeClientVSAddIn/check_test_results.py b/visual_studio/NativeClientVSAddIn/check_test_results.py
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..6249897961d65ad576aee60a7a4a826d789faf09
 | 
| --- /dev/null
 | 
| +++ b/visual_studio/NativeClientVSAddIn/check_test_results.py
 | 
| @@ -0,0 +1,44 @@
 | 
| +#!/usr/bin/env python
 | 
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved.
 | 
| +# Use of this source code is governed by a BSD-style license that can be
 | 
| +# found in the LICENSE file.
 | 
| +
 | 
| +""" This script will parse the results file produced by MSTest.
 | 
| +
 | 
| +The script takes a single argument containing the path to the Results.trx
 | 
| +file to parse. It will log relevant test run information, and exit with code 0
 | 
| +if all tests passed, or code 1 if some test failed.
 | 
| +"""
 | 
| +
 | 
| +import sys
 | 
| +import xml.etree.ElementTree
 | 
| +
 | 
| +MSTEST_NAMESPACE = 'http://microsoft.com/schemas/VisualStudio/TeamTest/2010'
 | 
| +
 | 
| +def main():
 | 
| +  if len(sys.argv) < 2:
 | 
| +    print 'Must provide path to the Results.trx file'
 | 
| +    return 1
 | 
| +
 | 
| +  # Parse the xml results file
 | 
| +  tree = xml.etree.ElementTree.parse(sys.argv[1])
 | 
| +  root = tree.getroot()
 | 
| +  results_node = root.find('{%s}Results' % MSTEST_NAMESPACE)
 | 
| +  results = results_node.findall('{%s}UnitTestResult' % MSTEST_NAMESPACE)
 | 
| +  test_run_name = root.attrib['name']
 | 
| +
 | 
| +  exit_code = 0
 | 
| +
 | 
| +  # Print the results, note any failures by setting exit_code to 1
 | 
| +  print test_run_name
 | 
| +  for result in results:
 | 
| +    if result.attrib['outcome'] != 'Passed':
 | 
| +      exit_code = 1
 | 
| +    print 'Test: %s, Duration: %s, Outcome: %s\n' % (
 | 
| +      result.attrib['testName'], result.attrib['duration'],
 | 
| +      result.attrib['outcome'])
 | 
| +
 | 
| +  return exit_code
 | 
| +
 | 
| +if __name__ == '__main__':
 | 
| +  sys.exit(main())
 | 
| 
 |