summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2024-05-17 16:37:03 (GMT)
committerThomas Haller <thaller@redhat.com>2024-05-17 17:03:01 (GMT)
commitd784f2cb42bde01f27feacebdfaf51033ae82f02 (patch)
tree3f6c75aa085d405c3ae9f1a92554bf2ca076bfa4
parentdcb9e2ef8c625aaa029915cd41705d0713f53332 (diff)
downloadlibnl-d784f2cb42bde01f27feacebdfaf51033ae82f02.zip
libnl-d784f2cb42bde01f27feacebdfaf51033ae82f02.tar.gz
libnl-d784f2cb42bde01f27feacebdfaf51033ae82f02.tar.bz2
tests: set NLTST_IN_CI for not skipping tests accidentally
In CI, we know which tests should be skipped. Let github actions set NLTST_IN_CI=1, and disable certain skip checks.
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--tests/nl-test-util.c11
-rw-r--r--tests/nl-test-util.h2
3 files changed, 16 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 64d7c9a..cd3c735 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 4e5caec..fda9875 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 b64d830..0d37d35 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);