]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add and use -S require_enum_prefix=yes to unit_test_attribute
authorAlan T. DeKok <aland@freeradius.org>
Fri, 24 Jan 2025 21:03:20 +0000 (16:03 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 24 Jan 2025 21:03:20 +0000 (16:03 -0500)
all of the protocols pass tests without '&'.  The only things
remaining are the condition and xlat tests

src/bin/unit_test_attribute.c
src/tests/unit/all.mk
src/tests/unit/protocols/radius/tag.txt

index ab94fe563e671f0924dc4a1efedc2ab5fb01ab45..5bd1c49db4ffc205bd3237e838f4e2585847b0ce 100644 (file)
@@ -3771,7 +3771,7 @@ int main(int argc, char *argv[])
        default_log.fd = STDOUT_FILENO;
        default_log.print_level = false;
 
-       while ((c = getopt(argc, argv, "cd:D:F:fxMhpr:w:")) != -1) switch (c) {
+       while ((c = getopt(argc, argv, "cd:D:F:fxMhpr:S:w:")) != -1) switch (c) {
                case 'c':
                        do_commands = true;
                        break;
@@ -3809,6 +3809,15 @@ int main(int argc, char *argv[])
                        allow_purify = true;
                        break;
 
+               case 'S':
+                       if (strcmp(optarg, "require_enum_prefix=yes") == 0) {
+                               tmpl_require_enum_prefix = true;
+                               break;
+                       }
+
+                       fprintf(stderr, "Invalid option to -S\n");
+                       EXIT_WITH_FAILURE;
+
                case 'w':
                        write_filename = optarg;
                        break;
index 31e3bd369c988c9e6849876812a6819a8030176a..f38d81dc6beccd74bbfebe866dde9c24d393495e 100644 (file)
@@ -44,6 +44,8 @@ $(FILES.$(TEST)): export TZ = GMT
 #
 PROTOCOLS := $(subst $(DIR)/protocols/,,$(wildcard $(DIR)/protocols/*))
 define UNIT_TEST_PROTOCOLS
+$(addprefix $(OUTPUT)/,$(filter protocols/${1}/%.txt,$(FILES))): REQUIRE_ENUM_PREFIX=-S require_enum_prefix=yes
+
 $(addprefix $(OUTPUT)/,$(filter protocols/${1}/%.txt,$(FILES))): $(wildcard $(top_srcdir)/share/dictionary/${1}/dictionary*) $(BUILD_DIR)/lib/local/libfreeradius-${1}.la $(BUILD_DIR)/lib/libfreeradius-${1}.la
 
 ifeq "${1}" "eap"
@@ -82,14 +84,13 @@ $(BUILD_DIR)/tests/unit/xlat/purify.txt $(filter $(BUILD_DIR)/tests/unit/xlat/co
 #
 
 #REWRITE_FLAGS = -w $(BUILD_DIR)/tmp
-
 #
 #  And the actual script to run each test.
 #
 $(OUTPUT)/%: $(DIR)/% $(TEST_BIN_DIR)/unit_test_attribute
        $(eval DIR:=${top_srcdir}/src/tests/unit)
        @echo "UNIT-TEST $(lastword $(subst /, ,$(dir $@))) $(basename $(notdir $@))"
-       ${Q}if ! $(TEST_BIN)/unit_test_attribute $(PURIFY) $(REWRITE_FLAGS) -F ./src/tests/fuzzer-corpus -D ./share/dictionary -d $(DIR) -r "$@" $<; then \
+       ${Q}if ! $(TEST_BIN)/unit_test_attribute $(PURIFY) $(REWRITE_FLAGS) -F ./src/tests/fuzzer-corpus -D ./share/dictionary -d $(DIR) -r "$@" $(REQUIRE_ENUM_PREFIX) $<; then \
                echo "TZ=GMT $(TEST_BIN)/unit_test_attribute $(PURIFY) -F ./src/tests/fuzzer-corpus -D ./share/dictionary -d $(DIR) -r \"$@\" $<"; \
                rm -f $(BUILD_DIR)/tests/test.unit; \
                exit 1; \
index 22db3c448c679670cb65afbb391868235d7371cc..7bfdee51652effdafc8f5fd583095995310ae9e1 100644 (file)
@@ -11,7 +11,7 @@ match 1a 12 00 00 13 0a 41 0c 01 55 4e 50 4f 4c 49 43 45 44
 decode-pair -
 match Tag-1 = { Vendor-Specific = { Unisphere = { Service-Activate = "UNPOLICED" } } }
 
-pair Tag-2 = { &Vendor-Specific.Unisphere.Service-Activate = "PPPOE_SERVICE(3072000,2048000)" }
+pair Tag-2 = { Vendor-Specific.Unisphere.Service-Activate = "PPPOE_SERVICE(3072000,2048000)" }
 match Tag-2 = { Vendor-Specific = { Unisphere = { Service-Activate = "PPPOE_SERVICE(3072000,2048000)" } } }
 
 encode-pair Tag-2 = { Vendor-Specific.Unisphere.Service-Activate = "UNPOLICED" }