aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-10-18 13:34:58 -0600
committerMark Lobodzinski <mark@lunarg.com>2016-10-19 09:03:04 -0600
commitf28240d5ea1c6f443437a7a641e516bc1a7269e5 (patch)
tree420fb483f044b26448081aa1c55ac5eb3b3f92ca
parentdb0b664aea748993efd56735d0d3cd0d89f6caee (diff)
downloadusermoji-f28240d5ea1c6f443437a7a641e516bc1a7269e5.tar.xz
tests: Add ValErrorId support to ErrorMonitor
SetDesiredMessage is now overloaded to take a string or a unique error enum ID (VALIDATION_ERROR_xxxxx) to identify a particular message. Passing in VALIDATION_ERROR_MAX_ENUM will match all messages for positive tests. Also updated a couple of tests to use error enums instead of strings. Change-Id: Ic7723cf88ea6bda57d89ab82aace6ed358b14382
-rw-r--r--layers/spec.py8
-rw-r--r--layers/vk_validation_error_messages.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/layers/spec.py b/layers/spec.py
index 91184f9b..9172b59b 100644
--- a/layers/spec.py
+++ b/layers/spec.py
@@ -3,7 +3,6 @@
import sys
import xml.etree.ElementTree as etree
import urllib2
-#import codecs
#############################
# spec.py script
@@ -43,6 +42,7 @@ spec_url = "https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/v
# spec valid usage language as well as the link to nearest section of spec to that language
error_msg_prefix = "For more information refer to Vulkan Spec Section "
ns = {'ns': 'http://www.w3.org/1999/xhtml'}
+validation_error_enum_name = "VALIDATION_ERROR_"
# Dict of new enum values that should be forced to remap to old handles, explicitly set by -remap option
remap_dict = {}
@@ -72,6 +72,7 @@ class Specification:
* Vulkan
*
* Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -144,7 +145,7 @@ class Specification:
error_msg_str = "%s '%s' which states '%s' (%s#%s)" % (error_msg_prefix, prev_heading, "".join(tag.itertext()).replace('\n', ''), spec_url, prev_link)
# Some txt has multiple spaces so split on whitespace and join w/ single space
error_msg_str = " ".join(error_msg_str.split())
- enum_str = "VALIDATION_ERROR_%05d" % (unique_enum_id)
+ enum_str = "%s%05d" % (validation_error_enum_name, unique_enum_id)
# TODO : '\' chars in spec error messages are most likely bad spec txt that needs to be updated
self.val_error_dict[enum_str] = error_msg_str.encode("ascii", "ignore").replace("\\", "/")
unique_enum_id = unique_enum_id + 1
@@ -168,6 +169,7 @@ class Specification:
#print "Header enum is %s" % (enum)
enum_decl.append(' %s = %d,' % (enum, int(enum.split('_')[-1])))
error_string_map.append(' {%s, "%s"},' % (enum, self.val_error_dict[enum]))
+ enum_decl.append(' %sMAX_ENUM = %d,' % (validation_error_enum_name, int(enum.split('_')[-1]) + 1))
enum_decl.append('};')
error_string_map.append('};')
file_contents.extend(enum_decl)
@@ -206,7 +208,7 @@ class Specification:
db_lines.append("# Comments are denoted with '#' char")
db_lines.append("# The format of the lines is:")
db_lines.append("# <error_enum>%s<check_implemented>%s<testname>%s<errormsg>" % (self.delimiter, self.delimiter, self.delimiter))
- db_lines.append("# error_enum: Unique error enum for this check of format VALIDATION_ERROR_<uniqueid>")
+ db_lines.append("# error_enum: Unique error enum for this check of format %s<uniqueid>" % validation_error_enum_name)
db_lines.append("# check_implemented: 'Y' if check has been implemented in layers, 'U' for unknown, or 'N' for not implemented")
db_lines.append("# testname: Name of validation test for this check, 'Unknown' for unknown, or 'None' if not implmented")
db_lines.append("# errormsg: The unique error message for this check that includes spec language and link")
diff --git a/layers/vk_validation_error_messages.h b/layers/vk_validation_error_messages.h
index 80dc4a15..52bb5115 100644
--- a/layers/vk_validation_error_messages.h
+++ b/layers/vk_validation_error_messages.h
@@ -2077,6 +2077,7 @@ enum UNIQUE_VALIDATION_ERROR_CODE {
VALIDATION_ERROR_02052 = 2052,
VALIDATION_ERROR_02053 = 2053,
VALIDATION_ERROR_02054 = 2054,
+ VALIDATION_ERROR_MAX_ENUM = 2055
};
// Mapping from unique validation error enum to the corresponding error message
@@ -4132,4 +4133,4 @@ static std::unordered_map<int, char const *const> validation_error_map{
{VALIDATION_ERROR_02052, "For more information refer to Vulkan Spec Section '32.2. Debug Report Callbacks' which states 'callback must be a valid VkDebugReportCallbackEXT handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyDebugReportCallbackEXT)"},
{VALIDATION_ERROR_02053, "For more information refer to Vulkan Spec Section '32.2. Debug Report Callbacks' which states 'If pAllocator is not NULL, pAllocator must be a pointer to a valid VkAllocationCallbacks structure' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyDebugReportCallbackEXT)"},
{VALIDATION_ERROR_02054, "For more information refer to Vulkan Spec Section '32.2. Debug Report Callbacks' which states 'callback must have been created, allocated, or retrieved from instance' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#vkDestroyDebugReportCallbackEXT)"},
-}; \ No newline at end of file
+};