summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/keywords')
-rw-r--r--src/tests/keywords/all.mk39
-rw-r--r--src/tests/keywords/randstr16
2 files changed, 40 insertions, 15 deletions
diff --git a/src/tests/keywords/all.mk b/src/tests/keywords/all.mk
index 739b738..6535d35 100644
--- a/src/tests/keywords/all.mk
+++ b/src/tests/keywords/all.mk
@@ -21,15 +21,6 @@ $(BUILD_DIR)/tests/keywords:
@mkdir -p $@
#
-# Find which input files are needed by the tests
-# strip out the ones which exist
-# move the filenames to the build directory.
-#
-BOOTSTRAP_EXISTS := $(addprefix $(DIR)/,$(addsuffix .attrs,$(KEYWORD_FILES)))
-BOOTSTRAP_NEEDS := $(filter-out $(wildcard $(BOOTSTRAP_EXISTS)),$(BOOTSTRAP_EXISTS))
-BOOTSTRAP := $(subst $(DIR),$(BUILD_DIR)/tests/keywords,$(BOOTSTRAP_NEEDS))
-
-#
# For each file, look for precursor test.
# Ensure that each test depends on its precursors.
#
@@ -49,16 +40,34 @@ $(BUILD_DIR)/tests/keywords/depends.mk: $(addprefix $(DIR)/,$(KEYWORD_FILES)) |
done
#
-# These ones get copied over from the default input
+# For sheer laziness, allow "make test.keywords.foo"
#
-$(BOOTSTRAP): $(DIR)/default-input.attrs | $(BUILD_DIR)/tests/keywords
- @cp $< $@
+define KEYWORD_TEST
+tests.keywords.${1}: $(addprefix $(OUTPUT)/,${1})
+
+tests.keywords.help: TEST_KEYWORDS_HELP += tests.keywords.${1}
+
+OUTPUT := $(BUILD_DIR)/tests/keywords
#
-# These ones get copied over from their original files
+# Create the input attrs, either from the test-specific input,
+# or from the default input.
#
-$(BUILD_DIR)/tests/keywords/%.attrs: $(DIR)/%.attrs | $(BUILD_DIR)/tests/keywords
- @cp $< $@
+$(OUTPUT)/${1}: $(OUTPUT)/${1}.attrs | $(dir $(OUTPUT)/${1})
+$(OUTPUT)/${1}.attrs: | $(dir $(OUTPUT)/${1})
+
+ifneq "$(wildcard src/tests/keywords/${1}.attrs)" ""
+$(OUTPUT)/${1}.attrs: src/tests/keywords/${1}.attrs
+else
+$(OUTPUT)/${1}.attrs: src/tests/keywords/default-input.attrs
+endif
+ @cp $$< $$@
+ifeq "${1}" "mschap"
+$(OUTPUT)/${1}: rlm_mschap.la
+endif
+
+endef
+$(foreach x,$(KEYWORD_FILES),$(eval $(call KEYWORD_TEST,$x)))
#
# Don't auto-remove the files copied by the rule just above.
diff --git a/src/tests/keywords/randstr b/src/tests/keywords/randstr
new file mode 100644
index 0000000..6884cb0
--- /dev/null
+++ b/src/tests/keywords/randstr
@@ -0,0 +1,16 @@
+update request {
+ &Tmp-Octets-0 := "0x%{randstr:16h}"
+ &Tmp-String-0 := "%{randstr:16h}"
+}
+
+if ("%{length:Tmp-Octets-0}" == 16) {
+ update reply {
+ Filter-Id := "filter"
+ }
+}
+
+if ("%{length:Tmp-String-0}" == 32) {
+ update reply {
+ Filter-Id := "filter"
+ }
+}