• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3pushd $(dirname "$0") > /dev/null
4
5# Check for insertion of wrap-objects layer.
6output=$(VK_LAYER_PATH=$VK_LAYER_PATH:`pwd`/layers \
7   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/layers \
8   VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \
9   VK_LOADER_DEBUG=all \
10   GTEST_FILTER=WrapObjects.Insert \
11   ./vk_loader_validation_tests 2>&1)
12
13echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
14ec=$?
15
16if [ $ec -eq 1 ]
17then
18   echo "Insertion test FAILED - wrap-objects not detected in instance layers" >&2
19   exit 1
20fi
21
22echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
23ec=$?
24
25if [ $ec -eq 1 ]
26then
27   echo "Insertion test FAILED - wrap-objects not detected in device layers" >&2
28   exit 1
29fi
30echo "Insertion test PASSED"
31
32# Check for insertion of wrap-objects layer in front.
33output=$(VK_LAYER_PATH=$VK_LAYER_PATH:`pwd`/layers \
34   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/layers \
35   VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_parameter_validation:VK_LAYER_LUNARG_wrap_objects \
36   VK_LOADER_DEBUG=all \
37   GTEST_FILTER=WrapObjects.Insert \
38   ./vk_loader_validation_tests 2>&1)
39
40echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
41ec=$?
42
43if [ $ec -eq 1 ]
44then
45   echo "Front insertion test FAILED - wrap-objects not detected in instance layers" >&2
46   exit 1
47fi
48
49echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
50ec=$?
51
52if [ $ec -eq 1 ]
53then
54   echo "Front insertion test FAILED - wrap-objects not detected in device layers" >&2
55   exit 1
56fi
57echo "Front insertion test PASSED"
58
59# Check for insertion of wrap-objects layer in back.
60output=$(VK_LAYER_PATH=$VK_LAYER_PATH:`pwd`/layers \
61   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/layers \
62   VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects:VK_LAYER_LUNARG_parameter_validation \
63   VK_LOADER_DEBUG=all \
64   GTEST_FILTER=WrapObjects.Insert \
65   ./vk_loader_validation_tests 2>&1)
66
67echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
68ec=$?
69
70if [ $ec -eq 1 ]
71then
72   echo "Back insertion test FAILED - wrap-objects not detected in instance layers" >&2
73   exit 1
74fi
75
76echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
77ec=$?
78
79if [ $ec -eq 1 ]
80then
81   echo "Back insertion test FAILED - wrap-objects not detected in device layers" >&2
82   exit 1
83fi
84echo "Back insertion test PASSED"
85
86# Check for insertion of wrap-objects layer in middle.
87output=$(VK_LAYER_PATH=$VK_LAYER_PATH:`pwd`/layers \
88   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/layers \
89   VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_image:VK_LAYER_LUNARG_wrap_objects:VK_LAYER_LUNARG_parameter_validation \
90   VK_LOADER_DEBUG=all \
91   GTEST_FILTER=WrapObjects.Insert \
92   ./vk_loader_validation_tests 2>&1)
93
94echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
95ec=$?
96
97if [ $ec -eq 1 ]
98then
99   echo "Middle insertion test FAILED - wrap-objects not detected in instance layers" >&2
100   exit 1
101fi
102
103echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
104ec=$?
105
106if [ $ec -eq 1 ]
107then
108   echo "Middle insertion test FAILED - wrap-objects not detected in device layers" >&2
109   exit 1
110fi
111echo "Middle insertion test PASSED"
112
113# Run the layer validation tests with and without the wrap-objects layer. Diff the results.
114# Filter out the "Unexpected:" lines because they contain varying object handles.
115GTEST_PRINT_TIME=0 \
116   ./vk_layer_validation_tests | grep -v "^Unexpected: " > unwrapped.out
117GTEST_PRINT_TIME=0 \
118   VK_LAYER_PATH=$VK_LAYER_PATH:`pwd`/layers \
119   LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/layers \
120   VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \
121   ./vk_layer_validation_tests | grep -v "^Unexpected: " > wrapped.out
122diff unwrapped.out wrapped.out
123ec=$?
124
125if [ $ec -eq 1 ]
126then
127   echo "Wrap-objects layer validation tests FAILED - wrap-objects altered the results of the layer validation tests" >&2
128   exit 1
129fi
130echo "Wrap-objects layer validation tests PASSED"
131
132popd > /dev/null
133
134exit 0
135