This commit adds tests for reference.config file validation.
Test 1 uses Suricata's test mode with an invalid formatted file while
test 2 runs Suricata in inspect mode with the same invalid file.
--- /dev/null
+this is not correct
--- /dev/null
+alert tcp any any -> any 25 (msg:"ET POLICY Inbound Frequent Emails - Possible Spambot Inbound"; \
+ flow:established; content:"mail from|3a|"; nocase; \
+ threshold: type threshold, track by_src, count 10, seconds 60; \
+ reference:url,doc.emergingthreats.net/2002087; classtype:misc-activity; sid:2002087; rev:10;)
--- /dev/null
+requires:
+ min-version: 7
+
+command: |
+ ${SRCDIR}/src/suricata --set reference-config-file="${TEST_DIR}/reference.config" -l ${OUTPUT_DIR} -c ${SRCDIR}/suricata.yaml -S ${TEST_DIR}/test.rules -T
+
+exit-code: 1
+
+checks:
+ - shell:
+ args: grep "SC_ERR_REFERENCE_CONFIG" suricata.log | wc -l | xargs
+ expect: 1
--- /dev/null
+this is not correct
--- /dev/null
+alert tcp any any -> any 25 (msg:"ET POLICY Inbound Frequent Emails - Possible Spambot Inbound"; \
+ flow:established; content:"mail from|3a|"; nocase; \
+ threshold: type threshold, track by_src, count 10, seconds 60; \
+ reference:url,doc.emergingthreats.net/2002087; classtype:misc-activity; sid:2002087; rev:10;)
--- /dev/null
+requires:
+ min-version: 7
+
+command: |
+ ${SRCDIR}/src/suricata -v --set reference-config-file="${TEST_DIR}/reference.config" -l ${OUTPUT_DIR} -c ${SRCDIR}/suricata.yaml -S ${TEST_DIR}/test.rules -r ${TEST_DIR}/input.pcap
+
+checks:
+
+ - shell:
+ args: grep -e "SC_ERR_REFERENCE_CONFIG" suricata.log | wc -l | xargs
+ expect: 1
+
+ - shell:
+ args: grep -e "SC_ERR_REFERENCE_UNKNOWN" suricata.log | wc -l | xargs
+ expect: 1