Skip to content

Commit

Permalink
radsniff: The test need files from LFS (#3481)
Browse files Browse the repository at this point in the history
The radsniff test needs some files on LFS. therefore, if the system
doesn't have the 'git lfs' installed properly. just skip it and keep
going.

Scald 🔋
  • Loading branch information
jpereira committed Jun 4, 2020
1 parent 25901a4 commit c8707da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/tests/all.mk
Expand Up @@ -5,6 +5,11 @@
PORT := 12340
SECRET := testing123

#
# We need the 'git-lfs' installed to fetch some binary files.
#
GIT_HAS_LFS = $(shell git lfs 1> /dev/null 2>&1 && echo yes || echo no)

#
# To work around OpenSSL issues with travis.
#
Expand Down Expand Up @@ -51,6 +56,7 @@ test: \
test.modules \
test.radiusd-c \
test.radclient \
test.radsniff \
test.auth \
test.digest \
test.radmin \
Expand Down
23 changes: 16 additions & 7 deletions src/tests/radsniff/all.mk
Expand Up @@ -2,12 +2,6 @@
# Unit tests for radsniff against pcap packets.
#

#
# Test name
#
TEST := test.radsniff
FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.txt))

#
# .pcap file to be injested.
#
Expand All @@ -16,13 +10,28 @@ FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.txt))
#
# TZ=UTC tcpdump -i lo0 -c100 -w radius-auth+acct+coa-100pkts.pcap "port 1812 or port 1813 or port 3799"
#
# NOTE: The src/tests/radsniff/radius-auth+acct+coa-100pkts.pcap.gz will be fetched during "git pull"
# if the system has the "git lfs" installed properly. if not, it will be ignored.
#
PCAP_IN := $(BUILD_DIR)/tests/radsniff/radius-auth+acct+coa-100pkts.pcap

ifeq "$(GIT_HAS_LFS)" "no"
test.radsniff:
$(Q)echo "WARNING: Can't execute 'test.radsniff' without 'git lfs' installed. ignoring."
else

#
# Test name
#
TEST := test.radsniff
FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.txt))

$(eval $(call TEST_BOOTSTRAP))

#
# Uncompress the input .pcap file
#
#
.PRECIOUS: $(OUTPUT)/%.pcap
$(OUTPUT)/%.pcap: $(DIR)/%.pcap.gz
$(Q)gunzip -c $< > $@
Expand Down Expand Up @@ -72,4 +81,4 @@ $(OUTPUT)/%.txt: $(DIR)/%.txt $(TEST_BIN_DIR)/radsniff $(PCAP_IN)
exit 1; \
fi
$(Q)touch $@

endif

0 comments on commit c8707da

Please sign in to comment.