tests: Check for dev profile layer before InitFramework

Change-Id: I656479e76d68f51964a396e66e3a71bc9743906e
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 7b6b0f3..59eb779 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -3018,6 +3018,33 @@
 TEST_F(VkLayerTest, ExceedMemoryAllocationCount) {
     VkResult err = VK_SUCCESS;
     VkDeviceMemory mems[33];
+    uint32_t instance_layer_count = 0;
+
+    err = vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL);
+    assert(!err);
+
+    if (!instance_layer_count) {
+        printf("             No instance layers found; skipped.\n");
+        return;
+    }
+    VkLayerProperties *instance_layers = (VkLayerProperties *)
+                malloc(sizeof (VkLayerProperties) * instance_layer_count);
+    err = vkEnumerateInstanceLayerProperties(&instance_layer_count,
+                instance_layers);
+    assert(!err);
+
+    bool found = false;
+    for (uint32_t i = 0; i < instance_layer_count; i++) {
+        if (!strcmp(instance_layers[i].layerName, "VK_LAYER_LUNARG_device_profile_api")) {
+            found = true;
+            break;
+        }
+    }
+
+    if (!found) {
+        printf("             Did not find VK_LAYER_LUNARG_device_profile_api layer; skipped.\n");
+        return;
+    }
 
     instance_layer_names.push_back("VK_LAYER_LUNARG_device_profile_api");
     ASSERT_NO_FATAL_FAILURE(
@@ -3027,7 +3054,7 @@
     PFN_vkGetOriginalPhysicalDeviceLimitsEXT fpvkGetOriginalPhysicalDeviceLimitsEXT = (PFN_vkGetOriginalPhysicalDeviceLimitsEXT)vkGetInstanceProcAddr(instance(), "vkGetOriginalPhysicalDeviceLimitsEXT");
 
     if(!(fpvkSetPhysicalDeviceLimitsEXT) || !(fpvkGetOriginalPhysicalDeviceLimitsEXT)){
-        printf("             Can't find device_profile_api layer'; skipped.\n");
+        printf("             Can't find device_profile_api functions; skipped.\n");
         return;
     }
     VkPhysicalDeviceProperties props;
@@ -3042,7 +3069,6 @@
     VkMemoryAllocateInfo mem_alloc = {};
     mem_alloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
     mem_alloc.pNext = NULL;
-    mem_alloc.allocationSize = 0;
     mem_alloc.memoryTypeIndex = 0;
     mem_alloc.allocationSize = 4;
 
diff --git a/tests/layers/device_profile_api.cpp b/tests/layers/device_profile_api.cpp
index ad0509f..fc431b0 100644
--- a/tests/layers/device_profile_api.cpp
+++ b/tests/layers/device_profile_api.cpp
@@ -16,6 +16,7 @@
  * limitations under the License.
  *
  * Author: Arda Coskunses <arda@lunarg.com>
+ * Author: Tony Barbour <tony@LunarG.com>
  */
 #include <string.h>
 #include <stdlib.h>