From 0b137e3287372f2a88246cba1e54e247a1cde303 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Tue, 18 Jan 2022 12:34:01 -0600 Subject: [PATCH] gss: Workaround valgrind "lifetime not equal" issue --- lib/gssapi/krb5/test_kcred.c | 6 ++++-- lib/gssapi/test_kcred.c | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/gssapi/krb5/test_kcred.c b/lib/gssapi/krb5/test_kcred.c index 3cbba243f..c90a1443b 100644 --- a/lib/gssapi/krb5/test_kcred.c +++ b/lib/gssapi/krb5/test_kcred.c @@ -90,9 +90,11 @@ copy_import(void) if (!equal) errx(1, "names not equal"); - /* FIXME: This check is racy! */ - if (lifetime1 != lifetime2) + /* This check is racy! */ + if (getenv("TESTS_ENVIRONMENT") == NULL) && lifetime1 != lifetime2) errx(1, "lifetime not equal"); + if (lifetime1 != lifetime2) + warnx("lifetime not equal"); if (usage1 != usage1) errx(1, "usage not equal"); diff --git a/lib/gssapi/test_kcred.c b/lib/gssapi/test_kcred.c index 866ee78ec..abfe39044 100644 --- a/lib/gssapi/test_kcred.c +++ b/lib/gssapi/test_kcred.c @@ -102,10 +102,17 @@ copy_import(void) if (!equal) errx(1, "names not equal"); - /* FIXME: This check is racy! */ - if (lifetime1 != lifetime2) + /* + * This check is racy! It tends to fail when run with valgrind. + * + * make check-valgrind sets TESTS_ENVIRONMENT in the environment... + */ + if (getenv("TESTS_ENVIRONMENT") == NULL && lifetime1 != lifetime2) errx(1, "lifetime not equal %lu != %lu", (unsigned long)lifetime1, (unsigned long)lifetime2); + if (lifetime1 != lifetime2) + warnx("lifetime not equal %lu != %lu", + (unsigned long)lifetime1, (unsigned long)lifetime2); if (usage1 != usage2) { /* as long any of them is both are everything it ok */ @@ -127,10 +134,13 @@ copy_import(void) if (!equal) errx(1, "names not equal"); - /* FIXME: This check is racy! */ - if (lifetime1 != lifetime2) + /* This check is racy! */ + if (getenv("TESTS_ENVIRONMENT") == NULL && lifetime1 != lifetime2) errx(1, "lifetime not equal %lu != %lu", (unsigned long)lifetime1, (unsigned long)lifetime2); + if (lifetime1 != lifetime2) + warnx("lifetime not equal %lu != %lu", + (unsigned long)lifetime1, (unsigned long)lifetime2); gss_release_cred(&min_stat, &cred1); gss_release_cred(&min_stat, &cred2);