Skip to content

Commit

Permalink
[linux] Enable linker test for linux (#5519)
Browse files Browse the repository at this point in the history
This is for get better source coverage result.
  • Loading branch information
python3kgae authored Aug 9, 2023
1 parent a5a8d51 commit 41c3ee2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 39 deletions.
3 changes: 1 addition & 2 deletions tools/clang/unittests/HLSL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ add_clang_library(ClangHLSLTests SHARED
add_dependencies(ClangUnitTests ClangHLSLTests)
else (WIN32)
set(HLSL_IGNORE_SOURCES
LinkerTest.cpp
MSFileSysTest.cpp
PixTest.cpp
RewriterTest.cpp
ShaderOpTest.cpp
)

add_clang_unittest(ClangHLSLTests
Expand All @@ -69,6 +67,7 @@ add_clang_unittest(ClangHLSLTests
ExtensionTest.cpp
FunctionTest.cpp
HLSLTestOptions.cpp
LinkerTest.cpp
Objects.cpp
OptimizerTest.cpp
OptionsTest.cpp
Expand Down
83 changes: 46 additions & 37 deletions tools/clang/unittests/HLSL/LinkerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

#include <fstream>

#ifdef _WIN32
#include "WexTestClass.h"
#endif
#include "dxc/Test/HlslTestUtils.h"
#include "dxc/Test/DxcTestUtils.h"
#include "dxc/Support/Global.h" // for IFT macro
Expand All @@ -30,49 +32,52 @@ using namespace hlsl;
using namespace llvm;

// The test fixture.
class LinkerTest
{
#ifdef _WIN32
class LinkerTest {
#else
class LinkerTest : public ::testing::Test {
#endif
public:
BEGIN_TEST_CLASS(LinkerTest)
TEST_CLASS_PROPERTY(L"Parallel", L"true")
TEST_METHOD_PROPERTY(L"Priority", L"0")
END_TEST_CLASS()

TEST_CLASS_SETUP(InitSupport);

TEST_METHOD(RunLinkResource);
TEST_METHOD(RunLinkModulesDifferentVersions);
TEST_METHOD(RunLinkResourceWithBinding);
TEST_METHOD(RunLinkAllProfiles);
TEST_METHOD(RunLinkFailNoDefine);
TEST_METHOD(RunLinkFailReDefine);
TEST_METHOD(RunLinkGlobalInit);
TEST_METHOD(RunLinkNoAlloca);
TEST_METHOD(RunLinkMatArrayParam);
TEST_METHOD(RunLinkMatParam);
TEST_METHOD(RunLinkMatParamToLib);
TEST_METHOD(RunLinkResRet);
TEST_METHOD(RunLinkToLib);
TEST_METHOD(RunLinkToLibOdNops);
TEST_METHOD(RunLinkToLibExport);
TEST_METHOD(RunLinkToLibExportShadersOnly);
TEST_METHOD(RunLinkFailReDefineGlobal);
TEST_METHOD(RunLinkFailProfileMismatch);
TEST_METHOD(RunLinkFailEntryNoProps);
TEST_METHOD(RunLinkFailSelectRes);
TEST_METHOD(RunLinkToLibWithUnresolvedFunctions);
TEST_METHOD(RunLinkToLibWithUnresolvedFunctionsExports);
TEST_METHOD(RunLinkToLibWithExportNamesSwapped);
TEST_METHOD(RunLinkToLibWithExportCollision);
TEST_METHOD(RunLinkToLibWithUnusedExport);
TEST_METHOD(RunLinkToLibWithNoExports);
TEST_METHOD(RunLinkWithPotentialIntrinsicNameCollisions);
TEST_METHOD(RunLinkWithValidatorVersion);
TEST_METHOD(RunLinkWithInvalidValidatorVersion);
TEST_METHOD(RunLinkWithTempReg);
TEST_METHOD(RunLinkToLibWithGlobalCtor);
TEST_METHOD(LinkSm63ToSm66);
TEST_METHOD(RunLinkWithRootSig);
TEST_CLASS_SETUP(InitSupport)

TEST_METHOD(RunLinkResource)
TEST_METHOD(RunLinkModulesDifferentVersions)
TEST_METHOD(RunLinkResourceWithBinding)
TEST_METHOD(RunLinkAllProfiles)
TEST_METHOD(RunLinkFailNoDefine)
TEST_METHOD(RunLinkFailReDefine)
TEST_METHOD(RunLinkGlobalInit)
TEST_METHOD(RunLinkNoAlloca)
TEST_METHOD(RunLinkMatArrayParam)
TEST_METHOD(RunLinkMatParam)
TEST_METHOD(RunLinkMatParamToLib)
TEST_METHOD(RunLinkResRet)
TEST_METHOD(RunLinkToLib)
TEST_METHOD(RunLinkToLibOdNops)
TEST_METHOD(RunLinkToLibExport)
TEST_METHOD(RunLinkToLibExportShadersOnly)
TEST_METHOD(RunLinkFailReDefineGlobal)
TEST_METHOD(RunLinkFailProfileMismatch)
TEST_METHOD(RunLinkFailEntryNoProps)
TEST_METHOD(RunLinkFailSelectRes)
TEST_METHOD(RunLinkToLibWithUnresolvedFunctions)
TEST_METHOD(RunLinkToLibWithUnresolvedFunctionsExports)
TEST_METHOD(RunLinkToLibWithExportNamesSwapped)
TEST_METHOD(RunLinkToLibWithExportCollision)
TEST_METHOD(RunLinkToLibWithUnusedExport)
TEST_METHOD(RunLinkToLibWithNoExports)
TEST_METHOD(RunLinkWithPotentialIntrinsicNameCollisions)
TEST_METHOD(RunLinkWithValidatorVersion)
TEST_METHOD(RunLinkWithInvalidValidatorVersion)
TEST_METHOD(RunLinkWithTempReg)
TEST_METHOD(RunLinkToLibWithGlobalCtor)
TEST_METHOD(LinkSm63ToSm66)
TEST_METHOD(RunLinkWithRootSig)


dxc::DxcDllSupport m_dllSupport;
Expand Down Expand Up @@ -351,8 +356,12 @@ TEST_F(LinkerTest, RunLinkModulesDifferentVersions) {
// the data after this header could be a subsequent header.
// The test should announce that it can't make any version string
// modifications
#if _WIN32
WEX::Logging::Log::Warning(
L"Cannot modify compiler version string for test");
#else
FAIL() << "Cannot modify compiler version string for test";
#endif
}

// finally, test that a difference is detected if a member of the struct, say
Expand Down

0 comments on commit 41c3ee2

Please sign in to comment.