From: Nick Porter Date: Fri, 7 Jul 2023 07:10:40 +0000 (+0100) Subject: Add pair_nested_tests - pair_tests using nested attributes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2027c9bb6bbfb81f7785817cdcc40c27611fc4cd;p=thirdparty%2Ffreeradius-server.git Add pair_nested_tests - pair_tests using nested attributes --- diff --git a/src/lib/util/all.mk b/src/lib/util/all.mk index 855353a0a3b..343225a9f8c 100644 --- a/src/lib/util/all.mk +++ b/src/lib/util/all.mk @@ -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 index 00000000000..8a619ebd697 --- /dev/null +++ b/src/lib/util/pair_nested_tests.c @@ -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 index 00000000000..f221121096d --- /dev/null +++ b/src/lib/util/pair_nested_tests.mk @@ -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 := diff --git a/src/lib/util/pair_tests.c b/src/lib/util/pair_tests.c index 4c4159c6e18..447cc54f64e 100644 --- a/src/lib/util/pair_tests.c +++ b/src/lib/util/pair_tests.c @@ -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 } /*