|
|
@@ -9,44 +9,45 @@ macro(snippet_error snippet error)
|
|
|
endmacro()
|
|
|
|
|
|
macro(has_key snippet json key)
|
|
|
- string(JSON data ERROR_VARIABLE missingKey GET ${json} ${key})
|
|
|
+ string(JSON data ERROR_VARIABLE missingKey GET "${json}" ${key})
|
|
|
if (NOT ${missingKey} MATCHES NOTFOUND)
|
|
|
snippet_error(${snippet} "Missing ${key}")
|
|
|
endif()
|
|
|
endmacro()
|
|
|
|
|
|
macro(has_not_key snippet json key)
|
|
|
- string(JSON data ERROR_VARIABLE missingKey GET ${json} ${key})
|
|
|
+ string(JSON data ERROR_VARIABLE missingKey GET "${json}" ${key})
|
|
|
if (${missingKey} MATCHES NOTFOUND)
|
|
|
snippet_error(${snippet} "Has unexpected ${key}")
|
|
|
endif()
|
|
|
endmacro()
|
|
|
|
|
|
macro(snippet_has_fields snippet contents)
|
|
|
+ get_filename_component(filename ${snippet} NAME)
|
|
|
has_key(${snippet} ${contents} command)
|
|
|
has_key(${snippet} ${contents} role)
|
|
|
has_key(${snippet} ${contents} result)
|
|
|
- if (snippet MATCHES ^link-*)
|
|
|
+ if (filename MATCHES ^link-*)
|
|
|
has_key(${snippet} ${contents} target)
|
|
|
has_key(${snippet} ${contents} outputs)
|
|
|
has_key(${snippet} ${contents} outputSizes)
|
|
|
has_key(${snippet} ${contents} targetType)
|
|
|
- elseif (snippet MATCHES ^compile-*)
|
|
|
+ elseif (filename MATCHES ^compile-*)
|
|
|
has_key(${snippet} ${contents} target)
|
|
|
has_key(${snippet} ${contents} outputs)
|
|
|
has_key(${snippet} ${contents} outputSizes)
|
|
|
has_key(${snippet} ${contents} source)
|
|
|
has_key(${snippet} ${contents} language)
|
|
|
- elseif (snippet MATCHES ^custom-*)
|
|
|
+ elseif (filename MATCHES ^custom-*)
|
|
|
has_key(${snippet} ${contents} target)
|
|
|
has_key(${snippet} ${contents} outputs)
|
|
|
has_key(${snippet} ${contents} outputSizes)
|
|
|
- elseif (snippet MATCHES ^test-*)
|
|
|
+ elseif (filename MATCHES ^test-*)
|
|
|
has_key(${snippet} ${contents} testName)
|
|
|
endif()
|
|
|
if(ARGS_DYNAMIC_QUERY)
|
|
|
has_key(${snippet} ${contents} dynamicSystemInformation)
|
|
|
- string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET ${contents} dynamicSystemInformation)
|
|
|
+ string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET "${contents}" dynamicSystemInformation)
|
|
|
if (noInfo MATCHES NOTFOUND)
|
|
|
has_key(${snippet} ${dynamicSystemInfo} beforeCPULoadAverage)
|
|
|
has_key(${snippet} ${dynamicSystemInfo} beforeHostMemoryUsed)
|
|
|
@@ -55,7 +56,7 @@ macro(snippet_has_fields snippet contents)
|
|
|
endif()
|
|
|
else()
|
|
|
has_not_key(${snippet} ${contents} dynamicSystemInformation)
|
|
|
- string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET ${contents} dynamicSystemInformation)
|
|
|
+ string(JSON dynamicSystemInfo ERROR_VARIABLE noInfo GET "${contents}" dynamicSystemInformation)
|
|
|
if (noInfo MATCHES NOTFOUND)
|
|
|
has_not_key(${snippet} ${dynamicSystemInfo} beforeCPULoadAverage)
|
|
|
has_not_key(${snippet} ${dynamicSystemInfo} beforeHostMemoryUsed)
|
|
|
@@ -66,8 +67,8 @@ macro(snippet_has_fields snippet contents)
|
|
|
endmacro()
|
|
|
|
|
|
macro(snippet_valid_timing contents)
|
|
|
- string(JSON start GET ${contents} timeStart)
|
|
|
- string(JSON duration GET ${contents} duration)
|
|
|
+ string(JSON start GET "${contents}" timeStart)
|
|
|
+ string(JSON duration GET "${contents}" duration)
|
|
|
if (${start} LESS 0)
|
|
|
snippet_error(${snippet} "Negative time start: ${start}")
|
|
|
endif()
|
|
|
@@ -79,18 +80,18 @@ endmacro()
|
|
|
macro(verify_snippet snippet contents)
|
|
|
snippet_has_fields(${snippet} ${contents})
|
|
|
snippet_valid_timing(${contents})
|
|
|
- string(JSON version GET ${contents} version)
|
|
|
+ string(JSON version GET "${contents}" version)
|
|
|
if (NOT ${version} EQUAL 1)
|
|
|
snippet_error(${snippet} "Version must be 1, got: ${version}")
|
|
|
endif()
|
|
|
- string(JSON role GET ${contents} role)
|
|
|
+ string(JSON role GET "${contents}" role)
|
|
|
get_filename_component(filename ${snippet} NAME)
|
|
|
if (NOT ${filename} MATCHES ^${role}-)
|
|
|
snippet_error(${snippet} "Role \"${role}\" doesn't match snippet filename")
|
|
|
endif()
|
|
|
- string(JSON outputs ERROR_VARIABLE noOutputs GET ${contents} outputs)
|
|
|
+ string(JSON outputs ERROR_VARIABLE noOutputs GET "${contents}" outputs)
|
|
|
if (NOT outputs MATCHES NOTFOUND)
|
|
|
- string(JSON outputSizes ERROR_VARIABLE noOutputSizes GET ${contents} outputSizes)
|
|
|
+ string(JSON outputSizes ERROR_VARIABLE noOutputSizes GET "${contents}" outputSizes)
|
|
|
list(LENGTH outputs outputsLen)
|
|
|
list(LENGTH outputSizes outputSizesLen)
|
|
|
if (outputSizes MATCHES NOTFOUND OR NOT outputsLen EQUAL outputSizesLen)
|