def RunTest(binary_path, output_dir, options): """Run test with options. Args: binary_path: The path of unittest. output_dir: The directory of output results. options: options to be passed to the unittest. """ binary_filename = os.path.basename(binary_path) tmp_xml_path = os.path.join(output_dir, '%s.xml.running' % binary_filename) test_options = options[:] test_options.extend(['--gunit_output=xml:%s' % tmp_xml_path, '--gtest_output=xml:%s' % tmp_xml_path]) RunOrDie([binary_path] + test_options) xml_path = os.path.join(output_dir, '%s.xml' % binary_filename) CopyFile(tmp_xml_path, xml_path) RemoveFile(tmp_xml_path)
def RunTestOnIos(binary_path, output_dir, _): """Run test with options. Args: binary_path: The path of unittest. output_dir: The directory of output results. _: Unused arg for the compatibility with RunTest. """ iossim = '%s/third_party/iossim/iossim' % MOZC_ROOT binary_filename = os.path.basename(binary_path) tmp_xml_path = os.path.join(output_dir, '%s.xml.running' % binary_filename) env_options = [ '-e', 'GUNIT_OUTPUT=xml:%s' % tmp_xml_path, '-e', 'GTEST_OUTPUT=xml:%s' % tmp_xml_path, ] RunOrDie([iossim] + env_options + [binary_path]) xml_path = os.path.join(output_dir, '%s.xml' % binary_filename) CopyFile(tmp_xml_path, xml_path) RemoveFile(tmp_xml_path)