blob: 09bb6abef35d2fc06b7d0b02c68a20d95a586dd5 [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
Jeremy Hayesc5587182016-06-28 11:29:05 -060025echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
26ec=$?
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
52echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
53ec=$?
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
79echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
80ec=$?
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
106echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
107ec=$?
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
Tony Barbourc516df82017-05-16 14:07:27 -0600130filter=-VkLayerTest.ExceedMemoryAllocationCount
Jeremy Hayesc5587182016-06-28 11:29:05 -0600131# Run the layer validation tests with and without the wrap-objects layer. Diff the results.
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600132# Filter out the "Unexpected:" lines because they contain varying object handles.
133GTEST_PRINT_TIME=0 \
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -0600134 VK_LAYER_PATH=$vk_layer_path \
135 LD_LIBRARY_PATH=$ld_library_path \
Tony Barbourc516df82017-05-16 14:07:27 -0600136 GTEST_FILTER=$filter \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600137 ./vk_layer_validation_tests | grep -v "^Unexpected: " > unwrapped.out
138GTEST_PRINT_TIME=0 \
Jeremy Hayes51c5e9e2017-05-16 16:20:06 -0600139 VK_LAYER_PATH=$vk_layer_path \
140 LD_LIBRARY_PATH=$ld_library_path \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600141 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \
Tony Barbourc516df82017-05-16 14:07:27 -0600142 GTEST_FILTER=$filter \
Mike Stroyan2e8fcd42016-09-27 14:13:14 -0600143 ./vk_layer_validation_tests | grep -v "^Unexpected: " > wrapped.out
144diff unwrapped.out wrapped.out
Jeremy Hayesc5587182016-06-28 11:29:05 -0600145ec=$?
146
147if [ $ec -eq 1 ]
148then
Jeremy Hayesab9804d2016-06-30 10:13:35 -0600149 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 -0600150 exit 1
151fi
Jeremy Hayesab9804d2016-06-30 10:13:35 -0600152echo "Wrap-objects layer validation tests PASSED"
Jon Ashburn55585ed2016-05-11 16:57:26 -0600153
Jeremy Hayesc5587182016-06-28 11:29:05 -0600154popd > /dev/null
155
Jon Ashburn55585ed2016-05-11 16:57:26 -0600156exit 0