Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2016 Google, Inc. |
| 3 | // |
| 4 | // All rights reserved. |
| 5 | // |
| 6 | // Redistribution and use in source and binary forms, with or without |
| 7 | // modification, are permitted provided that the following conditions |
| 8 | // are met: |
| 9 | // |
| 10 | // Redistributions of source code must retain the above copyright |
| 11 | // notice, this list of conditions and the following disclaimer. |
| 12 | // |
| 13 | // Redistributions in binary form must reproduce the above |
| 14 | // copyright notice, this list of conditions and the following |
| 15 | // disclaimer in the documentation and/or other materials provided |
| 16 | // with the distribution. |
| 17 | // |
| 18 | // Neither the name of Google Inc. nor the names of its |
| 19 | // contributors may be used to endorse or promote products derived |
| 20 | // from this software without specific prior written permission. |
| 21 | // |
| 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 33 | // POSSIBILITY OF SUCH DAMAGE. |
| 34 | |
| 35 | #include <gtest/gtest.h> |
| 36 | |
| 37 | #include "TestFixture.h" |
| 38 | |
| 39 | namespace glslangtest { |
| 40 | namespace { |
| 41 | |
| 42 | using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>; |
| 43 | |
| 44 | TEST_P(CompileToAstTest, FromFile) |
| 45 | { |
David Neto | 1d3a966 | 2016-10-05 10:25:09 -0400 | [diff] [blame] | 46 | loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), |
John Kessenich | 66011cb | 2018-03-06 16:12:04 -0700 | [diff] [blame^] | 47 | Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, |
Lei Zhang | d6f0ed2 | 2016-05-16 12:50:30 -0400 | [diff] [blame] | 48 | Target::AST); |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | // clang-format off |
| 52 | INSTANTIATE_TEST_CASE_P( |
| 53 | Glsl, CompileToAstTest, |
| 54 | ::testing::ValuesIn(std::vector<std::string>({ |
| 55 | "sample.frag", |
| 56 | "sample.vert", |
| 57 | "decls.frag", |
| 58 | "specExamples.frag", |
| 59 | "specExamples.vert", |
| 60 | "versionsClean.frag", |
| 61 | "versionsClean.vert", |
| 62 | "versionsErrors.frag", |
| 63 | "versionsErrors.vert", |
| 64 | "100.frag", |
David Srbecký | 2c5b3d6 | 2017-09-04 17:33:04 +0100 | [diff] [blame] | 65 | "100samplerExternal.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 66 | "120.vert", |
| 67 | "120.frag", |
| 68 | "130.vert", |
| 69 | "130.frag", |
| 70 | "140.vert", |
| 71 | "140.frag", |
| 72 | "150.vert", |
| 73 | "150.geom", |
| 74 | "150.frag", |
| 75 | "precision.frag", |
| 76 | "precision.vert", |
| 77 | "nonSquare.vert", |
| 78 | "matrixError.vert", |
| 79 | "cppSimple.vert", |
| 80 | "cppIndent.vert", |
John Kessenich | 5866e67 | 2017-10-28 12:55:02 -0600 | [diff] [blame] | 81 | "cppIntMinOverNegativeOne.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 82 | "cppNest.vert", |
John Kessenich | 73d4fb5 | 2016-07-30 12:38:17 -0600 | [diff] [blame] | 83 | "cppBad.vert", |
John Kessenich | faa720f | 2017-01-02 17:56:08 -0700 | [diff] [blame] | 84 | "cppBad2.vert", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 85 | "cppComplexExpr.vert", |
John Kessenich | 7d67c6c | 2017-10-16 15:29:07 -0600 | [diff] [blame] | 86 | "cppDeepNest.frag", |
John Kessenich | 88e22a6 | 2017-11-02 06:48:32 -0600 | [diff] [blame] | 87 | "cppPassMacroName.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 88 | "badChars.frag", |
| 89 | "pointCoord.frag", |
| 90 | "array.frag", |
| 91 | "array100.frag", |
| 92 | "comment.frag", |
| 93 | "300.vert", |
| 94 | "300.frag", |
| 95 | "300BuiltIns.frag", |
| 96 | "300layout.vert", |
| 97 | "300layout.frag", |
| 98 | "300operations.frag", |
| 99 | "300block.frag", |
David Srbecký | 2c5b3d6 | 2017-09-04 17:33:04 +0100 | [diff] [blame] | 100 | "300samplerExternal.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 101 | "310.comp", |
| 102 | "310.vert", |
| 103 | "310.geom", |
| 104 | "310.frag", |
| 105 | "310.tesc", |
| 106 | "310.tese", |
| 107 | "310implicitSizeArrayError.vert", |
| 108 | "310AofA.vert", |
John Kessenich | 53863a3 | 2017-07-23 13:54:15 -0600 | [diff] [blame] | 109 | "320.comp", |
| 110 | "320.vert", |
| 111 | "320.geom", |
| 112 | "320.frag", |
| 113 | "320.tesc", |
| 114 | "320.tese", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 115 | "330.frag", |
| 116 | "330comp.frag", |
| 117 | "constErrors.frag", |
| 118 | "constFold.frag", |
John Kessenich | 5866e67 | 2017-10-28 12:55:02 -0600 | [diff] [blame] | 119 | "constFoldIntMin.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 120 | "errors.frag", |
| 121 | "forwardRef.frag", |
| 122 | "uint.frag", |
| 123 | "switch.frag", |
| 124 | "tokenLength.vert", |
| 125 | "100Limits.vert", |
| 126 | "100scope.vert", |
| 127 | "110scope.vert", |
| 128 | "300scope.vert", |
| 129 | "400.frag", |
John Kessenich | 80cb324 | 2016-06-05 18:52:05 -0600 | [diff] [blame] | 130 | "400.vert", |
| 131 | "410.vert", |
John Kessenich | 0f5e3ad | 2016-05-29 18:24:31 -0600 | [diff] [blame] | 132 | "420.comp", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 133 | "420.frag", |
| 134 | "420.vert", |
| 135 | "420.geom", |
| 136 | "420_size_gl_in.geom", |
| 137 | "430scope.vert", |
| 138 | "lineContinuation100.vert", |
| 139 | "lineContinuation.vert", |
| 140 | "numeral.frag", |
| 141 | "400.geom", |
| 142 | "400.tesc", |
| 143 | "400.tese", |
| 144 | "410.tesc", |
| 145 | "420.tesc", |
| 146 | "420.tese", |
| 147 | "410.geom", |
| 148 | "430.vert", |
| 149 | "430.comp", |
| 150 | "430AofA.frag", |
John Kessenich | 9353f1a | 2017-07-23 11:49:42 -0600 | [diff] [blame] | 151 | "435.vert", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 152 | "440.vert", |
| 153 | "440.frag", |
| 154 | "450.vert", |
| 155 | "450.geom", |
| 156 | "450.tesc", |
| 157 | "450.tese", |
| 158 | "450.frag", |
| 159 | "450.comp", |
John Kessenich | de16e52 | 2017-07-23 14:44:59 -0600 | [diff] [blame] | 160 | "460.frag", |
| 161 | "460.vert", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 162 | "dce.frag", |
| 163 | "atomic_uint.frag", |
John Kessenich | e8d2138 | 2017-11-02 00:05:53 -0600 | [diff] [blame] | 164 | "implicitInnerAtomicUint.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 165 | "aggOps.frag", |
| 166 | "always-discard.frag", |
| 167 | "always-discard2.frag", |
| 168 | "conditionalDiscard.frag", |
| 169 | "conversion.frag", |
| 170 | "dataOut.frag", |
| 171 | "dataOutIndirect.frag", |
| 172 | "deepRvalue.frag", |
| 173 | "depthOut.frag", |
| 174 | "discard-dce.frag", |
| 175 | "doWhileLoop.frag", |
| 176 | "earlyReturnDiscard.frag", |
| 177 | "flowControl.frag", |
| 178 | "forLoop.frag", |
| 179 | "functionCall.frag", |
| 180 | "functionSemantics.frag", |
| 181 | "length.frag", |
| 182 | "localAggregates.frag", |
| 183 | "loops.frag", |
| 184 | "loopsArtificial.frag", |
| 185 | "matrix.frag", |
| 186 | "matrix2.frag", |
| 187 | "newTexture.frag", |
| 188 | "Operations.frag", |
Aaron Muir Hamilton | 9028ed2 | 2017-10-22 17:41:13 +0000 | [diff] [blame] | 189 | "overlongLiteral.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 190 | "prepost.frag", |
| 191 | "simpleFunctionCall.frag", |
| 192 | "structAssignment.frag", |
| 193 | "structDeref.frag", |
| 194 | "structure.frag", |
| 195 | "swizzle.frag", |
Aaron Muir Hamilton | 5313613 | 2017-10-17 08:11:33 +0000 | [diff] [blame] | 196 | "invalidSwizzle.vert", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 197 | "syntaxError.frag", |
| 198 | "test.frag", |
| 199 | "texture.frag", |
John Kessenich | d485e0b | 2016-12-19 09:19:43 -0700 | [diff] [blame] | 200 | "tokenPaste.vert", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 201 | "types.frag", |
| 202 | "uniformArray.frag", |
| 203 | "variableArrayIndex.frag", |
| 204 | "varyingArray.frag", |
| 205 | "varyingArrayIndirect.frag", |
| 206 | "voidFunction.frag", |
| 207 | "whileLoop.frag", |
| 208 | "nonVulkan.frag", |
Lei Zhang | 48e296b | 2016-05-04 14:35:16 -0400 | [diff] [blame] | 209 | "negativeArraySize.comp", |
Lei Zhang | 48e296b | 2016-05-04 14:35:16 -0400 | [diff] [blame] | 210 | "precise.tesc", |
| 211 | "precise_struct_block.vert", |
| 212 | "maxClipDistances.vert", |
John Kessenich | 66011cb | 2018-03-06 16:12:04 -0700 | [diff] [blame^] | 213 | "findFunction.frag", |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 214 | })), |
Lei Zhang | d6f0ed2 | 2016-05-16 12:50:30 -0400 | [diff] [blame] | 215 | FileNameAsCustomTestSuffix |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 216 | ); |
| 217 | // clang-format on |
| 218 | |
| 219 | } // anonymous namespace |
| 220 | } // namespace glslangtest |