]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add pair_nested_tests - pair_tests using nested attributes
authorNick Porter <nick@portercomputing.co.uk>
Fri, 7 Jul 2023 07:10:40 +0000 (08:10 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Fri, 7 Jul 2023 08:16:45 +0000 (09:16 +0100)
src/lib/util/all.mk
src/lib/util/pair_nested_tests.c [new symlink]
src/lib/util/pair_nested_tests.mk [new file with mode: 0644]
src/lib/util/pair_tests.c

index 855353a0a3b2d2f0b9cabad0d8152a3228d48fbf..343225a9f8c23ba7eae0028fb6772e9401bdced2 100644 (file)
@@ -12,6 +12,7 @@ SUBMAKEFILES := \
        minmax_heap_tests.mk \
        pair_legacy_tests.mk \
        pair_list_perf_test.mk \
+       pair_nested_tests.mk \
        pair_tests.mk \
        rb_tests.mk \
        sbuff_tests.mk \
diff --git a/src/lib/util/pair_nested_tests.c b/src/lib/util/pair_nested_tests.c
new file mode 120000 (symlink)
index 0000000..8a619eb
--- /dev/null
@@ -0,0 +1 @@
+pair_tests.c
\ No newline at end of file
diff --git a/src/lib/util/pair_nested_tests.mk b/src/lib/util/pair_nested_tests.mk
new file mode 100644 (file)
index 0000000..f221121
--- /dev/null
@@ -0,0 +1,9 @@
+TARGET         := pair_nested_tests$(E)
+SOURCES        := pair_nested_tests.c
+
+SRC_CFLAGS     := -DTEST_NESTED_PAIRS
+TGT_LDLIBS     := $(LIBS) $(GPERFTOOLS_LIBS)
+TGT_LDFLAGS    := $(LDFLAGS) $(GPERFTOOLS_LDFLAGS)
+TGT_PREREQS    := libfreeradius-util$(L) libfreeradius-radius$(L)
+
+TGT_INSTALLDIR :=
index 4c4159c6e18d03e7c5d70d09791e1a24e8760f35..447cc54f64e5c3b7b86a7395aab38077e407ba6a 100644 (file)
@@ -61,7 +61,11 @@ static void test_init(void)
        autofree = talloc_autofree_context();
        if (!autofree) {
        error:
+#ifdef TEST_NESTED_PAIRS
+               fr_perror("pair_nested_tests");
+#else
                fr_perror("pair_tests");
+#endif
                fr_exit_now(EXIT_FAILURE);
        }
 
@@ -75,7 +79,11 @@ static void test_init(void)
        /* Initialize the "test_pairs" list */
        fr_pair_list_init(&test_pairs);
 
+#ifdef TEST_NESTED_PAIRS
+       if (fr_pair_test_list_alloc_nested(autofree, &test_pairs, NULL) < 0) goto error;
+#else
        if (fr_pair_test_list_alloc(autofree, &test_pairs, NULL) < 0) goto error;
+#endif
 }
 
 /*