Skip to content

Commit

Permalink
debug version/tag test
Browse files Browse the repository at this point in the history
  • Loading branch information
levb committed Jul 11, 2023
1 parent 571eb3d commit bdd2f55
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 16890 in test/test.c

View check run for this annotation

Codecov / codecov/patch

test/test.c#L16890

Added line #L16890 was not covered by tests
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);

Check warning on line 16892 in test/test.c

View check run for this annotation

Codecov / codecov/patch

test/test.c#L16892

Added line #L16892 was not covered by tests
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);

Check warning on line 16900 in test/test.c

View check run for this annotation

Codecov / codecov/patch

test/test.c#L16900

Added line #L16900 was not covered by tests
// 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`
Expand Down

0 comments on commit bdd2f55

Please sign in to comment.