diff --git a/cmake/winml_unittests.cmake b/cmake/winml_unittests.cmake index 4ef243af1d..794f51b8c1 100644 --- a/cmake/winml_unittests.cmake +++ b/cmake/winml_unittests.cmake @@ -70,7 +70,8 @@ function(get_winml_test_scenario_src else() set(winml_test_scenario_src "${winml_test_src_path}/scenario/cppwinrt/scenariotestscppwinrt.h" - "${winml_test_src_path}/scenario/cppwinrt/scenariotestscppwinrt.cpp") + "${winml_test_src_path}/scenario/cppwinrt/scenariotestscppwinrt.cpp" + ) endif() set(${output_winml_test_scenario_src} ${winml_test_scenario_src} PARENT_SCOPE) endfunction() @@ -168,7 +169,7 @@ add_winml_test( SOURCES ${winml_test_api_src} ${winml_test_api_redist_only_src} LIBS winml_test_common delayimp.lib ) -target_link_options(winml_test_api PRIVATE /DELAYLOAD:dxgi.dll /DELAYLOAD:d3d12.dll /DELAYLOAD:api-ms-win-core-file-l1-2-2.dll /DELAYLOAD:api-ms-win-core-synch-l1-2-1.dll) +target_link_options(winml_test_api PRIVATE /DELAYLOAD:d3d11.dll /DELAYLOAD:dxgi.dll /DELAYLOAD:d3d12.dll /DELAYLOAD:api-ms-win-core-file-l1-2-2.dll /DELAYLOAD:api-ms-win-core-synch-l1-2-1.dll) if (onnxruntime_USE_DML) target_link_options(winml_test_api PRIVATE /DELAYLOAD:directml.dll) endif() diff --git a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml index 27401a1ed3..7dbe95f4af 100644 --- a/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml +++ b/tools/ci_build/github/azure-pipelines/templates/windowsai-nuget-build.yml @@ -113,6 +113,8 @@ steps: xcopy $(Build.SourcesDirectory)\winml\test\collateral\models\ModelSubdirectory $(Build.ArtifactStagingDirectory)\test_artifact\ModelSubdirectory\ /i copy $(Build.SourcesDirectory)\winml\test\collateral\images\*.png $(Build.ArtifactStagingDirectory)\test_artifact\ copy $(Build.SourcesDirectory)\winml\test\collateral\images\*.jpg $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\onnxruntime\test\testdata\sequence_length.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ + copy $(Build.SourcesDirectory)\onnxruntime\test\testdata\sequence_construct.onnx $(Build.ArtifactStagingDirectory)\test_artifact\ displayName: 'Copy WinML test collateral to artifact directory' - task: NuGetToolInstaller@0 displayName: Use Nuget 4.9 diff --git a/winml/test/adapter/AdapterSessionTest.cpp b/winml/test/adapter/AdapterSessionTest.cpp index 0244902893..b5864f45ad 100644 --- a/winml/test/adapter/AdapterSessionTest.cpp +++ b/winml/test/adapter/AdapterSessionTest.cpp @@ -84,7 +84,6 @@ UniqueOrtSession CreateUniqueOrtSession(const std::wstring& model_path, const Un } void AppendExecutionProvider_DML() { - GPUTEST; const auto session_options = CreateUniqueOrtSessionOptions(); const auto device = CreateD3DDevice(); @@ -107,7 +106,6 @@ void GetExecutionProvider() { } void GetExecutionProvider_DML() { - GPUTEST; const auto session_options = CreateUniqueOrtSessionOptions(); THROW_IF_NOT_OK_MSG(ort_api->DisableMemPattern(session_options.get()), ort_api); const auto device = CreateD3DDevice(); @@ -130,7 +128,6 @@ void RegisterGraphTransformers() { } void RegisterGraphTransformers_DML() { - GPUTEST; const auto session_options = CreateUniqueOrtSessionOptions(); auto session = CreateUniqueOrtSession(session_options); winml_adapter_api->SessionRegisterGraphTransformers(session.get()); @@ -147,7 +144,6 @@ void RegisterCustomRegistry() { } void RegisterCustomRegistry_DML() { - GPUTEST; IMLOperatorRegistry* registry; THROW_IF_NOT_OK_MSG(winml_adapter_api->CreateCustomRegistry(®istry), ort_api); WINML_EXPECT_NOT_EQUAL(nullptr, registry); @@ -250,8 +246,6 @@ void CopyInputAcrossDevices() { } void CopyInputAcrossDevices_DML() { - GPUTEST; - const auto session_options = CreateUniqueOrtSessionOptions(); THROW_IF_NOT_OK_MSG(ort_api->DisableMemPattern(session_options.get()), ort_api); const auto device = CreateD3DDevice(); @@ -287,8 +281,8 @@ void CopyInputAcrossDevices_DML() { } } -const AdapterSessionTestAPi& getapi() { - static constexpr AdapterSessionTestAPi api = +const AdapterSessionTestAPI& getapi() { + static AdapterSessionTestAPI api = { AdapterSessionTestSetup, AdapterSessionTestTeardown, @@ -307,5 +301,13 @@ const AdapterSessionTestAPi& getapi() { CopyInputAcrossDevices, CopyInputAcrossDevices_DML }; + + if (SkipGpuTests()) { + api.AppendExecutionProvider_DML = SkipTest; + api.GetExecutionProvider_DML = SkipTest; + api.RegisterGraphTransformers_DML = SkipTest; + api.RegisterCustomRegistry_DML = SkipTest; + api.CopyInputAcrossDevices_DML = SkipTest; + } return api; } diff --git a/winml/test/adapter/AdapterSessionTest.h b/winml/test/adapter/AdapterSessionTest.h index 221a980203..319e4915d2 100644 --- a/winml/test/adapter/AdapterSessionTest.h +++ b/winml/test/adapter/AdapterSessionTest.h @@ -2,7 +2,7 @@ // Licensed under the MIT License. #include "test.h" -struct AdapterSessionTestAPi +struct AdapterSessionTestAPI { SetupClass AdapterSessionTestSetup; TeardownClass AdapterSessionTestTeardown; @@ -21,7 +21,7 @@ struct AdapterSessionTestAPi VoidTest CopyInputAcrossDevices; VoidTest CopyInputAcrossDevices_DML; }; -const AdapterSessionTestAPi& getapi(); +const AdapterSessionTestAPI& getapi(); WINML_TEST_CLASS_BEGIN(AdapterSessionTest) WINML_TEST_CLASS_SETUP_CLASS(AdapterSessionTestSetup) diff --git a/winml/test/api/LearningModelAPITest.cpp b/winml/test/api/LearningModelAPITest.cpp index d7860a99b3..a9ddeb07bd 100644 --- a/winml/test/api/LearningModelAPITest.cpp +++ b/winml/test/api/LearningModelAPITest.cpp @@ -17,10 +17,6 @@ static void LearningModelAPITestsClassSetup() { init_apartment(); } -static void LearningModelAPITestsGpuMethodSetup() { - GPUTEST; -} - static void CreateModelFromFilePath() { LearningModel learningModel = nullptr; WINML_EXPECT_NO_THROW(APITest::LoadModel(L"squeezenet_modifiedforruntimestests.onnx", learningModel)); @@ -286,10 +282,9 @@ static void CheckMetadataCaseInsensitive() { } const LearningModelApiTestsApi& getapi() { - static constexpr LearningModelApiTestsApi api = + static LearningModelApiTestsApi api = { LearningModelAPITestsClassSetup, - LearningModelAPITestsGpuMethodSetup, CreateModelFromFilePath, CreateModelFromUnicodeFilePath, CreateModelFileNotFound, @@ -309,5 +304,9 @@ const LearningModelApiTestsApi& getapi() { CheckMetadataCaseInsensitive, CreateCorruptModel }; + + if (RuntimeParameterExists(L"noVideoFrameTests")) { + api.CloseModelCheckEval = SkipTest; + } return api; } \ No newline at end of file diff --git a/winml/test/api/LearningModelAPITest.h b/winml/test/api/LearningModelAPITest.h index 782c54a468..5c163aa28e 100644 --- a/winml/test/api/LearningModelAPITest.h +++ b/winml/test/api/LearningModelAPITest.h @@ -5,7 +5,6 @@ struct LearningModelApiTestsApi { SetupClass LearningModelAPITestsClassSetup; - SetupTest LearningModelAPITestsGpuMethodSetup; VoidTest CreateModelFromFilePath; VoidTest CreateModelFromUnicodeFilePath; VoidTest CreateModelFileNotFound; @@ -45,13 +44,7 @@ WINML_TEST(LearningModelAPITests, EnumerateInputs) WINML_TEST(LearningModelAPITests, EnumerateOutputs) WINML_TEST(LearningModelAPITests, CloseModelCheckMetadata) WINML_TEST(LearningModelAPITests, CloseModelNoNewSessions) +WINML_TEST(LearningModelAPITests, CloseModelCheckEval) WINML_TEST(LearningModelAPITests, CheckMetadataCaseInsensitive) WINML_TEST(LearningModelAPITests, CreateCorruptModel) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(LearningModelAPITestsGpu) -WINML_TEST_CLASS_SETUP_CLASS(LearningModelAPITestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(LearningModelAPITestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(LearningModelAPITestsGpu, CloseModelCheckEval) WINML_TEST_CLASS_END() \ No newline at end of file diff --git a/winml/test/api/LearningModelBindingAPITest.cpp b/winml/test/api/LearningModelBindingAPITest.cpp index b1a345a8c6..c5419affb3 100644 --- a/winml/test/api/LearningModelBindingAPITest.cpp +++ b/winml/test/api/LearningModelBindingAPITest.cpp @@ -20,10 +20,6 @@ static void LearningModelBindingAPITestsClassSetup() { init_apartment(); } -static void LearningModelBindingAPITestsGpuMethodSetup() { - GPUTEST; -} - static void CpuSqueezeNet() { std::string cpuInstance("CPU"); @@ -712,10 +708,9 @@ static void SequenceConstructTensorString() } const LearningModelBindingAPITestsApi& getapi() { - static constexpr LearningModelBindingAPITestsApi api = + static LearningModelBindingAPITestsApi api = { LearningModelBindingAPITestsClassSetup, - LearningModelBindingAPITestsGpuMethodSetup, CpuSqueezeNet, CpuSqueezeNetEmptyOutputs, CpuSqueezeNetUnboundOutputs, @@ -737,5 +732,17 @@ const LearningModelBindingAPITestsApi& getapi() { SequenceLengthTensorFloat, SequenceConstructTensorString }; + + if (SkipGpuTests()) { + api.GpuSqueezeNet = SkipTest; + api.GpuSqueezeNetEmptyOutputs = SkipTest; + api.GpuSqueezeNetUnboundOutputs = SkipTest; + } + if (RuntimeParameterExists(L"noVideoFrameTests")) { + api.ImageBindingDimensions = SkipTest; + api.BindInvalidInputName = SkipTest; + api.VerifyOutputAfterImageBindCalledTwice = SkipTest; + api.VerifyInvalidBindExceptions = SkipTest; + } return api; } diff --git a/winml/test/api/LearningModelBindingAPITest.h b/winml/test/api/LearningModelBindingAPITest.h index b752c37065..f3ae26dab4 100644 --- a/winml/test/api/LearningModelBindingAPITest.h +++ b/winml/test/api/LearningModelBindingAPITest.h @@ -5,7 +5,6 @@ struct LearningModelBindingAPITestsApi { SetupClass LearningModelBindingAPITestsClassSetup; - SetupTest LearningModelBindingAPITestsGpuMethodSetup; VoidTest CpuSqueezeNet; VoidTest CpuSqueezeNetEmptyOutputs; VoidTest CpuSqueezeNetUnboundOutputs; @@ -46,16 +45,10 @@ WINML_TEST(LearningModelBindingAPITests, VerifyOutputAfterEvaluateAsyncCalledTwi WINML_TEST(LearningModelBindingAPITests, VerifyOutputAfterImageBindCalledTwice) WINML_TEST(LearningModelBindingAPITests, SequenceLengthTensorFloat) WINML_TEST(LearningModelBindingAPITests, SequenceConstructTensorString) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(LearningModelBindingAPITestsGPU) -WINML_TEST_CLASS_SETUP_CLASS(LearningModelBindingAPITestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(LearningModelBindingAPITestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(LearningModelBindingAPITestsGPU, GpuSqueezeNet) -WINML_TEST(LearningModelBindingAPITestsGPU, GpuSqueezeNetEmptyOutputs) -WINML_TEST(LearningModelBindingAPITestsGPU, GpuSqueezeNetUnboundOutputs) -WINML_TEST(LearningModelBindingAPITestsGPU, ImageBindingDimensions) -WINML_TEST(LearningModelBindingAPITestsGPU, VerifyInvalidBindExceptions) -WINML_TEST(LearningModelBindingAPITestsGPU, BindInvalidInputName) +WINML_TEST(LearningModelBindingAPITests, GpuSqueezeNet) +WINML_TEST(LearningModelBindingAPITests, GpuSqueezeNetEmptyOutputs) +WINML_TEST(LearningModelBindingAPITests, GpuSqueezeNetUnboundOutputs) +WINML_TEST(LearningModelBindingAPITests, ImageBindingDimensions) +WINML_TEST(LearningModelBindingAPITests, VerifyInvalidBindExceptions) +WINML_TEST(LearningModelBindingAPITests, BindInvalidInputName) WINML_TEST_CLASS_END() \ No newline at end of file diff --git a/winml/test/api/LearningModelSessionAPITest.cpp b/winml/test/api/LearningModelSessionAPITest.cpp index dc27735080..2132fe9bfe 100644 --- a/winml/test/api/LearningModelSessionAPITest.cpp +++ b/winml/test/api/LearningModelSessionAPITest.cpp @@ -23,15 +23,6 @@ static void LearningModelSessionAPITestsClassSetup() { init_apartment(); } -static void LearningModelSessionAPITestsGpuMethodSetup() { - GPUTEST; -} - -static void LearningModelSessionAPITestsGpuSkipEdgeCoreMethodSetup() { - LearningModelSessionAPITestsGpuMethodSetup(); - SKIP_EDGECORE; -} - static void CreateSessionDeviceDefault() { LearningModel learningModel = nullptr; @@ -397,12 +388,10 @@ static void CloseSession() }); } -const LearningModelSesssionAPITestsApi& getapi() { - static constexpr LearningModelSesssionAPITestsApi api = +const LearningModelSessionAPITestsApi& getapi() { + static LearningModelSessionAPITestsApi api = { LearningModelSessionAPITestsClassSetup, - LearningModelSessionAPITestsGpuMethodSetup, - LearningModelSessionAPITestsGpuSkipEdgeCoreMethodSetup, CreateSessionDeviceDefault, CreateSessionDeviceCpu, CreateSessionWithModelLoadedFromStream, @@ -418,5 +407,22 @@ const LearningModelSesssionAPITestsApi& getapi() { EvaluateSessionAndCloseModel, CloseSession, }; + + if (SkipGpuTests()) { + api.CreateSessionDeviceDirectX = SkipTest; + api.CreateSessionDeviceDirectXHighPerformance = SkipTest; + api.CreateSessionDeviceDirectXMinimumPower = SkipTest; + api.CreateSessionWithCastToFloat16InModel = SkipTest; + api.DISABLED_CreateSessionWithFloat16InitializersInModel = SkipTest; + api.AdapterIdAndDevice = SkipTest; + } + if (RuntimeParameterExists(L"EdgeCore")) { + api.AdapterIdAndDevice = SkipTest; + } + if (RuntimeParameterExists(L"noIDXGIFactory6Tests")) { + api.CreateSessionDeviceDirectXHighPerformance = SkipTest; + api.CreateSessionDeviceDirectXMinimumPower = SkipTest; + api.AdapterIdAndDevice = SkipTest; + } return api; } diff --git a/winml/test/api/LearningModelSessionAPITest.h b/winml/test/api/LearningModelSessionAPITest.h index 02b7ad2d05..d8c51c9475 100644 --- a/winml/test/api/LearningModelSessionAPITest.h +++ b/winml/test/api/LearningModelSessionAPITest.h @@ -3,10 +3,8 @@ #include "test.h" -struct LearningModelSesssionAPITestsApi { +struct LearningModelSessionAPITestsApi { SetupClass LearningModelSessionAPITestsClassSetup; - SetupTest LearningModelSessionAPITestsGpuMethodSetup; - SetupTest LearningModelSessionAPITestsGpuSkipEdgeCoreMethodSetup; VoidTest CreateSessionDeviceDefault; VoidTest CreateSessionDeviceCpu; VoidTest CreateSessionWithModelLoadedFromStream; @@ -22,7 +20,7 @@ struct LearningModelSesssionAPITestsApi { VoidTest EvaluateSessionAndCloseModel; VoidTest CloseSession; }; -const LearningModelSesssionAPITestsApi& getapi(); +const LearningModelSessionAPITestsApi& getapi(); WINML_TEST_CLASS_BEGIN(LearningModelSessionAPITests) WINML_TEST_CLASS_SETUP_CLASS(LearningModelSessionAPITestsClassSetup) @@ -34,22 +32,10 @@ WINML_TEST(LearningModelSessionAPITests,EvaluateFeatures) WINML_TEST(LearningModelSessionAPITests,EvaluateFeaturesAsync) WINML_TEST(LearningModelSessionAPITests,EvaluationProperties) WINML_TEST(LearningModelSessionAPITests,EvaluateSessionAndCloseModel) +WINML_TEST(LearningModelSessionAPITests, CreateSessionDeviceDirectX) +WINML_TEST(LearningModelSessionAPITests, CreateSessionDeviceDirectXHighPerformance) +WINML_TEST(LearningModelSessionAPITests, CreateSessionDeviceDirectXMinimumPower) +WINML_TEST(LearningModelSessionAPITests, CreateSessionWithCastToFloat16InModel) +WINML_TEST(LearningModelSessionAPITests, DISABLED_CreateSessionWithFloat16InitializersInModel) +WINML_TEST(LearningModelSessionAPITests, AdapterIdAndDevice) WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(LearningModelSessionAPITestsGpu) -WINML_TEST_CLASS_SETUP_CLASS(LearningModelSessionAPITestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(LearningModelSessionAPITestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(LearningModelSessionAPITestsGpu, CreateSessionDeviceDirectX) -WINML_TEST(LearningModelSessionAPITestsGpu, CreateSessionDeviceDirectXHighPerformance) -WINML_TEST(LearningModelSessionAPITestsGpu, CreateSessionDeviceDirectXMinimumPower) -WINML_TEST(LearningModelSessionAPITestsGpu, CreateSessionWithCastToFloat16InModel) -WINML_TEST(LearningModelSessionAPITestsGpu, DISABLED_CreateSessionWithFloat16InitializersInModel) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(LearningModelSessionAPITestsGpuSkipEdgeCore) -WINML_TEST_CLASS_SETUP_CLASS(LearningModelSessionAPITestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(LearningModelSessionAPITestsGpuSkipEdgeCoreMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(LearningModelSessionAPITestsGpuSkipEdgeCore, AdapterIdAndDevice) -WINML_TEST_CLASS_END() \ No newline at end of file diff --git a/winml/test/api/RawApiTestsGpu.cpp b/winml/test/api/RawApiTestsGpu.cpp index 63d9e1e66f..fa35101bb8 100644 --- a/winml/test/api/RawApiTestsGpu.cpp +++ b/winml/test/api/RawApiTestsGpu.cpp @@ -104,10 +104,6 @@ static void RawApiTestsGpuApiTestsClassSetup() { RoInitialize(RO_INIT_TYPE::RO_INIT_SINGLETHREADED); } -static void GpuMethodSetup() { - GPUTEST; -} - static void CreateDirectXDevice() { WINML_EXPECT_NO_THROW(CreateDevice(DeviceType::DirectX)); } @@ -155,9 +151,8 @@ static void EvaluateNoInputCopy() { } const RawApiTestsGpuApi& getapi() { - static constexpr RawApiTestsGpuApi api = { + static RawApiTestsGpuApi api = { RawApiTestsGpuApiTestsClassSetup, - GpuMethodSetup, CreateDirectXDevice, CreateD3D11DeviceDevice, CreateD3D12CommandQueueDevice, @@ -166,5 +161,15 @@ const RawApiTestsGpuApi& getapi() { Evaluate, EvaluateNoInputCopy }; + + if (SkipGpuTests()) { + api.CreateDirectXDevice = SkipTest; + api.CreateD3D11DeviceDevice = SkipTest; + api.CreateD3D12CommandQueueDevice = SkipTest; + api.CreateDirectXHighPerformanceDevice = SkipTest; + api.CreateDirectXMinPowerDevice = SkipTest; + api.Evaluate = SkipTest; + api.EvaluateNoInputCopy = SkipTest; + } return api; } \ No newline at end of file diff --git a/winml/test/api/RawApiTestsGpu.h b/winml/test/api/RawApiTestsGpu.h index fcf725e397..c02025325f 100644 --- a/winml/test/api/RawApiTestsGpu.h +++ b/winml/test/api/RawApiTestsGpu.h @@ -6,7 +6,6 @@ struct RawApiTestsGpuApi { SetupClass RawApiTestsGpuApiTestsClassSetup; - SetupTest MethodSetup; VoidTest CreateDirectXDevice; VoidTest CreateD3D11DeviceDevice; VoidTest CreateD3D12CommandQueueDevice; @@ -20,7 +19,6 @@ const RawApiTestsGpuApi& getapi(); WINML_TEST_CLASS_BEGIN(RawApiTestsGpu) WINML_TEST_CLASS_SETUP_CLASS(RawApiTestsGpuApiTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(MethodSetup) WINML_TEST_CLASS_BEGIN_TESTS WINML_TEST(RawApiTestsGpu, CreateDirectXDevice) WINML_TEST(RawApiTestsGpu, CreateD3D11DeviceDevice) diff --git a/winml/test/api/raw/winml_microsoft.h b/winml/test/api/raw/winml_microsoft.h index 1f76789bd6..d61555f7a3 100644 --- a/winml/test/api/raw/winml_microsoft.h +++ b/winml/test/api/raw/winml_microsoft.h @@ -172,7 +172,7 @@ inline HRESULT GetActivationFactory( void** factory) noexcept { // Fallback to OS binary if the redistributable is not present! - auto library = LoadLibraryW(MachineLearningDll); + auto library = LoadLibraryExW(MachineLearningDll, nullptr, 0); using DllGetActivationFactory = HRESULT __stdcall(HSTRING, void** factory); auto call = reinterpret_cast(GetProcAddress(library, "DllGetActivationFactory")); diff --git a/winml/test/api/raw/winml_windows.h b/winml/test/api/raw/winml_windows.h index c48f7a20b8..7891cc92c3 100644 --- a/winml/test/api/raw/winml_windows.h +++ b/winml/test/api/raw/winml_windows.h @@ -172,7 +172,7 @@ inline HRESULT GetActivationFactory( void** factory) noexcept { // Fallback to OS binary if the redistributable is not present! - auto library = LoadLibraryW(MachineLearningDll); + auto library = LoadLibraryExW(MachineLearningDll, nullptr, 0); using DllGetActivationFactory = HRESULT __stdcall(HSTRING, void** factory); auto call = reinterpret_cast(GetProcAddress(library, "DllGetActivationFactory")); diff --git a/winml/test/common/googleTestMacros.h b/winml/test/common/googleTestMacros.h index ca66160d75..ba487316c8 100644 --- a/winml/test/common/googleTestMacros.h +++ b/winml/test/common/googleTestMacros.h @@ -12,8 +12,8 @@ getapi().test_name(); \ } -#define WINML_TEST_CLASS_BEGIN(test_class_name) \ - namespace { \ +#define WINML_TEST_CLASS_BEGIN(test_class_name) \ + namespace { \ class test_class_name : public ::testing::Test { #define WINML_TEST_CLASS_SETUP_CLASS(setup_class) \ @@ -41,10 +41,8 @@ } #define WINML_TEST_CLASS_BEGIN_TESTS }; - #define WINML_TEST_CLASS_END() } - // For old versions of gtest without GTEST_SKIP, stream the message and return success instead #ifndef GTEST_SKIP #define GTEST_SKIP_(message) \ @@ -52,15 +50,15 @@ #define GTEST_SKIP GTEST_SKIP_("") #endif -#define EXPECT_THROW_SPECIFIC(statement, exception, condition) \ - EXPECT_THROW( \ - try { \ - statement; \ - } catch (const exception& e) { \ - EXPECT_TRUE(condition(e)); \ - throw; \ - } \ - , exception); +#define EXPECT_THROW_SPECIFIC(statement, exception, condition) \ + EXPECT_THROW( \ + try { \ + statement; \ + } catch (const exception& e) { \ + EXPECT_TRUE(condition(e)); \ + throw; \ + }, \ + exception); #ifndef INSTANTIATE_TEST_SUITE_P // Use the old name, removed in newer versions of googletest @@ -78,32 +76,29 @@ #define WINML_LOG_ERROR(message) \ ADD_FAILURE() << message -#define WINML_LOG_COMMENT(message)\ +#define WINML_LOG_COMMENT(message) \ SCOPED_TRACE(message) #define WINML_EXPECT_HRESULT_SUCCEEDED(hresult_expression) EXPECT_HRESULT_SUCCEEDED(hresult_expression) #define WINML_EXPECT_HRESULT_FAILED(hresult_expression) EXPECT_HRESULT_FAILED(hresult_expression) #define WINML_EXPECT_THROW_SPECIFIC(statement, exception, condition) EXPECT_THROW_SPECIFIC(statement, exception, condition) -#ifndef USE_DML -#define GPUTEST \ - WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)") -#define GPUTEST_ENABLED alwaysFalse() -#else -#define GPUTEST \ - do { \ - if (auto no_gpu_tests = RuntimeParameters::Parameters.find("noGPUtests"); \ - no_gpu_tests != RuntimeParameters::Parameters.end() && no_gpu_tests->second != "0") { \ - WINML_SKIP_TEST("GPU tests disabled"); \ - } \ - } while (0) -#define GPUTEST_ENABLED auto _no_gpu_tests = RuntimeParameters::Parameters.find("noGPUtests"); \ - _no_gpu_tests == RuntimeParameters::Parameters.end() || _no_gpu_tests->second == "0" -#endif +static bool RuntimeParameterExists(std::wstring param) +{ + std::string narrowParam = std::wstring_convert>().to_bytes(param); + auto no_gpu_tests = RuntimeParameters::Parameters.find(narrowParam); + return no_gpu_tests != RuntimeParameters::Parameters.end() && no_gpu_tests->second != "0"; +} -#define SKIP_EDGECORE \ - do { \ - if (auto is_edge_core = RuntimeParameters::Parameters.find("EdgeCore"); \ - is_edge_core != RuntimeParameters::Parameters.end() && is_edge_core->second != "0") { \ - WINML_SKIP_TEST("Test can't be run in EdgeCore"); \ - } \ - } while (0) +static bool SkipGpuTests() +{ +#ifndef USE_DML + return true; +#else + return RuntimeParameterExists(L"noGPUtests"); +#endif +} + +#define GPUTEST \ + if (SkipGpuTests()) { \ + WINML_SKIP_TEST("Gpu tests disabled"); \ + } diff --git a/winml/test/common/googletest/main.cpp b/winml/test/common/googletest/main.cpp index bf08c10ce3..0a672dcd8f 100644 --- a/winml/test/common/googletest/main.cpp +++ b/winml/test/common/googletest/main.cpp @@ -8,7 +8,7 @@ #include "runtimeParameters.h" namespace RuntimeParameters { -std::unordered_map Parameters; +std::unordered_map Parameters; } namespace { diff --git a/winml/test/common/taefTestMacros.h b/winml/test/common/taefTestMacros.h index c366592007..94451c5a8f 100644 --- a/winml/test/common/taefTestMacros.h +++ b/winml/test/common/taefTestMacros.h @@ -13,7 +13,7 @@ using namespace WEX::TestExecution; TEST_CLASS(test_class_name); #define WINML_TEST_CLASS_SETUP_CLASS(setup_class) \ - TEST_CLASS_SETUP(TestClassSetup) { \ + TEST_CLASS_SETUP(TestClassSetup) { \ getapi().setup_class(); \ return true; \ } @@ -25,9 +25,9 @@ using namespace WEX::TestExecution; } #define WINML_TEST_CLASS_SETUP_METHOD(setup_method) \ - TEST_METHOD_SETUP(TestMethodSetup) { \ - getapi().setup_method(); \ - return true; \ + TEST_METHOD_SETUP(TestMethodSetup) { \ + getapi().setup_method(); \ + return true; \ } #define WINML_TEST_CLASS_TEARDOWN_METHOD(teardown_method) \ @@ -51,8 +51,7 @@ using namespace WEX::TestExecution; WINML_SUPRESS_UNREACHABLE_BELOW( \ Log::Result(TestResults::Skipped, \ std::wstring_convert>().from_bytes(message).c_str()); \ - return; \ - ) + return;) #define WINML_EXPECT_NO_THROW(statement) VERIFY_NO_THROW(statement) #define WINML_EXPECT_TRUE(statement) VERIFY_IS_TRUE(statement) @@ -61,34 +60,26 @@ using namespace WEX::TestExecution; #define WINML_EXPECT_NOT_EQUAL(val1, val2) VERIFY_ARE_NOT_EQUAL(val1, val2) #define WINML_LOG_ERROR(message) \ VERIFY_FAIL(std::wstring_convert>().from_bytes(message).c_str()) -#define WINML_LOG_COMMENT(message)\ +#define WINML_LOG_COMMENT(message) \ WEX::Logging::Log::Comment(std::wstring_convert>().from_bytes(message).c_str()) #define WINML_EXPECT_HRESULT_SUCCEEDED(hresult_expression) VERIFY_SUCCEEDED(hresult_expression) #define WINML_EXPECT_THROW_SPECIFIC(statement, exception, condition) VERIFY_THROWS_SPECIFIC(statement, exception, condition) #define WINML_EXPECT_HRESULT_FAILED(hresult_expression) VERIFY_FAILED(hresult_expression) -#ifndef USE_DML -#define GPUTEST \ - WINML_SKIP_TEST("GPU tests disabled because this is a WinML only build (no DML)") -#define GPUTEST_ENABLED alwaysFalse() -#else -#define GPUTEST \ - do { \ - bool no_gpu_tests; \ - if (SUCCEEDED(RuntimeParameters::TryGetValue(L"noGPUtests", no_gpu_tests)) && no_gpu_tests) { \ - WINML_SKIP_TEST("This test is disabled by the no_gpu_tests runtime parameter."); \ - return; \ - } \ - } while (0) -#define GPUTEST_ENABLED bool _no_gpu_tests; \ - !SUCCEEDED(RuntimeParameters::TryGetValue(L"noGPUtests", _no_gpu_tests)) || !_no_gpu_tests -#endif +static bool RuntimeParameterExists(std::wstring param) { + bool param_value; + return SUCCEEDED(RuntimeParameters::TryGetValue(param.c_str(), param_value)) && param_value; +} -#define SKIP_EDGECORE \ - do { \ - bool is_edge_core; \ - if (SUCCEEDED(RuntimeParameters::TryGetValue(L"EdgeCore", is_edge_core)) && is_edge_core) { \ - WINML_SKIP_TEST("This test is disabled by the EdgeCore runtime parameter."); \ - return; \ - } \ - } while (0) +static bool SkipGpuTests() { +#ifndef USE_DML + return true; +#else + return RuntimeParameterExists(L"noGPUtests"); +#endif +} + +#define GPUTEST \ + if (SkipGpuTests()) { \ + WINML_SKIP_TEST("Gpu tests disabled"); \ + } \ No newline at end of file diff --git a/winml/test/common/test.h b/winml/test/common/test.h index e30736b0f7..1a8380da2b 100644 --- a/winml/test/common/test.h +++ b/winml/test/common/test.h @@ -18,10 +18,12 @@ constexpr bool alwaysFalse() { #define WINML_SUPRESS_UNREACHABLE_BELOW(statement) \ if (alwaysTrue()) { statement; } -#ifdef BUILD_GOOGLE_TEST -#include "googleTestMacros.h" -#else #ifdef BUILD_TAEF_TEST #include "taefTestMacros.h" +#else +#include "googleTestMacros.h" #endif -#endif + +static void SkipTest() { + WINML_SKIP_TEST(""); +} diff --git a/winml/test/concurrency/ConcurrencyTests.cpp b/winml/test/concurrency/ConcurrencyTests.cpp index 623224af0e..79d32c83ce 100644 --- a/winml/test/concurrency/ConcurrencyTests.cpp +++ b/winml/test/concurrency/ConcurrencyTests.cpp @@ -25,10 +25,10 @@ void LoadBindEvalSqueezenetRealDataWithValidationConcurrently() { for (const auto& instance : {"1", "2", "3", "4"}) { threads.emplace_back(load_test_model, instance, LearningModelDeviceKind::Cpu); } - if (GPUTEST_ENABLED) { - for (const auto& instance : {"GPU_1", "GPU_2", "GPU_3", "GPU_4"}) { - threads.emplace_back(load_test_model, instance, LearningModelDeviceKind::DirectX); - } + if (SkipGpuTests()) {} else { + for (const auto& instance : {"GPU_1", "GPU_2", "GPU_3", "GPU_4"}) { + threads.emplace_back(load_test_model, instance, LearningModelDeviceKind::DirectX); + } } for (auto& thread : threads) { @@ -41,10 +41,6 @@ void ConcurrencyTestsClassSetup() { std::srand(static_cast(std::time(nullptr))); } -void ConcurrencyTestsGpuMethodSetup() { - GPUTEST; -} - struct EvaluationUnit { LearningModel model; LearningModelSession session; @@ -330,9 +326,8 @@ void MultiThreadSingleSessionGpu() { } const ConcurrencyTestsApi& getapi() { - static constexpr ConcurrencyTestsApi api = { + static ConcurrencyTestsApi api = { ConcurrencyTestsClassSetup, - ConcurrencyTestsGpuMethodSetup, LoadBindEvalSqueezenetRealDataWithValidationConcurrently, MultiThreadLoadModel, MultiThreadMultiSession, @@ -343,5 +338,10 @@ const ConcurrencyTestsApi& getapi() { EvalAsyncDifferentSessions, EvalAsyncDifferentBindings }; + + if (SkipGpuTests()) { + api.MultiThreadMultiSessionGpu = SkipTest; + api.MultiThreadSingleSessionGpu = SkipTest; + } return api; } diff --git a/winml/test/concurrency/ConcurrencyTests.h b/winml/test/concurrency/ConcurrencyTests.h index 0fa8e4a45f..045b96295e 100644 --- a/winml/test/concurrency/ConcurrencyTests.h +++ b/winml/test/concurrency/ConcurrencyTests.h @@ -7,7 +7,6 @@ struct ConcurrencyTestsApi { SetupClass ConcurrencyTestsClassSetup; - SetupTest ConcurrencyTestsGpuMethodSetup; VoidTest LoadBindEvalSqueezenetRealDataWithValidationConcurrently; VoidTest MultiThreadLoadModel; VoidTest MultiThreadMultiSession; @@ -30,14 +29,8 @@ WINML_TEST(ConcurrencyTests, MultiThreadSingleSession) WINML_TEST(ConcurrencyTests, EvalAsyncDifferentModels) WINML_TEST(ConcurrencyTests, EvalAsyncDifferentSessions) WINML_TEST(ConcurrencyTests, EvalAsyncDifferentBindings) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(ConcurrencyTestsGpu) -WINML_TEST_CLASS_SETUP_CLASS(ConcurrencyTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(ConcurrencyTestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(ConcurrencyTestsGpu, MultiThreadMultiSessionGpu) -WINML_TEST(ConcurrencyTestsGpu, MultiThreadSingleSessionGpu) +WINML_TEST(ConcurrencyTests, MultiThreadMultiSessionGpu) +WINML_TEST(ConcurrencyTests, MultiThreadSingleSessionGpu) WINML_TEST_CLASS_END() // indices for imagenet label diff --git a/winml/test/scenario/cppwinrt/CustomOperatorProvider.h b/winml/test/scenario/cppwinrt/CustomOperatorProvider.h index 87c51c8412..0156c69e29 100644 --- a/winml/test/scenario/cppwinrt/CustomOperatorProvider.h +++ b/winml/test/scenario/cppwinrt/CustomOperatorProvider.h @@ -22,7 +22,7 @@ struct CustomOperatorProvider : auto winml_dll_name = dll.str(); #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - m_library = LoadLibraryW(winml_dll_name.c_str()); + m_library = LoadLibraryExW(winml_dll_name.c_str(), nullptr, 0); #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP) m_library = LoadPackagedLibrary(winml_dll_name.c_str(), 0 /*Reserved*/); #endif diff --git a/winml/test/scenario/cppwinrt/CustomOps.cpp b/winml/test/scenario/cppwinrt/CustomOps.cpp index d7e057b93a..b87f3a94ab 100644 --- a/winml/test/scenario/cppwinrt/CustomOps.cpp +++ b/winml/test/scenario/cppwinrt/CustomOps.cpp @@ -33,11 +33,6 @@ static void CustomOpsScenarioTestsClassSetup() winrt::init_apartment(); } -static void CustomOpsScenarioTestsGpuMethodSetup() -{ - GPUTEST; -} - // Tests that the execution provider correctly fuses operators together when custom ops are involved. static void CustomOperatorFusion() { constexpr const wchar_t* c_modelFilename = L"squeezenet_tensor_input.onnx"; @@ -85,7 +80,7 @@ static void CustomOperatorFusion() { auto winml_dll_name = dll.str(); #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - auto m_library = LoadLibraryW(winml_dll_name.c_str()); + auto m_library = LoadLibraryExW(winml_dll_name.c_str(), nullptr, 0); #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP) auto m_library = LoadPackagedLibrary(winml_dll_name.c_str(), 0 /*Reserved*/); #endif @@ -175,7 +170,7 @@ struct LocalCustomOperatorProvider : winrt::implements< auto winml_dll_name = dll.str(); #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - auto m_library = LoadLibraryW(winml_dll_name.c_str()); + auto m_library = LoadLibraryExW(winml_dll_name.c_str(), nullptr, 0); #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP) auto m_library = LoadPackagedLibrary(winml_dll_name.c_str(), 0 /*Reserved*/); #endif @@ -677,12 +672,19 @@ static void CustomKernelWithCustomSchema() { } const CustomOpsTestsApi& getapi() { - static constexpr CustomOpsTestsApi api = + static CustomOpsTestsApi api = { CustomOpsScenarioTestsClassSetup, - CustomOpsScenarioTestsGpuMethodSetup, CustomOperatorFusion, CustomKernelWithBuiltInSchema, - CustomKernelWithCustomSchema}; + CustomKernelWithCustomSchema + }; + + if (SkipGpuTests()) { + api.CustomOperatorFusion = SkipTest; + } + if (RuntimeParameterExists(L"noVideoFrameTests")) { + api.CustomOperatorFusion = SkipTest; + } return api; } \ No newline at end of file diff --git a/winml/test/scenario/cppwinrt/CustomOps.h b/winml/test/scenario/cppwinrt/CustomOps.h index 4659234f0d..a117e2e9cd 100644 --- a/winml/test/scenario/cppwinrt/CustomOps.h +++ b/winml/test/scenario/cppwinrt/CustomOps.h @@ -5,7 +5,6 @@ struct CustomOpsTestsApi { SetupTest CustomOpsScenarioTestsClassSetup; - SetupTest CustomOpsScenarioTestsGpuMethodSetup; VoidTest CustomOperatorFusion; VoidTest CustomKernelWithBuiltInSchema; VoidTest CustomKernelWithCustomSchema; @@ -17,11 +16,5 @@ WINML_TEST_CLASS_SETUP_CLASS(CustomOpsScenarioTestsClassSetup) WINML_TEST_CLASS_BEGIN_TESTS WINML_TEST(CustomOpsScenarioTests, CustomKernelWithBuiltInSchema) WINML_TEST(CustomOpsScenarioTests, CustomKernelWithCustomSchema) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(CustomOpsScenarioGpuTests) -WINML_TEST_CLASS_SETUP_CLASS(CustomOpsScenarioTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(CustomOpsScenarioTestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(CustomOpsScenarioGpuTests, CustomOperatorFusion) +WINML_TEST(CustomOpsScenarioTests, CustomOperatorFusion) WINML_TEST_CLASS_END() \ No newline at end of file diff --git a/winml/test/scenario/cppwinrt/scenariotestscppwinrt.cpp b/winml/test/scenario/cppwinrt/scenariotestscppwinrt.cpp index 3a49b02bc2..a8a3f84db0 100644 --- a/winml/test/scenario/cppwinrt/scenariotestscppwinrt.cpp +++ b/winml/test/scenario/cppwinrt/scenariotestscppwinrt.cpp @@ -50,20 +50,6 @@ static void ScenarioCppWinrtTestsClassSetup() { winrt::init_apartment(); } - -static void ScenarioCppWinrtTestsGpuMethodSetup() { - GPUTEST; -}; - -static void ScenarioCppWinrtTestsSkipEdgeCoreMethodSetup() { - SKIP_EDGECORE; -}; - -static void ScenarioCppWinrtTestsGpuSkipEdgeCoreMethodSetup() { - ScenarioCppWinrtTestsGpuMethodSetup(); - SKIP_EDGECORE; -}; - static void Sample1() { LearningModel model = nullptr; std::wstring filePath = FileHelpers::GetModulePath() + L"model.onnx"; @@ -1410,46 +1396,103 @@ static void D2DInterop() { } const ScenarioTestsApi& getapi() { - static constexpr ScenarioTestsApi api = + static ScenarioTestsApi api = { - ScenarioCppWinrtTestsClassSetup, - ScenarioCppWinrtTestsGpuMethodSetup, - ScenarioCppWinrtTestsSkipEdgeCoreMethodSetup, - ScenarioCppWinrtTestsGpuSkipEdgeCoreMethodSetup, - Sample1, - Scenario1LoadBindEvalDefault, - Scenario2LoadModelFromStream, - Scenario5AsyncEval, - Scenario7EvalWithNoBind, - Scenario8SetDeviceSampleDefault, - Scenario8SetDeviceSampleCPU, - Scenario17DevDiagnostics, - Scenario22ImageBindingAsCPUTensor, - QuantizedModels, - EncryptedStream, - Scenario3SoftwareBitmapInputBinding, - Scenario6BindWithProperties, - Scenario8SetDeviceSampleDefaultDirectX, - Scenario8SetDeviceSampleMinPower, - Scenario8SetDeviceSampleMaxPerf, - Scenario8SetDeviceSampleMyCameraDevice, - Scenario8SetDeviceSampleCustomCommandQueue, - Scenario9LoadBindEvalInputTensorGPU, - Scenario13SingleModelOnCPUandGPU, - Scenario11FreeDimensionsTensor, - Scenario11FreeDimensionsImage, - Scenario14RunModelSwapchain, - Scenario20aLoadBindEvalCustomOperatorCPU, - Scenario20bLoadBindEvalReplacementCustomOperatorCPU, - Scenario21RunModel2ChainZ, - Scenario22ImageBindingAsGPUTensor, - MsftQuantizedModels, - SyncVsAsync, - CustomCommandQueueWithFence, - ReuseVideoFrame, - DeviceLostRecovery, - Scenario8SetDeviceSampleD3D11Device, - D2DInterop, + ScenarioCppWinrtTestsClassSetup, + Sample1, + Scenario1LoadBindEvalDefault, + Scenario2LoadModelFromStream, + Scenario5AsyncEval, + Scenario7EvalWithNoBind, + Scenario8SetDeviceSampleDefault, + Scenario8SetDeviceSampleCPU, + Scenario17DevDiagnostics, + Scenario22ImageBindingAsCPUTensor, + QuantizedModels, + EncryptedStream, + Scenario3SoftwareBitmapInputBinding, + Scenario6BindWithProperties, + Scenario8SetDeviceSampleDefaultDirectX, + Scenario8SetDeviceSampleMinPower, + Scenario8SetDeviceSampleMaxPerf, + Scenario8SetDeviceSampleMyCameraDevice, + Scenario8SetDeviceSampleCustomCommandQueue, + Scenario9LoadBindEvalInputTensorGPU, + Scenario13SingleModelOnCPUandGPU, + Scenario11FreeDimensionsTensor, + Scenario11FreeDimensionsImage, + Scenario14RunModelSwapchain, + Scenario20aLoadBindEvalCustomOperatorCPU, + Scenario20bLoadBindEvalReplacementCustomOperatorCPU, + Scenario21RunModel2ChainZ, + Scenario22ImageBindingAsGPUTensor, + MsftQuantizedModels, + SyncVsAsync, + CustomCommandQueueWithFence, + ReuseVideoFrame, + DeviceLostRecovery, + Scenario8SetDeviceSampleD3D11Device, + D2DInterop, }; + + if (SkipGpuTests()) { + api.Scenario6BindWithProperties = SkipTest; + api.Scenario8SetDeviceSampleDefaultDirectX = SkipTest; + api.Scenario8SetDeviceSampleMinPower = SkipTest; + api.Scenario8SetDeviceSampleMaxPerf = SkipTest; + api.Scenario8SetDeviceSampleCustomCommandQueue = SkipTest; + api.DISABLED_Scenario9LoadBindEvalInputTensorGPU = SkipTest; + api.Scenario13SingleModelOnCPUandGPU = SkipTest; + api.Scenario11FreeDimensionsTensor = SkipTest; + api.Scenario11FreeDimensionsImage = SkipTest; + api.Scenario14RunModelSwapchain = SkipTest; + api.Scenario20aLoadBindEvalCustomOperatorCPU = SkipTest; + api.Scenario20bLoadBindEvalReplacementCustomOperatorCPU = SkipTest; + api.DISABLED_Scenario21RunModel2ChainZ = SkipTest; + api.DISABLED_Scenario22ImageBindingAsGPUTensor = SkipTest; + api.MsftQuantizedModels = SkipTest; + api.DISABLED_SyncVsAsync = SkipTest; + api.DISABLED_CustomCommandQueueWithFence = SkipTest; + api.DISABLED_ReuseVideoFrame = SkipTest; + api.DeviceLostRecovery = SkipTest; + api.Scenario8SetDeviceSampleD3D11Device = SkipTest; + api.D2DInterop = SkipTest; + } + + if (RuntimeParameterExists(L"EdgeCore")) { + api.Scenario8SetDeviceSampleMyCameraDevice = SkipTest; + api.Scenario8SetDeviceSampleD3D11Device = SkipTest; + api.D2DInterop = SkipTest; + } + + if (RuntimeParameterExists(L"noVideoFrameTests")) { + api.Scenario1LoadBindEvalDefault = SkipTest; + api.Scenario3SoftwareBitmapInputBinding = SkipTest; + api.Scenario5AsyncEval = SkipTest; + api.Scenario6BindWithProperties = SkipTest; + api.Scenario7EvalWithNoBind = SkipTest; + api.DISABLED_Scenario9LoadBindEvalInputTensorGPU = SkipTest; + api.Scenario11FreeDimensionsTensor = SkipTest; + api.Scenario11FreeDimensionsImage = SkipTest; + api.Scenario13SingleModelOnCPUandGPU = SkipTest; + api.Scenario14RunModelSwapchain = SkipTest; + api.Scenario17DevDiagnostics = SkipTest; + api.DISABLED_Scenario21RunModel2ChainZ = SkipTest; + api.DISABLED_Scenario22ImageBindingAsCPUTensor = SkipTest; + api.DISABLED_Scenario22ImageBindingAsGPUTensor = SkipTest; + api.DISABLED_CustomCommandQueueWithFence = SkipTest; + api.DISABLED_ReuseVideoFrame = SkipTest; + api.D2DInterop = SkipTest; + api.DeviceLostRecovery = SkipTest; + api.QuantizedModels = SkipTest; + api.MsftQuantizedModels = SkipTest; + } + if (RuntimeParameterExists(L"noIDXGIFactory6Tests")) { + api.Scenario8SetDeviceSampleMinPower = SkipTest; + api.Scenario8SetDeviceSampleMaxPerf = SkipTest; + } + if (RuntimeParameterExists(L"noID3D12Device5Tests")) { + api.DeviceLostRecovery = SkipTest; + } return api; } diff --git a/winml/test/scenario/cppwinrt/scenariotestscppwinrt.h b/winml/test/scenario/cppwinrt/scenariotestscppwinrt.h index 9999b4465c..4fee0e5747 100644 --- a/winml/test/scenario/cppwinrt/scenariotestscppwinrt.h +++ b/winml/test/scenario/cppwinrt/scenariotestscppwinrt.h @@ -5,9 +5,6 @@ struct ScenarioTestsApi { SetupClass ScenarioCppWinrtTestsClassSetup; - SetupTest ScenarioCppWinrtTestsGpuMethodSetup; - SetupTest ScenarioCppWinrtTestsSkipEdgeCoreMethodSetup; - SetupTest ScenarioCppWinrtTestsGpuSkipEdgeCoreMethodSetup; VoidTest Sample1; VoidTest Scenario1LoadBindEvalDefault; VoidTest Scenario2LoadModelFromStream; @@ -59,45 +56,27 @@ WINML_TEST(ScenarioCppWinrtTests, Scenario17DevDiagnostics) WINML_TEST(ScenarioCppWinrtTests, DISABLED_Scenario22ImageBindingAsCPUTensor) WINML_TEST(ScenarioCppWinrtTests, QuantizedModels) WINML_TEST(ScenarioCppWinrtTests, EncryptedStream) +WINML_TEST(ScenarioCppWinrtTests, Scenario3SoftwareBitmapInputBinding) +WINML_TEST(ScenarioCppWinrtTests, Scenario6BindWithProperties) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleDefaultDirectX) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleMinPower) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleMaxPerf) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleCustomCommandQueue) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_Scenario9LoadBindEvalInputTensorGPU) +WINML_TEST(ScenarioCppWinrtTests, Scenario13SingleModelOnCPUandGPU) +WINML_TEST(ScenarioCppWinrtTests, Scenario11FreeDimensionsTensor) +WINML_TEST(ScenarioCppWinrtTests, Scenario11FreeDimensionsImage) +WINML_TEST(ScenarioCppWinrtTests, Scenario14RunModelSwapchain) +WINML_TEST(ScenarioCppWinrtTests, Scenario20aLoadBindEvalCustomOperatorCPU) +WINML_TEST(ScenarioCppWinrtTests, Scenario20bLoadBindEvalReplacementCustomOperatorCPU) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_Scenario21RunModel2ChainZ) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_Scenario22ImageBindingAsGPUTensor) +WINML_TEST(ScenarioCppWinrtTests, MsftQuantizedModels) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_SyncVsAsync) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_CustomCommandQueueWithFence) +WINML_TEST(ScenarioCppWinrtTests, DISABLED_ReuseVideoFrame) +WINML_TEST(ScenarioCppWinrtTests, DeviceLostRecovery) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleD3D11Device) +WINML_TEST(ScenarioCppWinrtTests, D2DInterop) +WINML_TEST(ScenarioCppWinrtTests, Scenario8SetDeviceSampleMyCameraDevice) WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(ScenarioCppWinrtTestsGpu) -WINML_TEST_CLASS_SETUP_CLASS(ScenarioCppWinrtTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(ScenarioCppWinrtTestsGpuMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario3SoftwareBitmapInputBinding) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario6BindWithProperties) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario8SetDeviceSampleDefaultDirectX) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario8SetDeviceSampleMinPower) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario8SetDeviceSampleMaxPerf) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario8SetDeviceSampleCustomCommandQueue) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_Scenario9LoadBindEvalInputTensorGPU) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario13SingleModelOnCPUandGPU) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario11FreeDimensionsTensor) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario11FreeDimensionsImage) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario14RunModelSwapchain) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario20aLoadBindEvalCustomOperatorCPU) -WINML_TEST(ScenarioCppWinrtTestsGpu, Scenario20bLoadBindEvalReplacementCustomOperatorCPU) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_Scenario21RunModel2ChainZ) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_Scenario22ImageBindingAsGPUTensor) -WINML_TEST(ScenarioCppWinrtTestsGpu, MsftQuantizedModels) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_SyncVsAsync) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_CustomCommandQueueWithFence) -WINML_TEST(ScenarioCppWinrtTestsGpu, DISABLED_ReuseVideoFrame) -WINML_TEST(ScenarioCppWinrtTestsGpu, DeviceLostRecovery) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(ScenarioCppWinrtTestsSkipEdgeCore) -WINML_TEST_CLASS_SETUP_CLASS(ScenarioCppWinrtTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(ScenarioCppWinrtTestsSkipEdgeCoreMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(ScenarioCppWinrtTestsSkipEdgeCore, Scenario8SetDeviceSampleMyCameraDevice) -WINML_TEST_CLASS_END() - -WINML_TEST_CLASS_BEGIN(ScenarioCppWinrtTestsGpuSkipEdgeCore) -WINML_TEST_CLASS_SETUP_CLASS(ScenarioCppWinrtTestsClassSetup) -WINML_TEST_CLASS_SETUP_METHOD(ScenarioCppWinrtTestsGpuSkipEdgeCoreMethodSetup) -WINML_TEST_CLASS_BEGIN_TESTS -WINML_TEST(ScenarioCppWinrtTestsGpuSkipEdgeCore, Scenario8SetDeviceSampleD3D11Device) -WINML_TEST(ScenarioCppWinrtTestsGpuSkipEdgeCore, D2DInterop) -WINML_TEST_CLASS_END() \ No newline at end of file