OSDN Git Service

Added compilation test for SwiftShader
authorAlexis Hetu <sugoi@google.com>
Wed, 16 Nov 2016 18:53:57 +0000 (13:53 -0500)
committerAlexis Hétu <sugoi@google.com>
Wed, 16 Nov 2016 20:21:25 +0000 (20:21 +0000)
This is a new compilation only test which can be used
to trigger swiftshader compilation on test bots. More
unit tests can be added later.

Change-Id: I46e605b3e7a67438f8f36346e4fcd4e06a2b00ec
Reviewed-on: https://swiftshader-review.googlesource.com/8032
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
BUILD.gn
SwiftShader.sln
tests/unittests/BUILD.gn [new file with mode: 0644]
tests/unittests/SubmoduleCheck/gtest/gtest.h [new file with mode: 0644]
tests/unittests/main.cpp [new file with mode: 0644]
tests/unittests/unittests.vcxproj [new file with mode: 0644]
tests/unittests/unittests.vcxproj.filters [new file with mode: 0644]
tests/unittests/unittests.vcxproj.user [new file with mode: 0644]

index d256410..e6e7a8e 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -68,4 +68,12 @@ group("swiftshader") {
     "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
     "src/OpenGL/libEGL:swiftshader_libEGL",
   ]
+}
+
+group("swiftshader_tests") {
+  testonly = true
+
+  data_deps = [
+    "tests/unittests:swiftshader_unittests",
+  ]
 }
\ No newline at end of file
index 03545d9..352ae6d 100644 (file)
@@ -263,6 +263,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SubzeroTest", "src\Reactor\
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SubzeroLLVMDependencies", "src\Reactor\SubzeroLLVMDependencies.vcxproj", "{E3BBD7DA-45C1-43EF-9C87-3F411031BDE4}"\r
 EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittests", "tests\unittests\unittests.vcxproj", "{CF8EBC89-8762-49DC-9440-6C82B3499913}"\r
+EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|Win32 = Debug|Win32\r
@@ -774,6 +776,18 @@ Global
                {E3BBD7DA-45C1-43EF-9C87-3F411031BDE4}.Release|Win32.Build.0 = Release|Win32\r
                {E3BBD7DA-45C1-43EF-9C87-3F411031BDE4}.Release|x64.ActiveCfg = Release|x64\r
                {E3BBD7DA-45C1-43EF-9C87-3F411031BDE4}.Release|x64.Build.0 = Release|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Debug|Win32.Build.0 = Debug|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Debug|x64.ActiveCfg = Debug|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Debug|x64.Build.0 = Debug|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Profile|Win32.ActiveCfg = Release|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Profile|Win32.Build.0 = Release|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Profile|x64.ActiveCfg = Release|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Profile|x64.Build.0 = Release|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Release|Win32.ActiveCfg = Release|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Release|Win32.Build.0 = Release|Win32\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Release|x64.ActiveCfg = Release|x64\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913}.Release|x64.Build.0 = Release|x64\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
@@ -816,5 +830,6 @@ Global
                {09ABE661-9BC0-4152-A820-1FB0522CAC01} = {B7E24D8E-6BE9-4DEF-A8B9-6A6E60CA60E9}\r
                {9088FC9E-9843-4E0D-85D0-1B657AFC480A} = {B7E24D8E-6BE9-4DEF-A8B9-6A6E60CA60E9}\r
                {4EC107AB-89E8-4A0B-8366-B3E81085AE07} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
+               {CF8EBC89-8762-49DC-9440-6C82B3499913} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}\r
        EndGlobalSection\r
 EndGlobal\r
diff --git a/tests/unittests/BUILD.gn b/tests/unittests/BUILD.gn
new file mode 100644 (file)
index 0000000..0810dc6
--- /dev/null
@@ -0,0 +1,24 @@
+# Copyright 2016 The SwiftShader Authors. All Rights Reserved.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+#    http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+\r
+import("//testing/test.gni")\r
+\r
+test("swiftshader_unittests") {\r
+  deps = [ \r
+    "../../src/OpenGL/libGLESv2:swiftshader_libGLESv2",\r
+    "../../src/OpenGL/libEGL:swiftshader_libEGL",\r
+    "//testing/gtest",\r
+  ]\r
+  sources = [ "main.cpp" ]\r
+}\r
diff --git a/tests/unittests/SubmoduleCheck/gtest/gtest.h b/tests/unittests/SubmoduleCheck/gtest/gtest.h
new file mode 100644 (file)
index 0000000..4861ef3
--- /dev/null
@@ -0,0 +1,2 @@
+// These are not the headers you're looking for\r
+#error "Missing googletest submodule. Run git submodule update --init"
\ No newline at end of file
diff --git a/tests/unittests/main.cpp b/tests/unittests/main.cpp
new file mode 100644 (file)
index 0000000..1c29645
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2016 The SwiftShader Authors. All Rights Reserved.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//    http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+#include "gtest/gtest.h"\r
+\r
+TEST(SwiftShaderCompilationOnly, Unit)\r
+{\r
+       // Empty test to trigger compilation of SwiftShader on build bots\r
+}\r
+\r
+int main(int argc, char **argv)\r
+{\r
+       ::testing::InitGoogleTest(&argc, argv);\r
+       return RUN_ALL_TESTS();\r
+}\r
diff --git a/tests/unittests/unittests.vcxproj b/tests/unittests/unittests.vcxproj
new file mode 100644 (file)
index 0000000..eb1bfbc
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{CF8EBC89-8762-49DC-9440-6C82B3499913}</ProjectGuid>\r
+    <Keyword>Win32Proj</Keyword>\r
+    <RootNamespace>unittests</RootNamespace>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v140</PlatformToolset>\r
+    <WholeProgramOptimization>true</WholeProgramOptimization>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <IncludePath>$(IncludePath)</IncludePath>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <LinkIncremental>true</LinkIncremental>\r
+    <IncludePath>$(IncludePath)</IncludePath>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <IncludePath>$(IncludePath)</IncludePath>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <LinkIncremental>false</LinkIncremental>\r
+    <IncludePath>$(IncludePath)</IncludePath>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+      <AdditionalIncludeDirectories>$(SolutionDir)third_party\googletest\googletest\include\;$(SolutionDir)third_party\googletest\googletest\;SubmoduleCheck;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <ForcedIncludeFiles>gtest/gtest.h</ForcedIncludeFiles>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+      <AdditionalIncludeDirectories>$(SolutionDir)third_party\googletest\googletest\include\;$(SolutionDir)third_party\googletest\googletest\;SubmoduleCheck;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <ForcedIncludeFiles>gtest/gtest.h</ForcedIncludeFiles>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+      <AdditionalIncludeDirectories>$(SolutionDir)third_party\googletest\googletest\include\;$(SolutionDir)third_party\googletest\googletest\;SubmoduleCheck;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <ForcedIncludeFiles>gtest/gtest.h</ForcedIncludeFiles>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <PrecompiledHeader>\r
+      </PrecompiledHeader>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <FunctionLevelLinking>true</FunctionLevelLinking>\r
+      <IntrinsicFunctions>true</IntrinsicFunctions>\r
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+      <AdditionalIncludeDirectories>$(SolutionDir)third_party\googletest\googletest\include\;$(SolutionDir)third_party\googletest\googletest\;SubmoduleCheck;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <ForcedIncludeFiles>gtest/gtest.h</ForcedIncludeFiles>\r
+    </ClCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="..\..\third_party\googletest\googletest\src\gtest-all.cc" />\r
+    <ClCompile Include="main.cpp" />\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/tests/unittests/unittests.vcxproj.filters b/tests/unittests/unittests.vcxproj.filters
new file mode 100644 (file)
index 0000000..0b08fc8
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup>\r
+    <Filter Include="Source Files">\r
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
+    </Filter>\r
+    <Filter Include="Resource Files">\r
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r
+    </Filter>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="main.cpp">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\third_party\googletest\googletest\src\gtest-all.cc">\r
+      <Filter>Source Files</Filter>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
diff --git a/tests/unittests/unittests.vcxproj.user b/tests/unittests/unittests.vcxproj.user
new file mode 100644 (file)
index 0000000..190f1da
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup />\r
+</Project>
\ No newline at end of file