diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64d7c9aa..cd3c7356 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: push: pull_request: +env: + NLTST_IN_CI: 1 + jobs: clang-format: runs-on: ubuntu-latest diff --git a/tests/nl-test-util.c b/tests/nl-test-util.c index 4e5caec7..fda98752 100644 --- a/tests/nl-test-util.c +++ b/tests/nl-test-util.c @@ -678,6 +678,13 @@ void _nltst_assert_link_exists_full(const char *ifname, bool exists) /*****************************************************************************/ +bool _nltst_in_ci(void) +{ + return _nl_streq0(getenv("NLTST_IN_CI"), "1"); +} + +/*****************************************************************************/ + bool _nltst_has_iproute2(void) { static int has = -1; @@ -693,6 +700,10 @@ bool _nltst_skip_no_iproute2(const char *msg) if (_nltst_has_iproute2()) return false; + ck_assert_msg( + !_nltst_in_ci(), + "We seem to not have iproute2, but we are in NLTST_IN_CI=1. This is fatal."); + printf("skip test due to missing iproute2%s%s%s\n", msg ? " (" : "", msg ?: "", msg ? ")" : ""); return true; diff --git a/tests/nl-test-util.h b/tests/nl-test-util.h index b64d830f..0d37d354 100644 --- a/tests/nl-test-util.h +++ b/tests/nl-test-util.h @@ -410,6 +410,8 @@ void nltst_netns_leave(struct nltst_netns *nsdata); #define _nltst_system(command) _nltst_assert_retcode(system(command)) +bool _nltst_in_ci(void); + bool _nltst_has_iproute2(void); bool _nltst_skip_no_iproute2(const char *msg);