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

Unified Diff: infra/scripts/legacy/scripts/slave/gtest/test_results_uploader.py

Issue 1213433006: Fork runtest.py and everything it needs src-side for easier hacking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: runisolatedtest.py Created 5 years, 6 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: infra/scripts/legacy/scripts/slave/gtest/test_results_uploader.py
diff --git a/infra/scripts/legacy/scripts/slave/gtest/test_results_uploader.py b/infra/scripts/legacy/scripts/slave/gtest/test_results_uploader.py
new file mode 100644
index 0000000000000000000000000000000000000000..ead70fbecaaee6490863eb96e9e4b4249ef4c1f8
--- /dev/null
+++ b/infra/scripts/legacy/scripts/slave/gtest/test_results_uploader.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2011 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.
+
+import codecs
+import socket
+
+from common import url_helper
+from slave.gtest.networktransaction import NetworkTransaction
+
+
+class TestResultsUploader(object):
+ def __init__(self, host):
+ self._host = host
+
+ def _upload_files(self, attrs, file_objs):
+ url = "http://%s/testfile/upload" % self._host
+ url_helper.upload_files(url, attrs, file_objs)
+
+ def upload(self, params, files, timeout_seconds):
+ file_objs = []
+ for filename, path in files:
+ with codecs.open(path, "rb") as f:
+ file_objs.append(('file', filename, f.read()))
+
+ orig_timeout = socket.getdefaulttimeout()
+ try:
+ socket.setdefaulttimeout(timeout_seconds)
+ NetworkTransaction(timeout_seconds=timeout_seconds).run(
+ lambda: self._upload_files(params, file_objs))
+ finally:
+ socket.setdefaulttimeout(orig_timeout)
« no previous file with comments | « infra/scripts/legacy/scripts/slave/gtest/test_result.py ('k') | infra/scripts/legacy/scripts/slave/gtest_slave_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698