Project

General

Profile

Actions

Feature #1025

open

seperate #ifdef UNITTEST code into their own files

Added by Mark Solaris about 11 years ago. Updated over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

It would be useful if the UNITTEST code was put into their own files:

suricata-1.4.6/src root# ls -al unit*.c
-rw-r--r--   1 root     root       15695 Nov  3 23:54 unit-test-decode-icmp4.c
-rw-r--r--   1 root     root       46984 Nov  3 23:34 unit-test-decode-ipv4.c
-rw-r--r--   1 root     root      223181 Nov  3 23:17 unit-test-detect.c
-rw-r--r--   1 root     root      136477 Nov  3 23:07 unit-test-stream-tcp.c

and then the Makefile.in is updated to reference it:

# diff -u ../../suricata-1.4.6.orig/src/Makefile.in Makefile.in
--- ../../suricata-1.4.6.orig/src/Makefile.in   Tue Sep 24 20:28:49 2013
+++ Makefile.in Sun Nov  3 23:56:13 2013
@@ -225,6 +225,8 @@
        tmqh-simple.h tm-queuehandlers.c tm-queuehandlers.h \
        tm-queues.c tm-queues.h tm-threads.c tm-threads.h \
        tm-threads-common.h unix-manager.c unix-manager.h \
+       unit-test-decode-icmp4.c \
+       unit-test-decode-ipv4.c unit-test-detect.c unit-test-stream-tcp.c \
        util-action.c util-action.h util-atomic.c util-atomic.h \
        util-bloomfilter-counting.c util-bloomfilter-counting.h \
        util-bloomfilter.c util-bloomfilter.h util-buffer.c \
@@ -392,6 +394,8 @@
        tmqh-packetpool.$(OBJEXT) tmqh-ringbuffer.$(OBJEXT) \
        tmqh-simple.$(OBJEXT) tm-queuehandlers.$(OBJEXT) \
        tm-queues.$(OBJEXT) tm-threads.$(OBJEXT) \
+       unit-test-decode-icmp4.$(OBJEXT) unit-test-decode-ipv4.$(OBJEXT) \
+       unit-test-detect.$(OBJEXT) unit-test-stream-tcp.$(OBJEXT) \
        unix-manager.$(OBJEXT) util-action.$(OBJEXT) \
        util-atomic.$(OBJEXT) util-bloomfilter-counting.$(OBJEXT) \
        util-bloomfilter.$(OBJEXT) util-buffer.$(OBJEXT) \
@@ -773,6 +777,8 @@
        tmqh-simple.h tm-queuehandlers.c tm-queuehandlers.h \
        tm-queues.c tm-queues.h tm-threads.c tm-threads.h \
        tm-threads-common.h unix-manager.c unix-manager.h \
+       unit-test-decode-icmp4.c unit-test-decode-ipv4.c \
+       unit-test-detect.c unit-test-stream-tcp.c \
        util-action.c util-action.h util-atomic.c util-atomic.h \
        util-bloomfilter-counting.c util-bloomfilter-counting.h \
        util-bloomfilter.c util-bloomfilter.h util-buffer.c \
@@ -1179,6 +1185,10 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmqh-packetpool.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmqh-ringbuffer.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmqh-simple.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-decode-icmp4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-decode-ipv4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-detect.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-stream-tcp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unix-manager.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util-action.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util-affinity.Po@am__quote@

It makes the actual code much easier to work with (greps are shorter etc) and you can see which files you don't need to immediately update when doing changes.

It's a preference of mine so I've listed it as a feature.

Thanks.


Related issues 2 (2 open0 closed)

Related to Suricata - Task #2975: convert unittests to new FAIL/PASS APIAssignedCommunity TicketActions
Blocked by Suricata - Task #3166: src code file reorgIn ProgressJason IshActions
Actions

Also available in: Atom PDF