mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-06 10:06:28 +02:00
Debug and improve tests
This commit is contained in:
parent
b3cbb52f00
commit
17bfda379b
25 changed files with 376 additions and 21 deletions
|
@ -177,9 +177,7 @@ class YAMLPlatformFile:
|
||||||
self.parsing_error("breakpoints should be a list of number")
|
self.parsing_error("breakpoints should be a list of number")
|
||||||
self.default["breakpoints"]=general["breakpoints"]
|
self.default["breakpoints"]=general["breakpoints"]
|
||||||
if "breakpoints_every" in general:
|
if "breakpoints_every" in general:
|
||||||
if not str(general["breakpoints_every"]).isnumeric():
|
self.default["breakpoints_every"]=float(general["breakpoints_every"])
|
||||||
self.parsing_error("breakpoints_every should be a number")
|
|
||||||
self.default["breakpoints_every"]=general["breakpoints_every"]
|
|
||||||
if "breakpoints_callback" in general:
|
if "breakpoints_callback" in general:
|
||||||
cb=general["breakpoints_callback"]
|
cb=general["breakpoints_callback"]
|
||||||
file=cb["file"]
|
file=cb["file"]
|
||||||
|
|
16
tests/api_read_clock_2n/platform.yaml
Normal file
16
tests/api_read_clock_2n/platform.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2Bps 0s all
|
20
tests/api_read_eth0_ncom_2s1r/platform.yaml
Normal file
20
tests/api_read_eth0_ncom_2s1r/platform.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
general:
|
||||||
|
interferences: no
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0-1 sender.py
|
||||||
|
- 2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 3bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 3bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 3bps 0s all
|
20
tests/api_read_order_ncom_1s2r/platform.yaml
Normal file
20
tests/api_read_order_ncom_1s2r/platform.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
general:
|
||||||
|
interferences: no
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0,2 receiver.py
|
||||||
|
- 1 sender.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
20
tests/api_read_wlan0_ncom_2s1r/platform.yaml
Normal file
20
tests/api_read_wlan0_ncom_2s1r/platform.yaml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
general:
|
||||||
|
interferences: no
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0,1 sender.py
|
||||||
|
- 2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 3bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 3bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 3bps 0s all
|
17
tests/api_receivet0_eth0_1s1r/platform.yaml
Normal file
17
tests/api_receivet0_eth0_1s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_receivet_eth0_1s1r/platform.yaml
Normal file
17
tests/api_receivet_eth0_1s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_send0_eth0_1s1r/platform.yaml
Normal file
17
tests/api_send0_eth0_1s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
28
tests/api_send_4interfaces_1s2r/platform.yaml
Normal file
28
tests/api_send_4interfaces_1s2r/platform.yaml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1,2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
- 0 0bps 0s 2 # Sender cannot reach n2 on wlan0
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
wlan1:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all # Sender can reach n1 AND n2 on wlan1
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
eth1:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2Bps 0s all # On eth1 sender can reach receiver twice faster than eth0
|
17
tests/api_send_eth0_1s1r/platform.yaml
Normal file
17
tests/api_send_eth0_1s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_send_eth0_2s1r/platform.yaml
Normal file
17
tests/api_send_eth0_2s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0,1 sender.py
|
||||||
|
- 2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_send_wlan0_1s2r/platform.yaml
Normal file
17
tests/api_send_wlan0_1s2r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1,2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_send_wlan0_2s1r/platform.yaml
Normal file
17
tests/api_send_wlan0_2s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0,1 sender.py
|
||||||
|
- 2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_sendt_eth0_1s1r/platform.yaml
Normal file
17
tests/api_sendt_eth0_1s1r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
17
tests/api_sendt_wlan0_1s2r/platform.yaml
Normal file
17
tests/api_sendt_wlan0_1s2r/platform.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0 sender.py
|
||||||
|
- 1,2 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
16
tests/api_wait_2n/platform.yaml
Normal file
16
tests/api_wait_2n/platform.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
16
tests/api_wait_end_3n/platform.yaml
Normal file
16
tests/api_wait_end_3n/platform.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
4
tests/breakpoints_auto_1n/callback.py
Executable file
4
tests/breakpoints_auto_1n/callback.py
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def callback(simulator):
|
||||||
|
simulator.log("Hello Callback!")
|
22
tests/breakpoints_auto_1n/platform.yaml
Normal file
22
tests/breakpoints_auto_1n/platform.yaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
general:
|
||||||
|
breakpoints_every: 3.3
|
||||||
|
breakpoints_callback:
|
||||||
|
file: "callback.py"
|
||||||
|
callback: "callback"
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Load ESDS
|
|
||||||
import esds
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
n=2
|
|
||||||
B=np.full((2,2),n)
|
|
||||||
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("node")
|
|
||||||
s.create_node("node")
|
|
||||||
|
|
||||||
def callback(simulator):
|
|
||||||
simulator.log("Hello Callback!")
|
|
||||||
|
|
||||||
s.run(breakpoints_every=3.3,breakpoint_callback=callback)
|
|
4
tests/breakpoints_manual_1n/callback.py
Executable file
4
tests/breakpoints_manual_1n/callback.py
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def callback(simulator):
|
||||||
|
simulator.log("Hello Callback!")
|
22
tests/breakpoints_manual_1n/platform.yaml
Normal file
22
tests/breakpoints_manual_1n/platform.yaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
general:
|
||||||
|
breakpoints: [1,2,3,10]
|
||||||
|
breakpoints_callback:
|
||||||
|
file: "callback.py"
|
||||||
|
callback: "callback"
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
19
tests/breakpoints_manual_no_callback_1n/platform.yaml
Normal file
19
tests/breakpoints_manual_no_callback_1n/platform.yaml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
general:
|
||||||
|
breakpoints: [1,2,3,10]
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
count: 2
|
||||||
|
implementations:
|
||||||
|
- all node.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
||||||
|
txperfs:
|
||||||
|
- all 2bps 0s
|
||||||
|
eth0:
|
||||||
|
type: "wired"
|
||||||
|
links:
|
||||||
|
- all 2bps 0s all
|
14
tests/hidden_node_2s1r/platform.yaml
Normal file
14
tests/hidden_node_2s1r/platform.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
nodes:
|
||||||
|
count: 3
|
||||||
|
implementations:
|
||||||
|
- 0,2 sender.py
|
||||||
|
- 1 receiver.py
|
||||||
|
|
||||||
|
interfaces:
|
||||||
|
wlan0:
|
||||||
|
type: "wireless"
|
||||||
|
links:
|
||||||
|
- all 1Bps 0s all
|
||||||
|
- 0,2 0bps 0s 2,0 # Node 0 and 2 are out of range
|
||||||
|
txperfs:
|
||||||
|
- all 1Bps 0s
|
|
@ -13,6 +13,7 @@ do
|
||||||
cd $test
|
cd $test
|
||||||
testcmd="${pythonexec} simulator.py"
|
testcmd="${pythonexec} simulator.py"
|
||||||
[ -e "platform.yaml" ] && testcmd="esds run platform.yaml"
|
[ -e "platform.yaml" ] && testcmd="esds run platform.yaml"
|
||||||
|
echo $testcmd
|
||||||
timeout $test_timeout ${testcmd} &> "$out"
|
timeout $test_timeout ${testcmd} &> "$out"
|
||||||
|
|
||||||
# Ensure timeout
|
# Ensure timeout
|
||||||
|
|
Loading…
Add table
Reference in a new issue