Commit 1fb0e50e by Alexis Hetu Committed by Alexis Hétu

Adding swiftshader unittests to chromium

Chromium does not allow any third_party code to depend on base, so the main test runner for swiftshader's tests in chromium can't live inside the swiftshader repo. To solve this: 1) Added a test environment for swiftshader that will be used for testing in chromium. Currently, it is simply empty. 2) Split unit tests in 2 files, unittests.cpp, which will contain the tests ran by both chromium and swiftshader and main.cpp, which will be used as the swiftshader test runner, but NOT as the chromium test runner (that one will be added in chromium at the same time I do the swiftshader update). 3) The BUILD.gn file was updated to make the chromium version of the test depend on base and on the chromium version of the swiftshader test runner (swiftshader_tests_main.cc, to be added). Change-Id: I1128bb482565908bc285dcd6818d90d1d881a50e Reviewed-on: https://swiftshader-review.googlesource.com/8409Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 19291ef5
......@@ -18,10 +18,14 @@ test("swiftshader_unittests") {
deps = [
"../../src/OpenGL/libEGL:swiftshader_libEGL",
"../../src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"//base",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
sources = [
"main.cpp",
"//gpu/swiftshader_tests_main.cc",
"unittests.cpp",
]
}
// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SWIFTSHADER_TEST_H_
#define SWIFTSHADER_TEST_H_
#include <gtest/gtest.h>
class SwiftShaderTestEnvironment : public testing::Environment {
public:
void SetUp() override {}
void TearDown() override {}
};
#endif // SWIFTSHADER_TEST_H_
// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
......@@ -14,11 +14,6 @@
#include "gtest/gtest.h"
TEST(SwiftShaderCompilationOnly, Unit)
{
// Empty test to trigger compilation of SwiftShader on build bots
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
......
// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "gtest/gtest.h"
TEST(SwiftShaderCompilationOnly, Unit) {
// Empty test to trigger compilation of SwiftShader on build bots
}
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
......@@ -160,6 +160,7 @@
<ItemGroup>
<ClCompile Include="..\..\third_party\googletest\googletest\src\gtest-all.cc" />
<ClCompile Include="main.cpp" />
<ClCompile Include="unittests.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
......@@ -11,10 +11,13 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<ClCompile Include="..\..\third_party\googletest\googletest\src\gtest-all.cc">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\third_party\googletest\googletest\src\gtest-all.cc">
<ClCompile Include="unittests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment