From a68a2809548a78cf31db1036b4f23f77bbe0cfc7 Mon Sep 17 00:00:00 2001 From: Irfan Mohammad Date: Sat, 13 Sep 2025 13:09:39 +0000 Subject: [PATCH] ut - segv in nacm extension --- tests/utests/extensions/test_nacm.c | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/utests/extensions/test_nacm.c b/tests/utests/extensions/test_nacm.c index 9cbad1e3f8..333f04f858 100644 --- a/tests/utests/extensions/test_nacm.c +++ b/tests/utests/extensions/test_nacm.c @@ -112,10 +112,42 @@ test_deny_write(void **state) "/aa:l/{extension='nacm:default-deny-write'}", 0); } +static void +test_extension(void **state) +{ + const char *str; + struct lys_module *mod; + const struct lysc_node *snode; + + str = "module with-extensions {" +" yang-version 1.1;" +" prefix \"we\";" +" namespace \"we\";" +" import ietf-netconf-acm {" +" prefix \"nacm\";" +" }" +" extension annotation {" +" argument name;" +" description \"This is inspired by md:annotation\";" +" }" +" container c {" +" nacm:default-deny-write;" +" we:annotation last-modified {" +" type yang:date-and-time;" +" }" +" }" +"}"; + + /* compile without obsolete nodes */ + assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, &mod), LY_SUCCESS); + CHECK_LOG_CTX(NULL, NULL, 0); +} + int main(void) { const struct CMUnitTest tests[] = { + UTEST(test_extension, setup), UTEST(test_deny_all, setup), UTEST(test_deny_write, setup), };