Skip to content

Commit

Permalink
Use .attrs instead of .txt for request/response definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Nov 3, 2013
1 parent d69b551 commit cb93eed
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/tests/keywords/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
See "update" and "default-input.txt" for examples.
See "update" and "default-input.attrs" for examples.

In short, the test framework assumes Access-Request with PAP
authentication. The password is hard-coded into the configuration,
Expand All @@ -10,11 +10,11 @@ FOO contains a short piece of "unlang". The shorter the better. The
goal is to do something useful in unlang, and modify the input packet
and/or the reply.

FOO.txt contains the input packet and the filter for the reply. There
FOO.attrs contains the input packet and the filter for the reply. There
always has to be attributes in the input, and filter attributes in the
reply.

If FOO.txt doesn't exist, then the "default-input.txt" file is used.
If FOO.txt doesn't exist, then the "default-input.attrs" file is used.
This allows many tests to be simplified, as all they need is a little
bit of "unlang".

Expand Down
14 changes: 7 additions & 7 deletions src/tests/keywords/all.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(BUILD_DIR)/tests/keywords:
# strip out the ones which exist
# move the filenames to the build directory.
#
BOOTSTRAP_EXISTS := $(addprefix $(DIR)/,$(addsuffix .txt,$(FILES)))
BOOTSTRAP_EXISTS := $(addprefix $(DIR)/,$(addsuffix .attrs,$(FILES)))
BOOTSTRAP_NEEDS := $(filter-out $(wildcard $(BOOTSTRAP_EXISTS)),$(BOOTSTRAP_EXISTS))
BOOTSTRAP := $(subst $(DIR),$(BUILD_DIR)/tests/keywords,$(BOOTSTRAP_NEEDS))

Expand All @@ -30,32 +30,32 @@ BOOTSTRAP_COPY := $(subst $(DIR),$(BUILD_DIR)/tests/keywords,$(BOOTSTRAP_NEEDS)
#
# These ones get copied over from the default input
#
$(BOOTSTRAP): $(DIR)/default-input.txt | $(BUILD_DIR)/tests/keywords
$(BOOTSTRAP): $(DIR)/default-input.attrs | $(BUILD_DIR)/tests/keywords
@cp $< $@

#
# These ones get copied over from their original files
#
$(BUILD_DIR)/tests/keywords/%.txt: $(DIR)/%.txt | $(BUILD_DIR)/tests/keywords
$(BUILD_DIR)/tests/keywords/%.attrs: $(DIR)/%.attrs | $(BUILD_DIR)/tests/keywords
@cp $< $@

#
# Don't auto-remove the files copied by the rule just above.
# It's unnecessary, and it clutters the output with crap.
#
.PRECIOUS: $(BUILD_DIR)/tests/keywords/%.txt
.PRECIOUS: $(BUILD_DIR)/tests/keywords/%.attrs

#
# Files in the output dir depend on the unit tests
#
# src/tests/keywords/FOO unlang for the test
# src/tests/keywords/FOO.txt input RADIUS and output filter
# src/tests/keywords/FOO.attrs input RADIUS and output filter
# build/tests/keywords/FOO updated if the test succeeds
# build/tests/keywords/FOO.log debug output for the test
#
$(BUILD_DIR)/tests/keywords/%: $(DIR)/% $(BUILD_DIR)/tests/keywords/%.txt $(BUILD_DIR)/bin/unittest | $(BUILD_DIR)/tests/keywords raddb/mods-enabled/pap raddb/mods-enabled/always
$(BUILD_DIR)/tests/keywords/%: $(DIR)/% $(BUILD_DIR)/tests/keywords/%.attrs $(BUILD_DIR)/bin/unittest | $(BUILD_DIR)/tests/keywords raddb/mods-enabled/pap raddb/mods-enabled/always
@echo UNIT-TEST $(notdir $@)
@KEYWORD=$(notdir $@) $(JLIBTOOL) --quiet --mode=execute ./$(BUILD_DIR)/bin/unittest -D share -d src/tests/keywords/ -i $@.txt -f $@.txt -xx > $@.log 2>&1
@KEYWORD=$(notdir $@) $(JLIBTOOL) --quiet --mode=execute ./$(BUILD_DIR)/bin/unittest -D share -d src/tests/keywords/ -i $@.attrs -f $@.attrs -xx > $@.log 2>&1
@touch $@


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cb93eed

Please sign in to comment.