From bdd2f55dfdc5fca366bda66868ecf02d86a3b1cd Mon Sep 17 00:00:00 2001 From: Lev Brouk Date: Mon, 10 Jul 2023 17:32:37 -0700 Subject: [PATCH] debug version/tag test --- test/test.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test/test.c b/test/test.c index c13b5823..0ce6efcf 100644 --- a/test/test.c +++ b/test/test.c @@ -16879,24 +16879,25 @@ test_VersionMatchesTag(void) { natsStatus s = NATS_OK; const char *tag; + char test_name[256]; char *sanitize_write_after_free = calloc(1, 1); free(sanitize_write_after_free); *sanitize_write_after_free = 1; testCond(*sanitize_write_after_free == 1); - tag = getenv("TRAVIS_TAG"); - if ((tag == NULL) || (tag[0] == '\0')) + if (tag = getenv("TRAVIS_TAG"), ((tag != NULL) && (tag[0] != '\0'))) + snprintf(test_name, sizeof(test_name), "Check version '%s' matches TRAVIS_TAG '%s'", nats_GetVersion(), tag); + else if (tag = getenv("GITHUB_TAG"), ((tag != NULL) && (tag[0] == '\0'))) + snprintf(test_name, sizeof(test_name), "Check version '%s' matches GITHUB_TAG '%s'", nats_GetVersion(), tag); + else { - tag = getenv("GITHUB_TAG"); - if ((tag == NULL) || (tag[0] == '\0')) - { - test("Skipping test since no tag detected: "); - testCond(true); - return; - } + test("Skipping test since no tag detected: "); + testCond(true); + return; } - test("Check tag and version match: "); + + test(test_name); // We expect a tag of the form vX.Y.Z. If that's not the case, // we need someone to have a look. So fail if first letter is not // a `v`