Path: blob/main/glslc/test/error_no_object.py
1560 views
# Copyright 2017 The Shaderc Authors. All rights reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License");3# you may not use this file except in compliance with the License.4# You may obtain a copy of the License at5#6# http://www.apache.org/licenses/LICENSE-2.07#8# Unless required by applicable law or agreed to in writing, software9# distributed under the License is distributed on an "AS IS" BASIS,10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11# See the License for the specific language governing permissions and12# limitations under the License.1314import expect15import os.path16from glslc_test_framework import inside_glslc_testsuite17from placeholder import FileShader181920@inside_glslc_testsuite('ErrorNoObject')21class ErrorGeneratesNoObjectFile(expect.NoObjectFile,22expect.NoOutputOnStdout,23expect.ErrorMessageSubstr):24"""Tests that on error, no object file is generated."""2526shader = FileShader('#version 150\nBad', '.frag')27glslc_args = ['-c', shader]28expected_error_substr = ['syntax error']293031@inside_glslc_testsuite('ErrorNoObject')32class FailureToMakeOutputFileIsErrorWithNoOutputFile(33expect.NoNamedOutputFiles,34expect.NoOutputOnStdout,35expect.ErrorMessageSubstr):36"""Tests that if we fail to make an output file, no file is generated,37and we have certain error messages."""3839shader = FileShader('#version 150\nvoid main() {}', '.frag')40bad_file = '/file/should/not/exist/today'41glslc_args = ['-c', shader, '-o', bad_file]42expected_output_filenames = [bad_file]43expected_error_substr = ['cannot open output file']444546@inside_glslc_testsuite('ErrorNoObject')47class FailureToMakeOutputFileAsCurrentDirIsErrorWithNoOutputFile(48expect.NoNamedOutputFiles,49expect.NoOutputOnStdout,50expect.ErrorMessageSubstr):51"""Tests that if we fail to make an output file because it is the current52directory, then no file is generated, and we have certain error messages."""5354shader = FileShader('#version 150\nvoid main() {}', '.frag')55bad_file = '.' # Current directory56glslc_args = ['-c', shader, '-o', bad_file]57expected_output_filenames = [bad_file]58expected_error_substr = ['cannot open output file']596061