diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-05-14 11:06:33 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-05-14 11:06:33 +0300 |
commit | 542d6683b8a561d71eac8431627d18713f62178b (patch) | |
tree | 69513444e84e0954edd6259268915e7b3ae7f6c9 /tests-other | |
parent | 45a36ad034b456f38359d3a6695c72de2d687005 (diff) |
Validate that C ABI in CMakeLists.txt matches code.
Diffstat (limited to 'tests-other')
-rw-r--r-- | tests-other/c_api_test.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests-other/c_api_test.c b/tests-other/c_api_test.c index 2d643c7e..db396256 100644 --- a/tests-other/c_api_test.c +++ b/tests-other/c_api_test.c @@ -116,12 +116,32 @@ int main(int argc, char **argv) SpvId *buffer = NULL; size_t word_count = 0; - if (argc != 2) + if (argc != 5) return 1; if (read_file(argv[1], &buffer, &word_count) < 0) return 1; + unsigned abi_major, abi_minor, abi_patch; + spvc_get_version(&abi_major, &abi_minor, &abi_patch); + if (abi_major != strtoul(argv[2], NULL, 0)) + { + fprintf(stderr, "VERSION_MAJOR mismatch!\n"); + return 1; + } + + if (abi_minor != strtoul(argv[3], NULL, 0)) + { + fprintf(stderr, "VERSION_MINOR mismatch!\n"); + return 1; + } + + if (abi_patch != strtoul(argv[4], NULL, 0)) + { + fprintf(stderr, "VERSION_PATCH mismatch!\n"); + return 1; + } + SPVC_CHECKED_CALL(spvc_context_create(&context)); spvc_context_set_error_callback(context, error_callback, NULL); SPVC_CHECKED_CALL(spvc_context_parse_spirv(context, buffer, word_count, &ir)); |