blob: 2dc6248acf00012b06b20383cd3b0c89ad81335c [file] [log] [blame]
Jon Ashburn55585ed2016-05-11 16:57:26 -06001#!/bin/bash
2
3pushd $(dirname "$0") > /dev/null
4
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -06005vk_layer_path=$VK_LAYER_PATH:`pwd`/layers:../layers
6ld_library_path=$LD_LIBRARY_PATH:`pwd`/layers:../layers
7
Jeremy Hayesc5587182016-06-28 11:29:05 -06008# Check for insertion of wrap-objects layer.
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -06009output=$(VK_LAYER_PATH=$vk_layer_path \
10 LD_LIBRARY_PATH=$ld_library_path \
Jon Ashburn55585ed2016-05-11 16:57:26 -060011 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \
Jeremy Hayesc5587182016-06-28 11:29:05 -060012 VK_LOADER_DEBUG=all \
13 GTEST_FILTER=WrapObjects.Insert \
14 ./vk_loader_validation_tests 2>&1)
Jon Ashburn55585ed2016-05-11 16:57:26 -060015
Jeremy Hayesc5587182016-06-28 11:29:05 -060016echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
17ec=$?
Jon Ashburn55585ed2016-05-11 16:57:26 -060018
Jeremy Hayesc5587182016-06-28 11:29:05 -060019if [ $ec -eq 1 ]
Jon Ashburn55585ed2016-05-11 16:57:26 -060020then
Jeremy Hayesc5587182016-06-28 11:29:05 -060021 echo "Insertion test FAILED - wrap-objects not detected in instance layers" >&2
Jon Ashburn55585ed2016-05-11 16:57:26 -060022 exit 1
23fi
24
Mark Lobodzinskid62e8c52017-10-16 16:18:54 -060025echo "$output" | grep -q "Inserted device layer VK_LAYER_LUNARG_wrap_objects"
Jeremy Hayesc5587182016-06-28 11:29:05 -060026ec=$?
27
28if [ $ec -eq 1 ]
29then
30 echo "Insertion test FAILED - wrap-objects not detected in device layers" >&2
31 exit 1
32fi
33echo "Insertion test PASSED"
34
35# Check for insertion of wrap-objects layer in front.
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -060036output=$(VK_LAYER_PATH=$vk_layer_path \
37 LD_LIBRARY_PATH=$ld_library_path \
Jeremy Hayesc5587182016-06-28 11:29:05 -060038 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_parameter_validation:VK_LAYER_LUNARG_wrap_objects \
39 VK_LOADER_DEBUG=all \
40 GTEST_FILTER=WrapObjects.Insert \
41 ./vk_loader_validation_tests 2>&1)
42
43echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
44ec=$?
45
46if [ $ec -eq 1 ]
47then
48 echo "Front insertion test FAILED - wrap-objects not detected in instance layers" >&2
49 exit 1
50fi
51
Mark Lobodzinskid62e8c52017-10-16 16:18:54 -060052echo "$output" | grep -q "Inserted device layer VK_LAYER_LUNARG_wrap_objects"
Jeremy Hayesc5587182016-06-28 11:29:05 -060053ec=$?
54
55if [ $ec -eq 1 ]
56then
57 echo "Front insertion test FAILED - wrap-objects not detected in device layers" >&2
58 exit 1
59fi
60echo "Front insertion test PASSED"
61
62# Check for insertion of wrap-objects layer in back.
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -060063output=$(VK_LAYER_PATH=$vk_layer_path \
64 LD_LIBRARY_PATH=$ld_library_path \
Jeremy Hayesc5587182016-06-28 11:29:05 -060065 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects:VK_LAYER_LUNARG_parameter_validation \
66 VK_LOADER_DEBUG=all \
67 GTEST_FILTER=WrapObjects.Insert \
68 ./vk_loader_validation_tests 2>&1)
69
70echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
71ec=$?
72
73if [ $ec -eq 1 ]
74then
75 echo "Back insertion test FAILED - wrap-objects not detected in instance layers" >&2
76 exit 1
77fi
78
Mark Lobodzinskid62e8c52017-10-16 16:18:54 -060079echo "$output" | grep -q "Inserted device layer VK_LAYER_LUNARG_wrap_objects"
Jeremy Hayesc5587182016-06-28 11:29:05 -060080ec=$?
81
82if [ $ec -eq 1 ]
83then
84 echo "Back insertion test FAILED - wrap-objects not detected in device layers" >&2
85 exit 1
86fi
87echo "Back insertion test PASSED"
88
89# Check for insertion of wrap-objects layer in middle.
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -060090output=$(VK_LAYER_PATH=$vk_layer_path \
91 LD_LIBRARY_PATH=$ld_library_path \
Mark Lobodzinskie6911292017-02-15 14:38:51 -070092 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_core_validation:VK_LAYER_LUNARG_wrap_objects:VK_LAYER_LUNARG_parameter_validation \
Jeremy Hayesc5587182016-06-28 11:29:05 -060093 VK_LOADER_DEBUG=all \
94 GTEST_FILTER=WrapObjects.Insert \
95 ./vk_loader_validation_tests 2>&1)
96
97echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
98ec=$?
99
100if [ $ec -eq 1 ]
101then
102 echo "Middle insertion test FAILED - wrap-objects not detected in instance layers" >&2
103 exit 1
104fi
105
Mark Lobodzinskid62e8c52017-10-16 16:18:54 -0600106echo "$output" | grep -q "Inserted device layer VK_LAYER_LUNARG_wrap_objects"
Jeremy Hayesc5587182016-06-28 11:29:05 -0600107ec=$?
108
109if [ $ec -eq 1 ]
110then
111 echo "Middle insertion test FAILED - wrap-objects not detected in device layers" >&2
112 exit 1
113fi
114echo "Middle insertion test PASSED"
115
Jeremy Hayes0581f5d2017-05-16 17:23:01 -0600116# Run a sanity check to make sure the validation tests can be run in the current environment.
117GTEST_PRINT_TIME=0 \
118 VK_LAYER_PATH=$vk_layer_path \
119 LD_LIBRARY_PATH=$ld_library_path \
120 GTEST_FILTER=VkLayerTest.ReservedParameter \
121 ./vk_layer_validation_tests > /dev/null
122ec=$?
123
124if [ $ec -ne 0 ]
125then
126 echo "Execution test FAILED - there may be a problem executing the layer validation tests" >&2
127 exit 1
128fi
129
Mark Lobodzinski5411bdb2017-10-16 16:00:47 -0600130# Pick a random subset of valid LVT tests to wrap -- None of these can use the device profile API extension!
131filter=VkLayerTest.ThreadCommandBufferCollision:VkLayerTest.ImageDescriptorLayoutMismatch:VkLayerTest.CreateBufferViewNoMemoryBoundToBuffer:VkLayerTest.CommandBufferResetErrors:VkLayerTest.PSOLineWidthInvalid:VkLayerTest.EndCommandBufferWithinRenderPass:VkLayerTest.DSBufferLimitErrors:VkLayerTest.InvalidImageLayout:VkLayerTest.CreatePipelineVsFsMismatchByLocation:VkLayerTest.ImageBufferCopyTests:VkLayerTest.ClearImageErrors:VkPositiveLayerTest.NonCoherentMemoryMapping:VkPositiveLayerTest.BarrierLayoutToImageUsage:VkPositiveLayerTest.TwoSubmitInfosWithSemaphoreOneQueueSubmitsOneFence
132
Jeremy Hayesc5587182016-06-28 11:29:05 -0600133# Run the layer validation tests with and without the wrap-objects layer. Diff the results.
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600134# Filter out the "Unexpected:" lines because they contain varying object handles.
135GTEST_PRINT_TIME=0 \
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -0600136 VK_LAYER_PATH=$vk_layer_path \
137 LD_LIBRARY_PATH=$ld_library_path \
Tony Barbourc516df82017-05-16 14:07:27 -0600138 GTEST_FILTER=$filter \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600139 ./vk_layer_validation_tests | grep -v "^Unexpected: " > unwrapped.out
140GTEST_PRINT_TIME=0 \
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -0600141 VK_LAYER_PATH=$vk_layer_path \
142 LD_LIBRARY_PATH=$ld_library_path \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600143 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \
Tony Barbourc516df82017-05-16 14:07:27 -0600144 GTEST_FILTER=$filter \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600145 ./vk_layer_validation_tests | grep -v "^Unexpected: " > wrapped.out
146diff unwrapped.out wrapped.out
Jeremy Hayesc5587182016-06-28 11:29:05 -0600147ec=$?
148
149if [ $ec -eq 1 ]
150then
Jeremy Hayesab9804d2016-06-30 10:13:35 -0600151 echo "Wrap-objects layer validation tests FAILED - wrap-objects altered the results of the layer validation tests" >&2
Jeremy Hayesc5587182016-06-28 11:29:05 -0600152 exit 1
153fi
Jeremy Hayesab9804d2016-06-30 10:13:35 -0600154echo "Wrap-objects layer validation tests PASSED"
Jon Ashburn55585ed2016-05-11 16:57:26 -0600155
Jeremy Hayesc5587182016-06-28 11:29:05 -0600156popd > /dev/null
157
Jon Ashburn55585ed2016-05-11 16:57:26 -0600158exit 0