From f63c3a1af64075eed18e8d8f5c98305087d17bce Mon Sep 17 00:00:00 2001 From: Free Ekanayaka Date: Thu, 21 Dec 2023 16:54:13 +0000 Subject: [PATCH] test: Skip environment-sensitive tests, unless "CI" is set Signed-off-by: Free Ekanayaka --- test/lib/aio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/lib/aio.c b/test/lib/aio.c index c731b734..39dc18ce 100644 --- a/test/lib/aio.c +++ b/test/lib/aio.c @@ -15,6 +15,14 @@ int AioFill(aio_context_t *ctx, unsigned n) int limit; int used; + /* Only run these tests if the "CI" variable is set (GitHub runners do set + * it). This avoids spurious failures when running the tests in environments + * that are not isolated enough, and that might run other workflows using + * the AIO kernel sub-system. */ + if (getenv("CI") == NULL) { + return -1; + } + /* Figure out how many events are available. */ fd = open("/proc/sys/fs/aio-max-nr", O_RDONLY); munit_assert_int(fd, !=, -1);