mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Add Python 3 support to run_conformance.py (#1470)
This commit is contained in:
@@ -16,7 +16,6 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import tempfile
|
import tempfile
|
||||||
import string
|
|
||||||
|
|
||||||
DEBUG = 0
|
DEBUG = 0
|
||||||
|
|
||||||
@@ -27,7 +26,6 @@ process_pid = 0
|
|||||||
# to the screen while the tests are running.
|
# to the screen while the tests are running.
|
||||||
seconds_between_status_updates = 60 * 60 * 24 * 7 # effectively never
|
seconds_between_status_updates = 60 * 60 * 24 * 7 # effectively never
|
||||||
|
|
||||||
|
|
||||||
# Help info
|
# Help info
|
||||||
def write_help_info():
|
def write_help_info():
|
||||||
print("run_conformance.py test_list [CL_DEVICE_TYPE(s) to test] [partial-test-names, ...] [log=path/to/log/file/]")
|
print("run_conformance.py test_list [CL_DEVICE_TYPE(s) to test] [partial-test-names, ...] [log=path/to/log/file/]")
|
||||||
@@ -66,16 +64,16 @@ def get_tests(filename, devices_to_test):
|
|||||||
device_specific_match = re.search("^\s*(.+?)\s*,\s*(.+?)\s*,\s*(.+?)\s*$", line)
|
device_specific_match = re.search("^\s*(.+?)\s*,\s*(.+?)\s*,\s*(.+?)\s*$", line)
|
||||||
if device_specific_match:
|
if device_specific_match:
|
||||||
if device_specific_match.group(1) in devices_to_test:
|
if device_specific_match.group(1) in devices_to_test:
|
||||||
test_path = string.replace(device_specific_match.group(3), '/', os.sep)
|
test_path = str.replace(device_specific_match.group(3), '/', os.sep)
|
||||||
test_name = string.replace(device_specific_match.group(2), '/', os.sep)
|
test_name = str.replace(device_specific_match.group(2), '/', os.sep)
|
||||||
tests.append((test_name, test_path))
|
tests.append((test_name, test_path))
|
||||||
else:
|
else:
|
||||||
print("Skipping " + device_specific_match.group(2) + " because " + device_specific_match.group(1) + " is not in the list of devices to test.")
|
print("Skipping " + device_specific_match.group(2) + " because " + device_specific_match.group(1) + " is not in the list of devices to test.")
|
||||||
continue
|
continue
|
||||||
match = re.search("^\s*(.+?)\s*,\s*(.+?)\s*$", line)
|
match = re.search("^\s*(.+?)\s*,\s*(.+?)\s*$", line)
|
||||||
if match:
|
if match:
|
||||||
test_path = string.replace(match.group(2), '/', os.sep)
|
test_path = str.replace(match.group(2), '/', os.sep)
|
||||||
test_name = string.replace(match.group(1), '/', os.sep)
|
test_name = str.replace(match.group(1), '/', os.sep)
|
||||||
tests.append((test_name, test_path))
|
tests.append((test_name, test_path))
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
@@ -243,7 +241,10 @@ def run_tests(tests):
|
|||||||
# Catch an interrupt from the user
|
# Catch an interrupt from the user
|
||||||
write_screen_log("\nFAILED: Execution interrupted. Killing test process, but not aborting full test run.")
|
write_screen_log("\nFAILED: Execution interrupted. Killing test process, but not aborting full test run.")
|
||||||
os.kill(process_pid, 9)
|
os.kill(process_pid, 9)
|
||||||
answer = raw_input("Abort all tests? (y/n)")
|
if sys.version_info[0] < 3:
|
||||||
|
answer = raw_input("Abort all tests? (y/n)")
|
||||||
|
else:
|
||||||
|
answer = input("Abort all tests? (y/n)")
|
||||||
if answer.find("y") != -1:
|
if answer.find("y") != -1:
|
||||||
write_screen_log("\nUser chose to abort all tests.")
|
write_screen_log("\nUser chose to abort all tests.")
|
||||||
log_file.close()
|
log_file.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user