Skip to content

Commit

Permalink
Some fixes for Python scripts
Browse files Browse the repository at this point in the history
* Enforce Python3 for all scripts
* Use UTF-8 encoding in report in main script
  * Required for Python 3
* Better argument parsing in main script
  * e.g. allows passing multiple C++ flags to CMake
* Made modified scripts executable
  • Loading branch information
ProGTX committed Aug 16, 2019
1 parent d73d093 commit 86f5aca
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion clangformat.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
# run clang format over all files
#
Expand Down Expand Up @@ -56,4 +57,5 @@ def main( ):
return

# call the entry point
main( )
if __name__ == "__main__":
main()
8 changes: 5 additions & 3 deletions run_conformance_tests.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import os
import subprocess
import sys
Expand Down Expand Up @@ -104,6 +105,7 @@ def generate_cmake_call(cmake_exe, build_system_name, conformance_filter,
Generates a CMake call based on the input in a form accepted by
subprocess.call().
"""
import shlex
return [
cmake_exe,
'..',
Expand All @@ -113,7 +115,7 @@ def generate_cmake_call(cmake_exe, build_system_name, conformance_filter,
'-Dhost_device_name=' + host_names[1],
'-Dopencl_platform_name=' + opencl_names[0],
'-Dopencl_device_name=' + opencl_names[1],
] + additional_cmake_args.split()
] + shlex.split(additional_cmake_args)


def subprocess_call(parameter_list):
Expand Down Expand Up @@ -290,7 +292,7 @@ def update_xml_attribs(host_info_json, opencl_info_json, implementation_name,
return test_xml_root


def main(argv=sys.argv):
def main(argv=sys.argv[1:]):

# Parse and gather all the script args
(cmake_exe, build_system_name, build_system_call, conformance_filter,
Expand Down Expand Up @@ -332,7 +334,7 @@ def main(argv=sys.argv):
result_xml_root.append(stylesheet_xml_root[0])

# Get the xml results as a string and append them to the report header.
report = REPORT_HEADER + ET.tostring(result_xml_root)
report = REPORT_HEADER + ET.tostring(result_xml_root).decode("utf-8")

with open("conformance_report.xml", 'w') as final_conformance_report:
final_conformance_report.write(report)
Expand Down
2 changes: 1 addition & 1 deletion runtests.py 100644 → 100755
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
################################################################################
##
## SYCL 1.2.1 Conformance Test Suite
Expand Down
2 changes: 1 addition & 1 deletion tests/math_builtin_api/generate_math_builtin.py 100644 → 100755
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
################################################################################
##
## SYCL 1.2.1 Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_alias/generate_vector_alias.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_api/generate_vector_api.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_constructors/generate_vector_constructors.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_load_store/generate_vector_load_store.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_operators/generate_vector_operators.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_swizzle_assignment/generate_vector_swizzle_assignment.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_swizzles/generate_vector_swizzles.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down
1 change: 1 addition & 0 deletions tests/vector_swizzles_opencl/generate_vector_swizzles_opencl.py 100644 → 100755
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
Expand Down

0 comments on commit 86f5aca

Please sign in to comment.