aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVasil Velichckov <vvvelichkov@gmail.com>2016-01-14 17:55:51 +0200
committerAnders Broman <a.broman58@gmail.com>2016-02-04 05:13:16 +0000
commitd5c1449d1b7ae0a2a04e401f9015a516ba7201f9 (patch)
treeb135127e4533399a59e5db30a7377ca73bc21992 /test
parentf6ff90fed6b18af3885d2cd66452004977cbcf24 (diff)
[text2pcap] Fix parsing of hash sign at the end of the line
Change-Id: I4ff1ef28aba353fd7548cb5c0603fc29479aa854 Reviewed-on: https://code.wireshark.org/review/13294 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/captures/text2pcap_hash_eol.txt10
-rwxr-xr-xtest/suite-text2pcap.sh29
2 files changed, 39 insertions, 0 deletions
diff --git a/test/captures/text2pcap_hash_eol.txt b/test/captures/text2pcap_hash_eol.txt
new file mode 100644
index 0000000000..b7c6d2f62f
--- /dev/null
+++ b/test/captures/text2pcap_hash_eol.txt
@@ -0,0 +1,10 @@
+2015-10-01 21:16:24.317453 127.0.0.1 -> 127.0.0.1 UDP 96 Source port: 36887 Destination port: 36888
+
+0000 00 00 00 00 00 00 00 00 00 00 00 00 08 00 45 00 ..............E.
+0010 00 3e 3b f2 40 00 40 11 00 bb 7f 00 00 01 7f 00 .>;.@.@.........
+0020 00 01 90 17 90 18 00 2a 00 00 00 00 01 00 00 01 .......*........
+0030 00 00 00 00 00 00 01 01 01 01 01 01 01 01 20 23 .............. #
+0040 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ................
+0050 01 01 01 01 01 01 01 01 01 01 01 01 2f cc 9c e4 ............/...
+
+#TEXT2PCAP test_directive
diff --git a/test/suite-text2pcap.sh b/test/suite-text2pcap.sh
index 2f87c7b844..d987662b5f 100755
--- a/test/suite-text2pcap.sh
+++ b/test/suite-text2pcap.sh
@@ -82,6 +82,12 @@ text2pcap_common_check() {
test_step_failed "text2pcap didn't complete"
fi
+ grep -q "Inconsistent offset" testout.txt
+ if [ $? -eq 0 ]; then
+ cat ./testout.txt
+ test_step_failed "text2pcap detected inconsistent offset"
+ fi
+
text2pcap_capinfos "./testout.pcap"
if [ ! $? -eq $EXIT_OK ]; then
test_step_failed "text2pcap_capinfos return error"
@@ -284,6 +290,28 @@ text2pcap_sip_pcapng_test() {
text2pcap_basic_test "sip.pcapng"
}
+text2pcap_step_hash_at_eol() {
+ $TEXT2PCAP -n -d -t "%Y-%m-%d %H:%M:%S."\
+ "${CAPTURE_DIR}/text2pcap_hash_eol.txt" testout.pcap > testout.txt 2>&1
+ RETURNVALUE=$?
+
+ grep -q "Inconsistent offset" testout.txt
+ if [ $? -eq 0 ]; then
+ cat ./testout.txt
+ test_step_failed "text2pcap failed to parse the hash sign at the end of the line"
+ fi
+
+ #Check that #TEXT2PCAP is not prased as a comment
+ grep -q "Directive \[ test_directive" testout.txt
+ if [ $? -ne 0 ]; then
+ cat ./testout.txt
+ test_step_failed "text2pcap failed to parse #TEXT2PCAP test_directive"
+ fi
+
+ text2pcap_common_pcapng_check $RETURNVALUE "Ethernet" 1 96
+ test_step_ok
+}
+
text2pcap_cleanup_step() {
rm -f ./testin.txt
rm -f ./testout.txt
@@ -315,6 +343,7 @@ text2pcap_suite() {
test_step_add "testing with dns+icmp.pcapng.gz" text2pcap_dns_icmp_pcapng_gz_test
test_step_add "testing with packet-h2-14_headers.pcapng" text2pcap_packet_h2_14_headers_pcapng_test
test_step_add "testing with sip.pcapng" text2pcap_sip_pcapng_test
+ test_step_add "hash sign at the end of the line" text2pcap_step_hash_at_eol
}
#