Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | pushd $(dirname "$0") > /dev/null |
| 4 | |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 5 | vk_layer_path=$VK_LAYER_PATH:`pwd`/layers:../layers |
| 6 | ld_library_path=$LD_LIBRARY_PATH:`pwd`/layers:../layers |
| 7 | |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 8 | # Check for insertion of wrap-objects layer. |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 9 | output=$(VK_LAYER_PATH=$vk_layer_path \ |
| 10 | LD_LIBRARY_PATH=$ld_library_path \ |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 11 | VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \ |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 12 | VK_LOADER_DEBUG=all \ |
| 13 | GTEST_FILTER=WrapObjects.Insert \ |
| 14 | ./vk_loader_validation_tests 2>&1) |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 15 | |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 16 | echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects" |
| 17 | ec=$? |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 18 | |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 19 | if [ $ec -eq 1 ] |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 20 | then |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 21 | echo "Insertion test FAILED - wrap-objects not detected in instance layers" >&2 |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 22 | exit 1 |
| 23 | fi |
| 24 | |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 25 | echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects" |
| 26 | ec=$? |
| 27 | |
| 28 | if [ $ec -eq 1 ] |
| 29 | then |
| 30 | echo "Insertion test FAILED - wrap-objects not detected in device layers" >&2 |
| 31 | exit 1 |
| 32 | fi |
| 33 | echo "Insertion test PASSED" |
| 34 | |
| 35 | # Check for insertion of wrap-objects layer in front. |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 36 | output=$(VK_LAYER_PATH=$vk_layer_path \ |
| 37 | LD_LIBRARY_PATH=$ld_library_path \ |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 38 | 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 | |
| 43 | echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects" |
| 44 | ec=$? |
| 45 | |
| 46 | if [ $ec -eq 1 ] |
| 47 | then |
| 48 | echo "Front insertion test FAILED - wrap-objects not detected in instance layers" >&2 |
| 49 | exit 1 |
| 50 | fi |
| 51 | |
| 52 | echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects" |
| 53 | ec=$? |
| 54 | |
| 55 | if [ $ec -eq 1 ] |
| 56 | then |
| 57 | echo "Front insertion test FAILED - wrap-objects not detected in device layers" >&2 |
| 58 | exit 1 |
| 59 | fi |
| 60 | echo "Front insertion test PASSED" |
| 61 | |
| 62 | # Check for insertion of wrap-objects layer in back. |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 63 | output=$(VK_LAYER_PATH=$vk_layer_path \ |
| 64 | LD_LIBRARY_PATH=$ld_library_path \ |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 65 | 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 | |
| 70 | echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects" |
| 71 | ec=$? |
| 72 | |
| 73 | if [ $ec -eq 1 ] |
| 74 | then |
| 75 | echo "Back insertion test FAILED - wrap-objects not detected in instance layers" >&2 |
| 76 | exit 1 |
| 77 | fi |
| 78 | |
| 79 | echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects" |
| 80 | ec=$? |
| 81 | |
| 82 | if [ $ec -eq 1 ] |
| 83 | then |
| 84 | echo "Back insertion test FAILED - wrap-objects not detected in device layers" >&2 |
| 85 | exit 1 |
| 86 | fi |
| 87 | echo "Back insertion test PASSED" |
| 88 | |
| 89 | # Check for insertion of wrap-objects layer in middle. |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 90 | output=$(VK_LAYER_PATH=$vk_layer_path \ |
| 91 | LD_LIBRARY_PATH=$ld_library_path \ |
Mark Lobodzinski | e691129 | 2017-02-15 14:38:51 -0700 | [diff] [blame] | 92 | VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_core_validation:VK_LAYER_LUNARG_wrap_objects:VK_LAYER_LUNARG_parameter_validation \ |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 93 | VK_LOADER_DEBUG=all \ |
| 94 | GTEST_FILTER=WrapObjects.Insert \ |
| 95 | ./vk_loader_validation_tests 2>&1) |
| 96 | |
| 97 | echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects" |
| 98 | ec=$? |
| 99 | |
| 100 | if [ $ec -eq 1 ] |
| 101 | then |
| 102 | echo "Middle insertion test FAILED - wrap-objects not detected in instance layers" >&2 |
| 103 | exit 1 |
| 104 | fi |
| 105 | |
| 106 | echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects" |
| 107 | ec=$? |
| 108 | |
| 109 | if [ $ec -eq 1 ] |
| 110 | then |
| 111 | echo "Middle insertion test FAILED - wrap-objects not detected in device layers" >&2 |
| 112 | exit 1 |
| 113 | fi |
| 114 | echo "Middle insertion test PASSED" |
| 115 | |
Jeremy Hayes | 0581f5d | 2017-05-16 17:23:01 -0600 | [diff] [blame] | 116 | # Run a sanity check to make sure the validation tests can be run in the current environment. |
| 117 | GTEST_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 |
| 122 | ec=$? |
| 123 | |
| 124 | if [ $ec -ne 0 ] |
| 125 | then |
| 126 | echo "Execution test FAILED - there may be a problem executing the layer validation tests" >&2 |
| 127 | exit 1 |
| 128 | fi |
| 129 | |
Tony Barbour | c516df8 | 2017-05-16 14:07:27 -0600 | [diff] [blame^] | 130 | filter=-VkLayerTest.ExceedMemoryAllocationCount |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 131 | # Run the layer validation tests with and without the wrap-objects layer. Diff the results. |
Mike Stroyan | 2e8fcd4 | 2016-09-27 14:13:14 -0600 | [diff] [blame] | 132 | # Filter out the "Unexpected:" lines because they contain varying object handles. |
| 133 | GTEST_PRINT_TIME=0 \ |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 134 | VK_LAYER_PATH=$vk_layer_path \ |
| 135 | LD_LIBRARY_PATH=$ld_library_path \ |
Tony Barbour | c516df8 | 2017-05-16 14:07:27 -0600 | [diff] [blame^] | 136 | GTEST_FILTER=$filter \ |
Mike Stroyan | 2e8fcd4 | 2016-09-27 14:13:14 -0600 | [diff] [blame] | 137 | ./vk_layer_validation_tests | grep -v "^Unexpected: " > unwrapped.out |
| 138 | GTEST_PRINT_TIME=0 \ |
Jeremy Hayes | 51c5e9e | 2017-05-16 16:20:06 -0600 | [diff] [blame] | 139 | VK_LAYER_PATH=$vk_layer_path \ |
| 140 | LD_LIBRARY_PATH=$ld_library_path \ |
Mike Stroyan | 2e8fcd4 | 2016-09-27 14:13:14 -0600 | [diff] [blame] | 141 | VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_wrap_objects \ |
Tony Barbour | c516df8 | 2017-05-16 14:07:27 -0600 | [diff] [blame^] | 142 | GTEST_FILTER=$filter \ |
Mike Stroyan | 2e8fcd4 | 2016-09-27 14:13:14 -0600 | [diff] [blame] | 143 | ./vk_layer_validation_tests | grep -v "^Unexpected: " > wrapped.out |
| 144 | diff unwrapped.out wrapped.out |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 145 | ec=$? |
| 146 | |
| 147 | if [ $ec -eq 1 ] |
| 148 | then |
Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 149 | echo "Wrap-objects layer validation tests FAILED - wrap-objects altered the results of the layer validation tests" >&2 |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 150 | exit 1 |
| 151 | fi |
Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 152 | echo "Wrap-objects layer validation tests PASSED" |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 153 | |
Jeremy Hayes | c558718 | 2016-06-28 11:29:05 -0600 | [diff] [blame] | 154 | popd > /dev/null |
| 155 | |
Jon Ashburn | 55585ed | 2016-05-11 16:57:26 -0600 | [diff] [blame] | 156 | exit 0 |