Skip to content

Commit 1aaaa0a

Browse files
committed
2 parents e2bd10b + 03a50d7 commit 1aaaa0a

21 files changed

Lines changed: 4865 additions & 0 deletions

File tree

Examples/Makefile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
CC=gcc
2+
CFLAGS=-O2 -Wall
3+
4+
# 为datalink程序定义选项
5+
opt1=--port=10001 --utopia
6+
opt2=--port=10002
7+
opt3=--port=10003 --flood --utopia
8+
opt4=--port=10004 --flood
9+
opt5=--port=10005 --flood --ber=1e-4
10+
11+
TEST_TIME=300
12+
13+
# 定义编译目标
14+
build: build_selective build_stopwait build_gobackn
15+
16+
build_selective: clean
17+
$(CC) $(CFLAGS) -c selective
18+
$(CC) $(CFLAGS) -c ../protocol.c
19+
$(CC) $(CFLAGS) -c ../lprintf.c
20+
$(CC) $(CFLAGS) -c ../crc32.c
21+
$(CC) selective.o protocol.o lprintf.o crc32.o -o datalink -lm
22+
23+
build_stopwait: clean
24+
$(CC) $(CFLAGS) -c stopwait
25+
$(CC) $(CFLAGS) -c ../protocol.c
26+
$(CC) $(CFLAGS) -c ../lprintf.c
27+
$(CC) $(CFLAGS) -c ../crc32.c
28+
$(CC) stopwait.o protocol.o lprintf.o crc32.o -o datalink -lm
29+
30+
build_gobackn: clean
31+
$(CC) $(CFLAGS) -c gobackn
32+
$(CC) $(CFLAGS) -c ../protocol.c
33+
$(CC) $(CFLAGS) -c ../lprintf.c
34+
$(CC) $(CFLAGS) -c ../crc32.c
35+
$(CC) gobackn.o protocol.o lprintf.o crc32.o -o datalink -lm
36+
37+
# 定义测试目标
38+
test: test_selective test_stopwait test_gobackn
39+
40+
test_selective: clean
41+
mkdir -p ../Results/example/selective
42+
$(CC) $(CFLAGS) -c selective
43+
$(CC) $(CFLAGS) -c ../protocol.c
44+
$(CC) $(CFLAGS) -c ../lprintf.c
45+
$(CC) $(CFLAGS) -c ../crc32.c
46+
$(CC) selective.o protocol.o lprintf.o crc32.o -o ../Results/example/selective/datalink -lm
47+
@$(foreach i,$(shell seq 1 5),\
48+
screen -dmS $(i)_datalinkA bash -c 'cd ../Results/example/selective; timeout $(TEST_TIME) ./datalink a $(opt$(i)) --log=$(i)_a.log; exit';\
49+
screen -dmS $(i)_datalinkB bash -c 'cd ../Results/example/selective; timeout $(TEST_TIME) ./datalink b $(opt$(i)) --log=$(i)_b.log; exit';\
50+
)
51+
sleep $(TEST_TIME)
52+
${RM} *.o
53+
@$(foreach i,$(shell seq 1 5),\
54+
echo $$(tail -n 2 ../Results/example/selective/$(i)_a.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}') $$(tail -n 2 ../Results/example/selective/$(i)_b.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}');\
55+
)
56+
57+
test_stopwait: clean
58+
mkdir -p ../Results/example/stopwait
59+
$(CC) $(CFLAGS) -c stopwait
60+
$(CC) $(CFLAGS) -c ../protocol.c
61+
$(CC) $(CFLAGS) -c ../lprintf.c
62+
$(CC) $(CFLAGS) -c ../crc32.c
63+
$(CC) stopwait.o protocol.o lprintf.o crc32.o -o ../Results/example/stopwait/datalink -lm
64+
@$(foreach i,$(shell seq 1 5),\
65+
screen -dmS $(i)_datalinkA bash -c 'cd ../Results/example/stopwait; timeout $(TEST_TIME) ./datalink a $(opt$(i)) --log=$(i)_a.log; exit';\
66+
screen -dmS $(i)_datalinkB bash -c 'cd ../Results/example/stopwait; timeout $(TEST_TIME) ./datalink b $(opt$(i)) --log=$(i)_b.log; exit';\
67+
)
68+
sleep $(TEST_TIME)
69+
${RM} *.o
70+
@$(foreach i,$(shell seq 1 5),\
71+
echo $$(tail -n 2 ../Results/example/stopwait/$(i)_a.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}') $$(tail -n 2 ../Results/example/stopwait/$(i)_b.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}');\
72+
)
73+
74+
test_gobackn: clean
75+
mkdir -p ../Results/example/gobackn
76+
$(CC) $(CFLAGS) -c gobackn
77+
$(CC) $(CFLAGS) -c ../protocol.c
78+
$(CC) $(CFLAGS) -c ../lprintf.c
79+
$(CC) $(CFLAGS) -c ../crc32.c
80+
$(CC) gobackn.o protocol.o lprintf.o crc32.o -o ../Results/example/gobackn/datalink -lm
81+
@$(foreach i,$(shell seq 1 5),\
82+
screen -dmS $(i)_datalinkA bash -c 'cd ../Results/example/gobackn; timeout $(TEST_TIME) ./datalink a $(opt$(i)) --log=$(i)_a.log; exit';\
83+
screen -dmS $(i)_datalinkB bash -c 'cd ../Results/example/gobackn; timeout $(TEST_TIME) ./datalink b $(opt$(i)) --log=$(i)_b.log; exit';\
84+
)
85+
sleep $(TEST_TIME)
86+
${RM} *.o
87+
@$(foreach i,$(shell seq 1 5),\
88+
echo $$(tail -n 2 ../Results/example/gobackn/$(i)_a.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}') $$(tail -n 2 ../Results/example/gobackn/$(i)_b.log | head -n 1 | awk -F',' '{print $$3}' | awk '{print $$1}');\
89+
)
90+
91+
# 清理目标文件
92+
clean:
93+
${RM} *.o datalink

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/1_a.log

Lines changed: 413 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/1_b.log

Lines changed: 530 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/2_a.log

Lines changed: 409 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/2_b.log

Lines changed: 523 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/3_a.log

Lines changed: 530 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/3_b.log

Lines changed: 581 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/4_a.log

Lines changed: 523 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/4_b.log

Lines changed: 523 additions & 0 deletions
Large diffs are not rendered by default.

Results/gobackn/TEST_4BITS_2500DATA_300ACK_1200S/5_a.log

Lines changed: 347 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)