|
2 | 2 |
|
3 | 3 | pushd $(dirname "$0") > /dev/null
|
4 | 4 |
|
| 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 | + |
5 | 61 | RunCreateInstanceTest()
|
6 | 62 | {
|
7 | 63 | # Check for layer insertion via CreateInstance.
|
@@ -78,6 +134,7 @@ RunEnumerateInstanceExtensionPropertiesTest()
|
78 | 134 |
|
79 | 135 | ./vk_loader_validation_tests
|
80 | 136 |
|
| 137 | +RunEnvironmentVariablePathsTest |
81 | 138 | RunCreateInstanceTest
|
82 | 139 | RunEnumerateInstanceLayerPropertiesTest
|
83 | 140 | RunEnumerateInstanceExtensionPropertiesTest
|
|
0 commit comments