1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2016 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  *//*!
20  * \file
21  * \brief Synchronization tests
22  *//*--------------------------------------------------------------------*/
23 
24 #include "vktSynchronizationTests.hpp"
25 #include "vktTestGroupUtil.hpp"
26 #include "vktSynchronizationSmokeTests.hpp"
27 #include "vktSynchronizationBasicFenceTests.hpp"
28 #include "vktSynchronizationBasicSemaphoreTests.hpp"
29 #include "vktSynchronizationBasicEventTests.hpp"
30 #include "vktSynchronizationOperationSingleQueueTests.hpp"
31 #include "vktSynchronizationOperationMultiQueueTests.hpp"
32 #include "vktSynchronizationInternallySynchronizedObjectsTests.hpp"
33 #include "vktSynchronizationCrossInstanceSharingTests.hpp"
34 #include "vktSynchronizationWin32KeyedMutexTests.hpp"
35 #include "vktSynchronizationUtil.hpp"
36 
37 #include "deUniquePtr.hpp"
38 
39 namespace vkt
40 {
41 namespace synchronization
42 {
43 
44 namespace
45 {
46 
createBasicTests(tcu::TestCaseGroup * group)47 void createBasicTests (tcu::TestCaseGroup* group)
48 {
49 	group->addChild(createBasicFenceTests	 (group->getTestContext()));
50 	group->addChild(createBasicSemaphoreTests(group->getTestContext()));
51 	group->addChild(createBasicEventTests	 (group->getTestContext()));
52 }
53 
54 class OperationTests : public tcu::TestCaseGroup
55 {
56 public:
OperationTests(tcu::TestContext & testCtx)57 	OperationTests (tcu::TestContext& testCtx)
58 		: tcu::TestCaseGroup(testCtx, "op", "Synchronization of a memory-modifying operation")
59 	{
60 	}
61 
init(void)62 	void init (void)
63 	{
64 		addChild(createSynchronizedOperationSingleQueueTests(m_testCtx, m_pipelineCacheData));
65 		addChild(createSynchronizedOperationMultiQueueTests (m_testCtx, m_pipelineCacheData));
66 	}
67 
68 private:
69 	// synchronization.op tests share pipeline cache data to speed up test
70 	// execution.
71 	PipelineCacheData	m_pipelineCacheData;
72 };
73 
createChildren(tcu::TestCaseGroup * group)74 void createChildren (tcu::TestCaseGroup* group)
75 {
76 	tcu::TestContext& testCtx = group->getTestContext();
77 
78 	group->addChild(createSmokeTests(testCtx));
79 	group->addChild(createTestGroup	(testCtx, "basic", "Basic synchronization tests", createBasicTests));
80 	group->addChild(new OperationTests(testCtx));
81 	group->addChild(createInternallySynchronizedObjects(testCtx));
82 	group->addChild(synchronization::createCrossInstanceSharingTest(testCtx));
83 	group->addChild(synchronization::createWin32KeyedMutexTest(testCtx));
84 }
85 
86 } // anonymous
87 
createTests(tcu::TestContext & testCtx)88 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
89 {
90 	return createTestGroup(testCtx, "synchronization", "Synchronization tests", createChildren);
91 }
92 
93 } // synchronization
94 } // vkt
95