Home | History | Annotate | Download | only in tests
      1 #!/bin/bash
      2 
      3 pushd $(dirname "$0") > /dev/null
      4 
      5 # Check for insertion of wrap-objects layer.
      6 output=$(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 
     13 echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
     14 ec=$?
     15 
     16 if [ $ec -eq 1 ]
     17 then
     18    echo "Insertion test FAILED - wrap-objects not detected in instance layers" >&2
     19    exit 1
     20 fi
     21 
     22 echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
     23 ec=$?
     24 
     25 if [ $ec -eq 1 ]
     26 then
     27    echo "Insertion test FAILED - wrap-objects not detected in device layers" >&2
     28    exit 1
     29 fi
     30 echo "Insertion test PASSED"
     31 
     32 # Check for insertion of wrap-objects layer in front.
     33 output=$(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 
     40 echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
     41 ec=$?
     42 
     43 if [ $ec -eq 1 ]
     44 then
     45    echo "Front insertion test FAILED - wrap-objects not detected in instance layers" >&2
     46    exit 1
     47 fi
     48 
     49 echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
     50 ec=$?
     51 
     52 if [ $ec -eq 1 ]
     53 then
     54    echo "Front insertion test FAILED - wrap-objects not detected in device layers" >&2
     55    exit 1
     56 fi
     57 echo "Front insertion test PASSED"
     58 
     59 # Check for insertion of wrap-objects layer in back.
     60 output=$(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 
     67 echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
     68 ec=$?
     69 
     70 if [ $ec -eq 1 ]
     71 then
     72    echo "Back insertion test FAILED - wrap-objects not detected in instance layers" >&2
     73    exit 1
     74 fi
     75 
     76 echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
     77 ec=$?
     78 
     79 if [ $ec -eq 1 ]
     80 then
     81    echo "Back insertion test FAILED - wrap-objects not detected in device layers" >&2
     82    exit 1
     83 fi
     84 echo "Back insertion test PASSED"
     85 
     86 # Check for insertion of wrap-objects layer in middle.
     87 output=$(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 
     94 echo "$output" | grep -q "Insert instance layer VK_LAYER_LUNARG_wrap_objects"
     95 ec=$?
     96 
     97 if [ $ec -eq 1 ]
     98 then
     99    echo "Middle insertion test FAILED - wrap-objects not detected in instance layers" >&2
    100    exit 1
    101 fi
    102 
    103 echo "$output" | grep -q "Insert device layer VK_LAYER_LUNARG_wrap_objects"
    104 ec=$?
    105 
    106 if [ $ec -eq 1 ]
    107 then
    108    echo "Middle insertion test FAILED - wrap-objects not detected in device layers" >&2
    109    exit 1
    110 fi
    111 echo "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.
    115 GTEST_PRINT_TIME=0 \
    116    ./vk_layer_validation_tests | grep -v "^Unexpected: " > unwrapped.out
    117 GTEST_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
    122 diff unwrapped.out wrapped.out
    123 ec=$?
    124 
    125 if [ $ec -eq 1 ]
    126 then
    127    echo "Wrap-objects layer validation tests FAILED - wrap-objects altered the results of the layer validation tests" >&2
    128    exit 1
    129 fi
    130 echo "Wrap-objects layer validation tests PASSED"
    131 
    132 popd > /dev/null
    133 
    134 exit 0
    135