Revert "Update test.py to python3"
This reverts commit 80c863cdb91fb82c7f575af2f239a7a79010f4e4.
Seems to cause the bots to time out.
Change-Id: I567569d5b39ff83532f29768a154c9299ef14b19
diff --git a/tools/test.py b/tools/test.py
index 1d158b7..157bd28 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@@ -14,7 +14,7 @@
import shutil
import subprocess
import sys
-import threading
+import thread
import time
import uuid
@@ -190,8 +190,8 @@
destination = 'gs://%s/%s' % (BUCKET, u_dir)
utils.upload_dir_to_cloud_storage(upload_dir, destination, is_html=True)
url = 'https://storage.googleapis.com/%s/%s/test/index.html' % (BUCKET, u_dir)
- print('Test results available at: %s' % url)
- print('@@@STEP_LINK@Test failures@%s@@@' % url)
+ print 'Test results available at: %s' % url
+ print '@@@STEP_LINK@Test failures@%s@@@' % url
def Main():
(options, args) = ParseOptions()
@@ -341,7 +341,7 @@
if args is None:
return 1
if len(args) == 0:
- print("No failing tests")
+ print "No failing tests"
return 0
# Test filtering. Must always follow the 'test' task.
for testFilter in args:
@@ -368,7 +368,7 @@
print_stacks_timeout = (print_stacks_timeout
if print_stacks_timeout != -1
else TIMEOUT_HANDLER_PERIOD)
- threading.Thread(target=timeout_handler, args=(timestamp_file, print_stacks_timeout)).start()
+ thread.start_new_thread(timeout_handler, (timestamp_file, print_stacks_timeout,))
rotate_test_reports()
if options.only_jctf:
@@ -379,7 +379,7 @@
# Now run tests on selected runtime(s).
if options.runtimes:
if options.dex_vm != 'default':
- print('Unexpected runtimes and dex_vm argument: ' + options.dex_vm)
+ print 'Unexpected runtimes and dex_vm argument: ' + options.dex_vm
sys.exit(1)
if options.runtimes == 'empty':
# Set runtimes with no content will configure no runtimes.
@@ -393,9 +393,9 @@
for prefix in prefixes:
matches = [ rt for rt in VALID_RUNTIMES if rt.startswith(prefix) ]
if len(matches) == 0:
- print("Invalid runtime prefix '%s'." % prefix)
- print("Must be just 'all', 'empty'," \
- " or a prefix of %s" % ', '.join(VALID_RUNTIMES))
+ print "Invalid runtime prefix '%s'." % prefix
+ print "Must be just 'all', 'empty'," \
+ " or a prefix of %s" % ', '.join(VALID_RUNTIMES)
sys.exit(1)
runtimes.extend(matches)
gradle_args.append('-Pruntimes=%s' % ':'.join(runtimes))
@@ -472,7 +472,7 @@
last_timestamp = new_timestamp
def report_dir_path(index):
- if index == 0:
+ if index is 0:
return REPORTS_PATH
return '%s%d' % (REPORTS_PATH, index)
@@ -494,7 +494,7 @@
def compute_failed_tests(args):
if len(args) > 1:
- print("Running with --failed can take an optional path to a report index (or report number).")
+ print "Running with --failed can take an optional path to a report index (or report number)."
return None
report = report_index_path(0)
# If the default report does not exist, fall back to the previous report as it may be a failed
@@ -512,9 +512,9 @@
# if integer parsing failed assume it is a report file path.
report = args[0]
if not os.path.exists(report):
- print("Can't re-run failing, no report at:", report)
+ print "Can't re-run failing, no report at:", report
return None
- print("Reading failed tests in", report)
+ print "Reading failed tests in", report
failing = set()
inFailedSection = False
for line in file(report):