1 // 2 // Copyright 2013 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #include "GLSLANG/ShaderLang.h" 8 #include "gtest/gtest.h" 9 #include "test_utils/runner/TestSuite.h" 10 11 class CompilerTestEnvironment : public testing::Environment 12 { 13 public: SetUp()14 void SetUp() override 15 { 16 if (!sh::Initialize()) 17 { 18 FAIL() << "Failed to initialize the compiler."; 19 } 20 } 21 TearDown()22 void TearDown() override 23 { 24 if (!sh::Finalize()) 25 { 26 FAIL() << "Failed to finalize the compiler."; 27 } 28 } 29 }; 30 31 // This variable is also defined in test_utils_unittest_helper. 32 bool gVerbose = false; 33 main(int argc,char ** argv)34int main(int argc, char **argv) 35 { 36 for (int argIndex = 1; argIndex < argc; ++argIndex) 37 { 38 if (strcmp(argv[argIndex], "-v") == 0 || strcmp(argv[argIndex], "--verbose") == 0) 39 { 40 gVerbose = true; 41 } 42 } 43 44 angle::TestSuite testSuite(&argc, argv); 45 testing::AddGlobalTestEnvironment(new CompilerTestEnvironment()); 46 return testSuite.run(); 47 } 48