Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | pushd $(dirname "$0") > /dev/null |
| 4 | |
Karl Schultz | 9fc829d | 2017-02-14 18:03:13 -0700 | [diff] [blame] | 5 | RunEnvironmentVariablePathsTest() |
| 6 | { |
| 7 | # Check for proper handling of paths specified via environment variables. |
| 8 | |
| 9 | # Set up a layer path that includes default and user-specified locations, |
| 10 | # so that the test app can find them. Include some badly specified elements as well. |
| 11 | vk_layer_path="$VK_LAYER_PATH" |
| 12 | vk_layer_path+=":/usr/local/etc/vulkan/implicit_layer.d:/usr/local/share/vulkan/implicit_layer.d" |
| 13 | vk_layer_path+=":/tmp/carol:::" |
| 14 | vk_layer_path+=":/etc/vulkan/implicit_layer.d:/usr/share/vulkan/implicit_layer.d:$HOME/.local/share/vulkan/implicit_layer.d" |
| 15 | vk_layer_path+=":::::/tandy:" |
| 16 | |
| 17 | # Set vars to include some "challenging" paths and run the test. |
| 18 | output=$(VK_LOADER_DEBUG=all \ |
| 19 | XDG_CONFIG_DIRS=":/tmp/goober:::::/tmp/goober2/:/tmp/goober3/with spaces:::" \ |
| 20 | XDG_DATA_DIRS="::::/tmp/goober4:::::/tmp/goober5:/tmp/goober6/with spaces::::/tmp/goober7:" \ |
| 21 | VK_LAYER_PATH=${vk_layer_path} \ |
| 22 | GTEST_FILTER=CreateInstance.LayerPresent \ |
| 23 | ./vk_loader_validation_tests 2>&1) |
| 24 | |
| 25 | # Here is a path we expect to find. The loader constructs these from the XDG* env vars. |
| 26 | right_path="/tmp/goober/vulkan/icd.d:/tmp/goober2//vulkan/icd.d:/tmp/goober3/with spaces/vulkan/icd.d" |
| 27 | # There are other paths that come from SYSCONFIG settings established at build time. |
| 28 | # So we can't really guess at what those are here. |
| 29 | right_path+=".*" |
| 30 | # Also expect to find these, since we added them. |
| 31 | right_path+="/tmp/goober4/vulkan/icd.d:/tmp/goober5/vulkan/icd.d:/tmp/goober6/with spaces/vulkan/icd.d:/tmp/goober7/vulkan/icd.d" |
| 32 | echo "$output" | grep -q "$right_path" |
| 33 | ec=$? |
| 34 | if [ $ec -eq 1 ] |
| 35 | then |
| 36 | echo "Environment Variable Path test FAILED - ICD path incorrect" >&2 |
| 37 | exit 1 |
| 38 | fi |
| 39 | # Change the string to implicit layers. |
| 40 | right_path=${right_path//icd.d/implicit_layer.d} |
| 41 | echo "$output" | grep -q "$right_path" |
| 42 | ec=$? |
| 43 | if [ $ec -eq 1 ] |
| 44 | then |
| 45 | echo "Environment Variable Path test FAILED - Implicit layer path incorrect" >&2 |
| 46 | exit 1 |
| 47 | fi |
| 48 | # Sadly, the loader does not clean up this path and just stumbles through it. |
| 49 | # So just make sure it is the same. |
| 50 | right_path="${vk_layer_path}" |
| 51 | echo "$output" | grep -q "$right_path" |
| 52 | ec=$? |
| 53 | if [ $ec -eq 1 ] |
| 54 | then |
| 55 | echo "Environment Variable Path test FAILED - VK_LAYER_PATH incorrect" >&2 |
| 56 | exit 1 |
| 57 | fi |
| 58 | echo "Environment Variable Path test PASSED" |
| 59 | } |
| 60 | |
Jeremy Hayes | 1035756 | 2016-07-06 11:56:44 -0600 | [diff] [blame] | 61 | RunCreateInstanceTest() |
| 62 | { |
| 63 | # Check for layer insertion via CreateInstance. |
| 64 | output=$(VK_LOADER_DEBUG=all \ |
| 65 | GTEST_FILTER=CreateInstance.LayerPresent \ |
| 66 | ./vk_loader_validation_tests 2>&1) |
| 67 | |
| 68 | echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_parameter_validation" |
| 69 | ec=$? |
| 70 | |
| 71 | if [ $ec -eq 1 ] |
| 72 | then |
| 73 | echo "CreateInstance insertion test FAILED - parameter-validation not detected in instance layers" >&2 |
| 74 | exit 1 |
| 75 | fi |
| 76 | echo "CreateInstance Insertion test PASSED" |
| 77 | } |
| 78 | |
| 79 | RunEnumerateInstanceLayerPropertiesTest() |
| 80 | { |
| 81 | count=$(GTEST_FILTER=EnumerateInstanceLayerProperties.Count \ |
| 82 | ./vk_loader_validation_tests count 2>&1 | |
| 83 | grep -o 'count=[0-9]\+' | sed 's/^.*=//') |
| 84 | |
| 85 | if [ "$count" -gt 1 ] |
| 86 | then |
| 87 | diff \ |
| 88 | <(GTEST_PRINT_TIME=0 \ |
| 89 | GTEST_FILTER=EnumerateInstanceLayerProperties.OnePass \ |
| 90 | ./vk_loader_validation_tests count "$count" properties 2>&1 | |
| 91 | grep 'properties') \ |
| 92 | <(GTEST_PRINT_TIME=0 \ |
| 93 | GTEST_FILTER=EnumerateInstanceLayerProperties.TwoPass \ |
| 94 | ./vk_loader_validation_tests properties 2>&1 | |
| 95 | grep 'properties') |
| 96 | fi |
| 97 | ec=$? |
| 98 | |
| 99 | if [ $ec -eq 1 ] |
| 100 | then |
| 101 | echo "EnumerateInstanceLayerProperties OnePass vs TwoPass test FAILED - properties do not match" >&2 |
| 102 | exit 1 |
| 103 | fi |
| 104 | echo "EnumerateInstanceLayerProperties OnePass vs TwoPass test PASSED" |
| 105 | } |
| 106 | |
| 107 | RunEnumerateInstanceExtensionPropertiesTest() |
| 108 | { |
| 109 | count=$(GTEST_FILTER=EnumerateInstanceExtensionProperties.Count \ |
| 110 | ./vk_loader_validation_tests count 2>&1 | |
| 111 | grep -o 'count=[0-9]\+' | sed 's/^.*=//') |
| 112 | |
| 113 | if [ "$count" -gt 1 ] |
| 114 | then |
| 115 | diff \ |
| 116 | <(GTEST_PRINT_TIME=0 \ |
| 117 | GTEST_FILTER=EnumerateInstanceExtensionProperties.OnePass \ |
| 118 | ./vk_loader_validation_tests count "$count" properties 2>&1 | |
| 119 | grep 'properties') \ |
| 120 | <(GTEST_PRINT_TIME=0 \ |
| 121 | GTEST_FILTER=EnumerateInstanceExtensionProperties.TwoPass \ |
| 122 | ./vk_loader_validation_tests properties 2>&1 | |
| 123 | grep 'properties') |
| 124 | fi |
| 125 | ec=$? |
| 126 | |
| 127 | if [ $ec -eq 1 ] |
| 128 | then |
| 129 | echo "EnumerateInstanceExtensionProperties OnePass vs TwoPass test FAILED - properties do not match" >&2 |
| 130 | exit 1 |
| 131 | fi |
| 132 | echo "EnumerateInstanceExtensionProperties OnePass vs TwoPass test PASSED" |
| 133 | } |
| 134 | |
Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 135 | ./vk_loader_validation_tests |
| 136 | |
Karl Schultz | 9fc829d | 2017-02-14 18:03:13 -0700 | [diff] [blame] | 137 | RunEnvironmentVariablePathsTest |
Jeremy Hayes | 1035756 | 2016-07-06 11:56:44 -0600 | [diff] [blame] | 138 | RunCreateInstanceTest |
| 139 | RunEnumerateInstanceLayerPropertiesTest |
| 140 | RunEnumerateInstanceExtensionPropertiesTest |
Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 141 | |
| 142 | # Test the wrap objects layer. |
Mike Stroyan | 2e8fcd4 | 2016-09-27 14:13:14 -0600 | [diff] [blame] | 143 | ./run_wrap_objects_tests.sh || exit 1 |
Jeremy Hayes | ab9804d | 2016-06-30 10:13:35 -0600 | [diff] [blame] | 144 | |
| 145 | popd > /dev/null |