Fix compiler test initialization issues.

We should call ShInitialize() / ShFinalize() once per process, so moving them out of individual test's Setup() / Shutdown() to the test main().

BUG=
R=alokp@chromium.org

Review URL: https://codereview.appspot.com/13568048
diff --git a/src/common/version.h b/src/common/version.h
index aba91d3..a1425df 100644
--- a/src/common/version.h
+++ b/src/common/version.h
@@ -1,7 +1,7 @@
 #define MAJOR_VERSION 1
 #define MINOR_VERSION 2
 #define BUILD_VERSION 0
-#define BUILD_REVISION 2447
+#define BUILD_REVISION 2448
 
 #define STRINGIFY(x) #x
 #define MACRO_STRINGIFY(x) STRINGIFY(x)
diff --git a/tests/build_tests.gyp b/tests/build_tests.gyp
index 42a69ab..82b3085 100644
--- a/tests/build_tests.gyp
+++ b/tests/build_tests.gyp
@@ -72,7 +72,7 @@
         '../third_party/googlemock/include',
       ],
       'sources': [
-        '../third_party/googlemock/src/gmock_main.cc',
+        'compiler_tests/compiler_test_main.cpp',
       ],
     },
   ],
diff --git a/tests/compiler_tests/ExpressionLimit_test.cpp b/tests/compiler_tests/ExpressionLimit_test.cpp
index 3af099d..f671bad 100644
--- a/tests/compiler_tests/ExpressionLimit_test.cpp
+++ b/tests/compiler_tests/ExpressionLimit_test.cpp
@@ -22,17 +22,9 @@
     virtual void SetUp()
     {
         memset(&resources, 0, sizeof(resources));
-
-        ASSERT_TRUE(ShInitialize() != 0) << "Could not ShInitialize";
-
         GenerateResources(&resources);
     }
 
-    virtual void TearDown()
-    {
-        ASSERT_TRUE(ShFinalize() != 0);
-    }
-
     // Set up the per compile resources
     void GenerateResources(ShBuiltInResources* resources)
     {
diff --git a/tests/compiler_tests/compiler_test_main.cpp b/tests/compiler_tests/compiler_test_main.cpp
new file mode 100644
index 0000000..02582ad
--- /dev/null
+++ b/tests/compiler_tests/compiler_test_main.cpp
@@ -0,0 +1,15 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "GLSLANG/ShaderLang.h"
+
+int main(int argc, char** argv) {
+  testing::InitGoogleMock(&argc, argv);
+  ShInitialize();
+  int rt = RUN_ALL_TESTS();
+  ShFinalize();
+  return rt;
+}