From 986501029e04dd3a29f4d624337cb8d2ef67a8f9 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sat, 15 Mar 2025 04:09:29 +0000 Subject: [PATCH 1/2] tests: deal with configure overridden timestamp prec in unit test Previously if you configured a different timestamp precision then `make check` would fail as the non-default config is generated and fails test_cli config file comparison. Signed-off-by: Christian Hopps --- configure.ac | 5 +++++ tests/lib/cli/test_cli.refout.in | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 163772904d..f9f3286563 100644 --- a/configure.ac +++ b/configure.ac @@ -1054,6 +1054,11 @@ AC_MSG_FAILURE([Please specify a number from 0-12 for log precision ARG]) ;; esac with_log_timestamp_precision=${with_log_timestamp_precision:-0} +if test "${with_log_timestamp_precision}" != 0; then +AC_SUBST([LOG_TIMESTAMP_PRECISION_CLI], [" +log timestamp precision ${with_log_timestamp_precision}"]) +AM_SUBST_NOTMAKE([LOG_TIMESTAMP_PRECISION_CLI]) +fi AC_DEFINE_UNQUOTED([LOG_TIMESTAMP_PRECISION], [${with_log_timestamp_precision}], [Startup zlog timestamp precision]) AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use]) diff --git a/tests/lib/cli/test_cli.refout.in b/tests/lib/cli/test_cli.refout.in index 222abcdade..31b5a8c237 100644 --- a/tests/lib/cli/test_cli.refout.in +++ b/tests/lib/cli/test_cli.refout.in @@ -405,7 +405,7 @@ frr version @PACKAGE_VERSION@ frr defaults @DFLT_NAME@ ! hostname test -domainname test.domain +domainname test.domain@LOG_TIMESTAMP_PRECISION_CLI@ ! ! ! @@ -420,7 +420,7 @@ frr version @PACKAGE_VERSION@ frr defaults @DFLT_NAME@ ! hostname foohost -domainname test.domain +domainname test.domain@LOG_TIMESTAMP_PRECISION_CLI@ ! ! ! From bc3f7d9c07524112ccd9a5cb950511d4aab4c3f2 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Sat, 15 Mar 2025 04:10:24 +0000 Subject: [PATCH 2/2] tests: fix wrong callback function parameters in unit-test Signed-off-by: Christian Hopps --- tests/lib/northbound/test_oper_exists.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/lib/northbound/test_oper_exists.c b/tests/lib/northbound/test_oper_exists.c index 17afcc7fd4..52ecae2fef 100644 --- a/tests/lib/northbound/test_oper_exists.c +++ b/tests/lib/northbound/test_oper_exists.c @@ -157,13 +157,15 @@ const char *data_json = "\n" "}\n"; -static const struct lyd_node *test_oper_get_tree_locked(const char *xpath) +static const struct lyd_node *test_oper_get_tree_locked(const char *xpath __attribute__((unused)), + void **lock __attribute__((unused))) { ++data_tree_lock; return data_tree; } -static void test_oper_unlock_tree(const struct lyd_node *tree __attribute__((unused))) +static void test_oper_unlock_tree(const struct lyd_node *tree __attribute__((unused)), + void *lock __attribute__((unused))) { data_tree_lock--; }