mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-05-21 06:17:39 +00:00
Debug event processing
This commit is contained in:
parent
be6d819080
commit
1bef51d878
18 changed files with 292 additions and 101 deletions
|
@ -10,6 +10,7 @@ wai=$(dirname $(readlink -f "$0")) # Current script directory
|
|||
tests=$(find ${wai}/ -maxdepth 1 -mindepth 1 -type d) # Find tests
|
||||
out=$(mktemp)
|
||||
test_timeout=20
|
||||
abort=1
|
||||
|
||||
for test in ${tests}
|
||||
do
|
||||
|
@ -38,7 +39,7 @@ do
|
|||
echo "------------- Got -------------"
|
||||
cat "$out";
|
||||
rm "$out"
|
||||
exit 1
|
||||
[ $abort -eq 1 ] && exit 1
|
||||
fi
|
||||
|
||||
# Prepare for next test
|
||||
|
|
5
tests/simple_receivet0_eth0_1s1r/out
Normal file
5
tests/simple_receivet0_eth0_1s1r/out
Normal file
|
@ -0,0 +1,5 @@
|
|||
[t=0.000,src=n0] Send 1 bytes to n1 on eth0
|
||||
[t=0.000,src=n1] Receive failed code=-1
|
||||
[t=1.000,src=n1] Receive 1 bytes on eth0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=esds] Simulation ends
|
14
tests/simple_receivet0_eth0_1s1r/receiver.py
Normal file
14
tests/simple_receivet0_eth0_1s1r/receiver.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def receivet(node,timeout):
|
||||
##### Simple receive
|
||||
code, data=node.receivet("eth0",timeout)
|
||||
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
|
||||
node.log(msg)
|
||||
|
||||
def execute(api):
|
||||
# Should not works
|
||||
receivet(api,0)
|
||||
api.wait(1)
|
||||
# Should works
|
||||
receivet(api,0)
|
5
tests/simple_receivet0_eth0_1s1r/sender.py
Normal file
5
tests/simple_receivet0_eth0_1s1r/sender.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def execute(api):
|
||||
api.send("eth0","Hello World!",1,1)
|
||||
|
14
tests/simple_receivet0_eth0_1s1r/simulator.py
Executable file
14
tests/simple_receivet0_eth0_1s1r/simulator.py
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Load ESDS
|
||||
import esds
|
||||
import numpy as np
|
||||
|
||||
B=np.full((2,2),8)
|
||||
L=np.full((2,2),0)
|
||||
s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L, "is_wired":False}, "eth0":{"bandwidth":B, "latency":L, "is_wired":True}})
|
||||
|
||||
s.create_node("sender")
|
||||
s.create_node("receiver")
|
||||
|
||||
s.run(debug=True)
|
43
tests/simple_receivet0_eth0_1s1r/yoctosim.debug
Normal file
43
tests/simple_receivet0_eth0_1s1r/yoctosim.debug
Normal file
|
@ -0,0 +1,43 @@
|
|||
Python version 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0]
|
||||
Simulation started at 1654802960.7880125
|
||||
Number of nodes is 2
|
||||
Manual breakpoints list: []
|
||||
Breakpoints every Nones
|
||||
-----------------------------------------------
|
||||
Started since 0.02s
|
||||
Simulated time 0.000s (or more precisely 0s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[0 1.0 array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 0], dtype=object)
|
||||
1]
|
||||
[1 2 array(1, dtype=object) 3]]
|
||||
-----------------------------------------------
|
||||
Started since 0.04s
|
||||
Simulated time 1.000s (or more precisely 1.0s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[1 1.5 array(1, dtype=object) 3]
|
||||
[0 2.0
|
||||
array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 1.0], dtype=object) 1]]
|
||||
-----------------------------------------------
|
||||
Started since 0.06s
|
||||
Simulated time 1.500s (or more precisely 1.5s)
|
||||
Node number per state: pending=1 request=1
|
||||
Node sharing: n1=1
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[[0 2.0
|
||||
array([0, 1, 'eth0', 'Hello World!', 1, 1.0, 1, 1.0], dtype=object) 1]
|
||||
[1 2.0 array(1, dtype=object) 3]]
|
||||
-----------------------------------------------
|
||||
Started since 0.08s
|
||||
Simulated time 2.000s (or more precisely 2.0s)
|
||||
Node number per state: terminated=2
|
||||
Node sharing:
|
||||
Ids of node in timeout mode:
|
||||
Sorted events list:
|
||||
[]
|
16
tests/simple_send0_eth0_1s1r/out
Normal file
16
tests/simple_send0_eth0_1s1r/out
Normal file
|
@ -0,0 +1,16 @@
|
|||
[t=0.000,src=n0] Send 0 bytes to n1 on eth0
|
||||
[t=0.000,src=n1] Receive 0 bytes on eth0
|
||||
[t=0.000,src=n1] Received: Hello World!
|
||||
[t=0.000,src=n0] Send 0 bytes to n1 on eth0
|
||||
[t=0.000,src=n1] Receive 0 bytes on eth0
|
||||
[t=0.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n0] Send 0 bytes to n1 on eth0
|
||||
[t=1.000,src=n1] Receive 0 bytes on eth0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=3.000,src=n0] Send 0 bytes to n1 on eth0
|
||||
[t=3.000,src=n1] Receive 0 bytes on eth0
|
||||
[t=3.000,src=n1] Received: Hello World!
|
||||
[t=3.000,src=n0] Send 0 bytes to n1 on eth0
|
||||
[t=3.000,src=n1] Receive 0 bytes on eth0
|
||||
[t=3.000,src=n1] Received: Hello World!
|
||||
[t=3.000,src=esds] Simulation ends
|
23
tests/simple_send0_eth0_1s1r/receiver.py
Normal file
23
tests/simple_send0_eth0_1s1r/receiver.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def receive(api):
|
||||
##### Simple receive
|
||||
code, data=api.receive("eth0")
|
||||
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
|
||||
api.log(msg)
|
||||
|
||||
def execute(api):
|
||||
receive(api)
|
||||
# Simulated time t=0s here
|
||||
receive(api)
|
||||
# Simulated time t=0s here
|
||||
receive(api)
|
||||
# Simulated time t=1s here
|
||||
receive(api)
|
||||
# Simulated time t=3s here
|
||||
code, data=api.receivet("eth0",0)
|
||||
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
|
||||
api.log(msg)
|
||||
# Simulated time t=3s here
|
||||
|
||||
|
12
tests/simple_send0_eth0_1s1r/sender.py
Normal file
12
tests/simple_send0_eth0_1s1r/sender.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
def execute(api):
|
||||
api.send("eth0","Hello World!",0,1)
|
||||
api.wait(0)
|
||||
api.send("eth0","Hello World!",0,1)
|
||||
api.wait(1)
|
||||
api.send("eth0","Hello World!",0,1)
|
||||
api.wait(1)
|
||||
api.wait(1)
|
||||
api.send("eth0","Hello World!",0,1)
|
||||
api.send("eth0","Hello World!",0,1)
|
14
tests/simple_send0_eth0_1s1r/simulator.py
Executable file
14
tests/simple_send0_eth0_1s1r/simulator.py
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Load ESDS
|
||||
import esds
|
||||
import numpy as np
|
||||
|
||||
B=np.full((2,2),8)
|
||||
L=np.full((2,2),0)
|
||||
s=esds.Simulator({"wlan0":{"bandwidth":B, "latency":L, "is_wired":False}, "eth0":{"bandwidth":B, "latency":L, "is_wired":True}})
|
||||
|
||||
s.create_node("sender")
|
||||
s.create_node("receiver")
|
||||
|
||||
s.run(debug=True)
|
|
@ -1,7 +1,7 @@
|
|||
[t=0.000,src=n0] Send 1 bytes to n2 on eth0
|
||||
[t=0.000,src=n1] Send 1 bytes to n2 on eth0
|
||||
[t=2.000,src=n2] Receive 1 bytes on eth0
|
||||
[t=2.000,src=n2] Received: Hello World from 0!
|
||||
[t=2.000,src=n2] Receive 1 bytes on eth0
|
||||
[t=2.000,src=n2] Received: Hello World from 0!
|
||||
[t=2.000,src=n2] Received: Hello World from 1!
|
||||
[t=2.000,src=esds] Simulation ends
|
||||
|
|
|
@ -2,32 +2,32 @@
|
|||
[t=0.000,src=n1] Send 1 bytes to n3 on eth0
|
||||
[t=0.000,src=n2] Send 1 bytes to n3 on eth0
|
||||
[t=3.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=3.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=3.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=3.000,src=n3] Received: Hello World from 0!
|
||||
[t=3.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=3.000,src=n3] Received: Hello World from 1!
|
||||
[t=3.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=3.000,src=n3] Received: Hello World from 2!
|
||||
[t=3.000,src=n0] Send 2 bytes to n3 on eth0
|
||||
[t=3.000,src=n1] Send 1 bytes to n3 on eth0
|
||||
[t=3.000,src=n2] Send 1 bytes to n3 on eth0
|
||||
[t=3.000,src=n3] Received: Hello World from 1!
|
||||
[t=3.000,src=n3] Received: Hello World from 2!
|
||||
[t=6.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=6.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=6.000,src=n3] Received: Hello World from 1!
|
||||
[t=6.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=6.000,src=n3] Received: Hello World from 2!
|
||||
[t=7.000,src=n3] Receive 2 bytes on eth0
|
||||
[t=7.000,src=n3] Received: Hello World from 0!
|
||||
[t=7.000,src=n3] Received: Hello World (2bytes) from 0!
|
||||
[t=7.000,src=n0] Send 2 bytes to n3 on eth0
|
||||
[t=7.000,src=n1] Send 2 bytes to n3 on eth0
|
||||
[t=7.000,src=n2] Send 1 bytes to n3 on eth0
|
||||
[t=10.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=10.000,src=n3] Received: Hello World from 2!
|
||||
[t=12.000,src=n3] Receive 2 bytes on eth0
|
||||
[t=12.000,src=n3] Received: Hello World from 0!
|
||||
[t=12.000,src=n3] Receive 2 bytes on eth0
|
||||
[t=12.000,src=n3] Received: Hello World from 1!
|
||||
[t=12.000,src=n3] Received: Hello World (2bytes) from 0!
|
||||
[t=12.000,src=n0] Send 1 bytes to n3 on eth0
|
||||
[t=12.000,src=n1] Send 2 bytes to n3 on eth0
|
||||
[t=12.000,src=n2] Send 3 bytes to n3 on eth0
|
||||
[t=12.000,src=n3] Received: Hello World (2bytes) from 1!
|
||||
[t=15.000,src=n3] Receive 1 bytes on eth0
|
||||
[t=15.000,src=n3] Received: Hello World from 0!
|
||||
[t=17.000,src=n3] Receive 2 bytes on eth0
|
||||
|
|
|
@ -8,14 +8,14 @@ def execute(api):
|
|||
|
||||
# These send should start at 3s and be completed at 7s
|
||||
if api.node_id==0:
|
||||
api.send("eth0","Hello World from {}!".format(api.node_id),2,3) # Should lasts 3s + 1s = 4s
|
||||
api.send("eth0","Hello World (2bytes) from {}!".format(api.node_id),2,3) # Should lasts 3s + 1s = 4s
|
||||
else:
|
||||
api.send("eth0","Hello World from {}!".format(api.node_id),1,3) # Should lasts 3s
|
||||
api.wait(1) # Sync with node 0 at 7s
|
||||
|
||||
# Those sends should start at 7s and be completed at 12s
|
||||
if api.node_id<=1:
|
||||
api.send("eth0","Hello World from {}!".format(api.node_id),2,3) # Should last 3s + 2s = 5s
|
||||
api.send("eth0","Hello World (2bytes) from {}!".format(api.node_id),2,3) # Should last 3s + 2s = 5s
|
||||
# Completed at 12s since 3 nodes are sharing the bandwidth up to 10s
|
||||
# then the 2 two remaining node send their last byte up to 12s
|
||||
else:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[t=0.000,src=n0] Send 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Receive 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n2] Receive 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n2] Received: Hello World!
|
||||
[t=1.000,src=n2] Turned off
|
||||
[t=1.000,src=n0] Send 1 bytes on wlan0
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[t=0.000,src=n0] Send 1 bytes to n1 on eth0
|
||||
[t=1.000,src=n1] Receive 1 bytes on eth0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n0] Send worked!
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n0] Send 1 bytes to n1 on eth0
|
||||
[t=1.500,src=n0] Send failed
|
||||
[t=1.500,src=n0] Send 1 bytes to n1 on eth0
|
||||
[t=2.500,src=n1] Receive 1 bytes on eth0
|
||||
[t=2.500,src=n1] Received: Hello World!
|
||||
[t=2.500,src=n0] Send worked!
|
||||
[t=2.500,src=n1] Received: Hello World!
|
||||
[t=2.500,src=esds] Simulation ends
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[t=0.000,src=n0] Send 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Receive 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n2] Receive 1 bytes on wlan0
|
||||
[t=1.000,src=n1] Received: Hello World!
|
||||
[t=1.000,src=n2] Received: Hello World!
|
||||
[t=1.000,src=n0] Send 1 bytes on wlan0
|
||||
[t=1.500,src=esds] Simulation ends
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue