Skip to content

Commit 77d0651

Browse files
authored
Add another regression test for issue 3100 (#3570)
Closes #3100. This is the second example simulation in that issue.
2 parents 76381d6 + b362422 commit 77d0651

File tree

4 files changed

+70
-3
lines changed

4 files changed

+70
-3
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ to sort out in the case that `stdout` and `stderr` are merged. (#3428)
5959
as the obfs4proxy pluggable transport (#3538). (#3542)
6060
* Fixed the behavior of sockets bound to the loopback interface: Shadow no longer panics in some cases where `connect` and `sendmsg` syscalls are used with a non-loopback address. (#3531)
6161
* Fixed the behaviour of an implicit bind during a `sendmsg` syscall for UDP sockets. (#3545)
62-
* Fixed a bug in `shutdown()` for TCP sockets, causing the FIN packet to be sent out of order. (#3562)
62+
* Fixed a TCP socket bug causing the FIN packet to be sent out of order. (#3562, #3570)
6363

6464
Full changelog since v3.2.0:
6565

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# regression test for https://github.com/shadow/shadow/issues/3100
2-
add_shadow_tests(BASENAME regression-3100)
1+
# regression tests for https://github.com/shadow/shadow/issues/3100
2+
add_shadow_tests(BASENAME regression-3100-a)
3+
add_shadow_tests(BASENAME regression-3100-b)

src/test/regression/3100/regression-3100.yaml renamed to src/test/regression/3100/regression-3100-a.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
general:
22
stop_time: 10 seconds
3+
# disable this explicitly since the default may change to 'true' in the future,
4+
# and if this were enabled it might mask the issue by inserting a delay between the send and the shutdown
5+
model_unblocked_syscall_latency: false
36
network:
47
graph:
58
type: 1_gbit_switch
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
general:
2+
stop_time: 60 seconds
3+
# disable this explicitly since the default may change to 'true' in the future,
4+
# and if this were enabled it might mask the issue by inserting a delay between the send and the close
5+
model_unblocked_syscall_latency: false
6+
network:
7+
graph:
8+
type: gml
9+
inline: |
10+
graph [
11+
directed 0
12+
node [
13+
id 0
14+
host_bandwidth_up "1 Mbit"
15+
host_bandwidth_down "1 Mbit"
16+
]
17+
edge [
18+
source 0
19+
target 0
20+
latency "500 ms"
21+
packet_loss 0.0
22+
]
23+
]
24+
hosts:
25+
server:
26+
network_node_id: 0
27+
processes:
28+
- path: python3
29+
args:
30+
- '-u'
31+
- '-c'
32+
- |
33+
import socket, time
34+
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
35+
server.bind(('0.0.0.0', 8080))
36+
server.listen(100)
37+
(s, _) = server.accept()
38+
server.close()
39+
print("Accepted socket")
40+
41+
# read bytes until EOF
42+
while True:
43+
n = len(s.recv(1000))
44+
if n == 0:
45+
break
46+
client:
47+
network_node_id: 0
48+
processes:
49+
- path: python3
50+
start_time: 100 ms
51+
args:
52+
- '-u'
53+
- '-c'
54+
- |
55+
import socket, time
56+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
57+
s.connect(('server', 8080))
58+
print("Connected")
59+
60+
# send some bytes and then immediately close,
61+
# which should send a FIN after the bytes
62+
s.send(b'hello')
63+
s.close()

0 commit comments

Comments
 (0)