Skip to content

Commit

Permalink
Merge pull request #5090 from elliefm/v311/slowio-valgrind
Browse files Browse the repository at this point in the history
slowio.testc: don't expect lightning fast response under valgrind
  • Loading branch information
elliefm authored Oct 18, 2024
2 parents 338c175 + ff2259e commit 5bab038
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cunit/slowio.testc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

#include <inttypes.h>

#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#else
/* no valgrind header? assume we're NOT running on valgrind. might
* lead to test failures if we are running on valgrind after all,
* but without the header there's no way to tell
*/
#define RUNNING_ON_VALGRIND (0)
#endif

static void test_initialize(void)
{
const struct slowio slowio_zero = {0};
Expand Down Expand Up @@ -125,7 +135,9 @@ static void test_slower_than_rate_limit(void)

diff = end - start;
/* should have taken basically no time at all */
CU_ASSERT(diff < 2 /* ms! */);
if (!RUNNING_ON_VALGRIND) {
CU_ASSERT(diff < 2 /* ms! */);
}
}
}

Expand Down

0 comments on commit 5bab038

Please sign in to comment.