Skip to content

Commit 1cd5f7a

Browse files
galastarclaude
andcommitted
test: switch config-mode tests to shared config preset file
Replaces duplicated inline flags in prep_config/rewrite_config/replay_config targets with a single test/config.in loaded via --load-opts, so the three tools test against one common config file instead of drifting args. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 163d41e commit 1cd5f7a

3 files changed

Lines changed: 32 additions & 9 deletions

File tree

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,7 @@ AC_CONFIG_FILES([Makefile
19711971
src/common/Makefile
19721972
src/defines.h
19731973
test/Makefile
1974+
test/config
19741975
scripts/Makefile])
19751976

19761977
AC_OUTPUT

test/Makefile.am

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ standard_prep:
7878
$(TCPPREP) -i $(TEST_PCAP) -o test.auto_client -a client
7979
$(TCPPREP) -i $(TEST_PCAP) -o test.auto_server -a server
8080
$(TCPPREP) -i $(TEST_PCAP) -o test.auto_first -a first
81-
$(TCPPREP) -i $(TEST_PCAP) -a bridge -m 31 -M 16 -N \
82-
-C "This file was generated via the config file" -o test.prep_config
81+
$(TCPPREP) --load-opts config -o test.prep_config
8382
$(TCPPREP) -i $(TEST_PCAP) -o test.port -p
8483
$(TCPPREP) -i $(TEST_PCAP) -o test.mac -e 00:1f:f3:3c:e1:13
8584
$(TCPPREP) -i $(TEST_PCAP) -o test.cidr -c '96.17.211.0/24'
@@ -226,8 +225,7 @@ tcpreplay: replay_basic replay_nano_timer replay_cache replay_pps replay_rate re
226225
prep_config:
227226
$(PRINTF) "%s" "[tcpprep] Config mode test: "
228227
$(PRINTF) "%s\n" "*** [tcpprep] Config mode test: " >> test.log
229-
$(TCPPREP) $(ENABLE_DEBUG) -i $(TEST_PCAP) -a bridge -m 31 -M 16 -N \
230-
-C "This file was generated via the config file" -o test.$@1 >> test.log 2>&1
228+
$(TCPPREP) $(ENABLE_DEBUG) --load-opts=config -o test.$@1 >> test.log 2>&1
231229
if diff $(srcdir)/test.$@ test.$@1 >> test.log 2>&1; then \
232230
$(PRINTF) "\t\t\t%s\n" "OK"; \
233231
else \
@@ -590,8 +588,7 @@ rewrite_layer2:
590588
rewrite_config:
591589
$(PRINTF) "%s" "[tcprewrite] Config/VLAN Add test: "
592590
$(PRINTF) "%s\n" "*** [tcprewrite] Config/VLAN Add test: " >> test.log
593-
$(TCPREWRITE) $(ENABLE_DEBUG) -i $(TEST_PCAP) -o test.$@1 --enet-vlan=add \
594-
--enet-vlan-tag=45 --enet-vlan-cfi=1 --enet-vlan-pri=5 >> test.log 2>&1
591+
$(TCPREWRITE) $(ENABLE_DEBUG) --load-opts config >> test.log 2>&1
595592
if diff $(srcdir)/test$(VARIANT).$@ test.$@1 >> test.log 2>&1; then \
596593
$(PRINTF) "\t\t%s\n" "OK"; \
597594
else \
@@ -841,8 +838,7 @@ datadump_mode:
841838
replay_config:
842839
$(PRINTF) "%s" "[tcpreplay] Config file/VLAN add test: "
843840
$(PRINTF) "%s\n" "*** [tcpreplay] Config file/VLAN add test: " >> test.log
844-
$(TCPREPLAY) $(ENABLE_DEBUG) -c $(srcdir)/test.auto_bridge -i $(nic1) -I $(nic2) -t \
845-
$(TEST_PCAP) >> test.log 2>&1
841+
$(TCPREPLAY) $(ENABLE_DEBUG) --load-opts=config $(TEST_PCAP) >> test.log 2>&1
846842
if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
847843

848844
replay_dualfile:
@@ -892,6 +888,6 @@ clean:
892888
rm -f *1 test.log core* *~ primary.data secondary.data
893889

894890
distclean: clean
895-
rm -f Makefile Makefile.in
891+
rm -f Makefile Makefile.in config
896892

897893
maintainer-clean: distclean

test/config.in

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# tcpreplay - Replay network traffic stored in pcap files
2+
# preset/initialization file
3+
#
4+
[TCPREPLAY]
5+
cachefile @srcdir@/test.auto_bridge
6+
intf1 @nic1@
7+
intf2 @nic2@
8+
topspeed
9+
10+
[TCPREWRITE]
11+
infile @srcdir@/test.pcap
12+
outfile test.rewrite_config1
13+
cachefile @srcdir@/test.auto_bridge
14+
enet-vlan add
15+
enet-vlan-tag 45
16+
enet-vlan-cfi 1
17+
enet-vlan-pri 5
18+
19+
[TCPPREP]
20+
pcap @srcdir@/test.pcap
21+
auto bridge
22+
minmask 31
23+
maxmask 16
24+
nonip
25+
comment "This file was generated via the config file"
26+

0 commit comments

Comments
 (0)