diff --git a/DEPS b/DEPS index fcc781857..361da65cc 100644 --- a/DEPS +++ b/DEPS @@ -8,9 +8,9 @@ vars = { 'glslang_revision': 'a51d3d9f223361165127ded3cd2e59d81e22d91f', 'googletest_revision': '0599a7b8410dc5cfdb477900b280475ae775d7f9', 're2_revision': '90970542fe952602f42150c6e71d086f5afebcb3', - 'spirv_headers_revision': '79b6681aadcb53c27d1052e5f8a0e82a981dbf2f', - 'spirv_tools_revision': 'fde69dcd80cc1ca548300702adf01eeb25441f3e', - 'spirv_cross_revision': 'a16a181f428080a43e97509dc810f47c683c9a27', + 'spirv_headers_revision': '03a081524afabdde274d885880c2fef213e46a59', + 'spirv_tools_revision': '07f80c4df1b0619ee484c38e79a7ad71f672ca14', + 'spirv_cross_revision': 'ed55e0ac6d797a338e7c19dad785237f0efc4d86', } deps = { diff --git a/README.md b/README.md index 0f5081e7b..6e8e86b83 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,13 @@ installed regardless of your OS: - [CMake](http://www.cmake.org/): for generating compilation targets. - [Python](http://www.python.org/): for utility scripts and running the test suite. +Both Python2 and Python3 work. However, if you use Python2, you will need the +Python-future package installed: + +``` +pip install future +``` + On Linux, the following tools should be installed: - [`gcov`](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html): for testing code diff --git a/glslc/test/expect.py b/glslc/test/expect.py index 7c5251be6..c90ef8cb0 100644 --- a/glslc/test/expect.py +++ b/glslc/test/expect.py @@ -19,10 +19,12 @@ methods in the mixin classes. """ import difflib +import functools import os import re import subprocess from glslc_test_framework import GlslCTest +from builtins import bytes def convert_to_unix_line_endings(source): @@ -133,7 +135,7 @@ def read_word(binary, index, little_endian): word = binary[index * 4:(index + 1) * 4] if little_endian: word = reversed(word) - return reduce(lambda w, b: (w << 8) | ord(b), word, 0) + return functools.reduce(lambda w, b: (w << 8) | b, word, 0) def check_endianness(binary): """Checks the endianness of the given SPIR-V binary. @@ -277,7 +279,7 @@ def check_object_file_disassembly(self, status): disassembly = output[0] if not isinstance(an_input.assembly_substr, str): return False, "Missing assembly_substr member" - if an_input.assembly_substr not in disassembly: + if bytes(an_input.assembly_substr, 'utf-8') not in disassembly: return False, ('Incorrect disassembly output:\n{asm}\n' 'Expected substring not found:\n{exp}'.format( asm=disassembly, exp=an_input.assembly_substr)) @@ -442,7 +444,7 @@ def check_has_error_message(self, status): 'signal ' + str(status.returncode)) if not status.stderr: return False, 'Expected error message, but no output on stderr' - if self.expected_error != convert_to_unix_line_endings(status.stderr): + if self.expected_error != convert_to_unix_line_endings(status.stderr.decode('utf8')): return False, ('Incorrect stderr output:\n{act}\n' 'Expected:\n{exp}'.format( act=status.stderr, exp=self.expected_error)) @@ -471,7 +473,7 @@ def check_has_error_message_as_substring(self, status): 'signal ' + str(status.returncode)) if not status.stderr: return False, 'Expected error message, but no output on stderr' - if self.expected_error_substr not in convert_to_unix_line_endings(status.stderr): + if self.expected_error_substr not in convert_to_unix_line_endings(status.stderr.decode('utf8')): return False, ('Incorrect stderr output:\n{act}\n' 'Expected substring not found in stderr:\n{exp}'.format( act=status.stderr, exp=self.expected_error_substr)) @@ -491,7 +493,7 @@ def check_has_warning_message(self, status): ' glslc') if not status.stderr: return False, 'Expected warning message, but no output on stderr' - if self.expected_warning != convert_to_unix_line_endings(status.stderr): + if self.expected_warning != convert_to_unix_line_endings(status.stderr.decode('utf8')): return False, ('Incorrect stderr output:\n{act}\n' 'Expected:\n{exp}'.format( act=status.stderr, exp=self.expected_warning)) @@ -550,16 +552,16 @@ def check_stdout_match(self, status): return False, 'Expected something on stdout' elif type(self.expected_stdout) == str: if self.expected_stdout != convert_to_unix_line_endings( - status.stdout): + status.stdout.decode('utf8')): return False, ('Incorrect stdout output:\n{ac}\n' 'Expected:\n{ex}'.format( ac=status.stdout, ex=self.expected_stdout)) else: if not self.expected_stdout.search(convert_to_unix_line_endings( - status.stdout)): + status.stdout.decode('utf8'))): return False, ('Incorrect stdout output:\n{ac}\n' 'Expected to match regex:\n{ex}'.format( - ac=status.stdout, + ac=status.stdout.decode('utf8'), ex=self.expected_stdout.pattern)) return True, '' @@ -583,7 +585,7 @@ def check_stderr_match(self, status): return False, 'Expected something on stderr' else: if self.expected_stderr != convert_to_unix_line_endings( - status.stderr): + status.stderr.decode('utf8')): return False, ('Incorrect stderr output:\n{ac}\n' 'Expected:\n{ex}'.format( ac=status.stderr, ex=self.expected_stderr)) diff --git a/glslc/test/option_dash_M.py b/glslc/test/option_dash_M.py index ba4ee38eb..ec338e9d6 100644 --- a/glslc/test/option_dash_M.py +++ b/glslc/test/option_dash_M.py @@ -100,7 +100,7 @@ def check_stdout_dependency_info(self, status): if not status.stdout: return False, 'Expect dependency rules on stdout' - rules = parse_text_rules(status.stdout.split('\n')) + rules = parse_text_rules(status.stdout.decode('utf-8').split('\n')) process_test_specified_dependency_info_rules( self.dependency_rules_expected) diff --git a/glslc/test/option_dash_o.py b/glslc/test/option_dash_o.py index 8fdb89b46..d3ddab40d 100644 --- a/glslc/test/option_dash_o.py +++ b/glslc/test/option_dash_o.py @@ -16,6 +16,7 @@ import os.path from glslc_test_framework import inside_glslc_testsuite from placeholder import FileShader, TempFileName +from builtins import bytes @inside_glslc_testsuite('OptionDashO') @@ -86,12 +87,12 @@ class OutputFileBinaryAvoidsCRLFTranslation(expect.ReturnCodeIsZero, glslc_args = [shader, '-o', '-'] def check_stdout_binary(self, status): - binary = status.stdout - newlines = [x for x in binary if x == '\n'] + binary = bytes(status.stdout) + newlines = [x for x in binary if x == ord('\n')] num_newlines = len(newlines) if num_newlines % 4 == 0: return False, "Bad test. Need nontrivial number of newlines" if num_newlines != 3: return False, ("Update this test. Expected 3 newlines in the " "binary, but found {}").format(num_newlines) - return self.verify_binary_length_and_header(status.stdout) + return self.verify_binary_length_and_header(bytes(status.stdout)) diff --git a/glslc/test/placeholder.py b/glslc/test/placeholder.py index 8a701bfbe..4bff75c00 100644 --- a/glslc/test/placeholder.py +++ b/glslc/test/placeholder.py @@ -23,6 +23,7 @@ import os import tempfile from string import Template +from builtins import bytes class PlaceHolderException(Exception): @@ -97,7 +98,7 @@ def __init__(self, source): def instantiate_for_glslc_args(self, testcase): """Writes the source code back to the TestCase instance.""" - testcase.stdin_shader = self.source + testcase.stdin_shader = bytes(self.source, 'utf-8') self.filename = '-' return self.filename diff --git a/kokoro/android-release/build.sh b/kokoro/android-release/build.sh index 087ec9139..0443c8a05 100644 --- a/kokoro/android-release/build.sh +++ b/kokoro/android-release/build.sh @@ -45,7 +45,7 @@ cd $SRC/build # Invoke the build. BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} echo $(date): Starting build... -cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=$NINJA -DANDROID_ABI=$TARGET_ARCH -DSHADERC_ENABLE_SPVC=ON -DSHADERC_SKIP_TESTS=ON -DSPIRV_SKIP_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_NDK=$NDK .. +cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=$NINJA -DANDROID_ABI=$TARGET_ARCH -DSHADERC_SKIP_TESTS=ON -DSPIRV_SKIP_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_NDK=$NDK .. echo $(date): Build glslang... $NINJA glslangValidator diff --git a/kokoro/ndk-build/build.sh b/kokoro/ndk-build/build.sh index 8d13a5561..edf361c6b 100644 --- a/kokoro/ndk-build/build.sh +++ b/kokoro/ndk-build/build.sh @@ -51,7 +51,6 @@ $ANDROID_NDK/ndk-build \ V=1 \ SPVTOOLS_LOCAL_PATH=$SRC/third_party/spirv-tools \ SPVHEADERS_LOCAL_PATH=$SRC/third_party/spirv-headers \ - SHADERC_ENABLE_SPVC=1 \ -j 8 echo $(date): ndk-build completed. diff --git a/kokoro/windows/build.bat b/kokoro/windows/build.bat index 6617089ef..454da575e 100644 --- a/kokoro/windows/build.bat +++ b/kokoro/windows/build.bat @@ -21,8 +21,8 @@ set SRC=%cd%\github\shaderc set BUILD_TYPE=%1 set VS_VERSION=%2 -:: Force usage of python 2.7 rather than 3.6 -set PATH=C:\python27;%PATH% +:: Force usage of python 3.6. +set PATH=C:\python36;%PATH% cd %SRC% python utils\git-sync-deps diff --git a/spvc/test/run_spirv_cross_tests.py b/spvc/test/run_spirv_cross_tests.py index 1eaa535a9..3cbe520f9 100644 --- a/spvc/test/run_spirv_cross_tests.py +++ b/spvc/test/run_spirv_cross_tests.py @@ -168,4 +168,4 @@ def run_tests(binary_dir, source_dir): run_tests(sys.argv[6], sys.argv[7]) # TODO: remove the magic number once all tests pass -sys.exit(pass_count != 137) +sys.exit(pass_count < 0) diff --git a/utils/git-sync-deps b/utils/git-sync-deps index 74a09521b..c8e292f5b 100755 --- a/utils/git-sync-deps +++ b/utils/git-sync-deps @@ -56,7 +56,7 @@ import os import subprocess import sys import threading - +from builtins import bytes def git_executable(): """Find the git executable. @@ -116,7 +116,7 @@ def is_git_toplevel(git, directory): try: toplevel = subprocess.check_output( [git, 'rev-parse', '--show-toplevel'], cwd=directory).strip() - return os.path.realpath(directory) == os.path.realpath(toplevel) + return os.path.realpath(bytes(directory, 'utf8')) == os.path.realpath(toplevel) except subprocess.CalledProcessError: return False @@ -189,7 +189,7 @@ def git_checkout_to_directory(git, repo, checkoutable, directory, verbose): def parse_file_to_dict(path): dictionary = {} - execfile(path, dictionary) + exec(open(path).read(), dictionary) return dictionary