Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/shaderc
Path: blob/main/glslc/test/error_no_object.py
1560 views
1
# Copyright 2017 The Shaderc Authors. All rights reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
# http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
15
import expect
16
import os.path
17
from glslc_test_framework import inside_glslc_testsuite
18
from placeholder import FileShader
19
20
21
@inside_glslc_testsuite('ErrorNoObject')
22
class ErrorGeneratesNoObjectFile(expect.NoObjectFile,
23
expect.NoOutputOnStdout,
24
expect.ErrorMessageSubstr):
25
"""Tests that on error, no object file is generated."""
26
27
shader = FileShader('#version 150\nBad', '.frag')
28
glslc_args = ['-c', shader]
29
expected_error_substr = ['syntax error']
30
31
32
@inside_glslc_testsuite('ErrorNoObject')
33
class FailureToMakeOutputFileIsErrorWithNoOutputFile(
34
expect.NoNamedOutputFiles,
35
expect.NoOutputOnStdout,
36
expect.ErrorMessageSubstr):
37
"""Tests that if we fail to make an output file, no file is generated,
38
and we have certain error messages."""
39
40
shader = FileShader('#version 150\nvoid main() {}', '.frag')
41
bad_file = '/file/should/not/exist/today'
42
glslc_args = ['-c', shader, '-o', bad_file]
43
expected_output_filenames = [bad_file]
44
expected_error_substr = ['cannot open output file']
45
46
47
@inside_glslc_testsuite('ErrorNoObject')
48
class FailureToMakeOutputFileAsCurrentDirIsErrorWithNoOutputFile(
49
expect.NoNamedOutputFiles,
50
expect.NoOutputOnStdout,
51
expect.ErrorMessageSubstr):
52
"""Tests that if we fail to make an output file because it is the current
53
directory, then no file is generated, and we have certain error messages."""
54
55
shader = FileShader('#version 150\nvoid main() {}', '.frag')
56
bad_file = '.' # Current directory
57
glslc_args = ['-c', shader, '-o', bad_file]
58
expected_output_filenames = [bad_file]
59
expected_error_substr = ['cannot open output file']
60
61