summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-09-13 14:38:30 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-09-13 14:38:30 +0200
commit17bfda379be17acb20abfb7f0c9231d36ef8766d (patch)
treef263d1b37e223278e4b929460c7f4dc7798493ef
parentb3cbb52f00e000277c3c74e1e9eab230d8b2d843 (diff)
Debug and improve tests
-rw-r--r--esds/platform.py4
-rw-r--r--tests/api_read_clock_2n/platform.yaml16
-rw-r--r--tests/api_read_eth0_ncom_2s1r/platform.yaml20
-rw-r--r--tests/api_read_order_ncom_1s2r/platform.yaml20
-rw-r--r--tests/api_read_wlan0_ncom_2s1r/platform.yaml20
-rw-r--r--tests/api_receivet0_eth0_1s1r/platform.yaml17
-rw-r--r--tests/api_receivet_eth0_1s1r/platform.yaml17
-rw-r--r--tests/api_send0_eth0_1s1r/platform.yaml17
-rw-r--r--tests/api_send_4interfaces_1s2r/platform.yaml28
-rw-r--r--tests/api_send_eth0_1s1r/platform.yaml17
-rw-r--r--tests/api_send_eth0_2s1r/platform.yaml17
-rw-r--r--tests/api_send_wlan0_1s2r/platform.yaml17
-rw-r--r--tests/api_send_wlan0_2s1r/platform.yaml17
-rw-r--r--tests/api_sendt_eth0_1s1r/platform.yaml17
-rw-r--r--tests/api_sendt_wlan0_1s2r/platform.yaml17
-rw-r--r--tests/api_wait_2n/platform.yaml16
-rw-r--r--tests/api_wait_end_3n/platform.yaml16
-rwxr-xr-xtests/breakpoints_auto_1n/callback.py4
-rw-r--r--tests/breakpoints_auto_1n/platform.yaml22
-rwxr-xr-xtests/breakpoints_auto_1n/simulator.py18
-rwxr-xr-xtests/breakpoints_manual_1n/callback.py4
-rw-r--r--tests/breakpoints_manual_1n/platform.yaml22
-rw-r--r--tests/breakpoints_manual_no_callback_1n/platform.yaml19
-rw-r--r--tests/hidden_node_2s1r/platform.yaml14
-rwxr-xr-xtests/run.sh1
25 files changed, 376 insertions, 21 deletions
diff --git a/esds/platform.py b/esds/platform.py
index 873546f..98adf08 100644
--- a/esds/platform.py
+++ b/esds/platform.py
@@ -177,9 +177,7 @@ class YAMLPlatformFile:
self.parsing_error("breakpoints should be a list of number")
self.default["breakpoints"]=general["breakpoints"]
if "breakpoints_every" in general:
- if not str(general["breakpoints_every"]).isnumeric():
- self.parsing_error("breakpoints_every should be a number")
- self.default["breakpoints_every"]=general["breakpoints_every"]
+ self.default["breakpoints_every"]=float(general["breakpoints_every"])
if "breakpoints_callback" in general:
cb=general["breakpoints_callback"]
file=cb["file"]
diff --git a/tests/api_read_clock_2n/platform.yaml b/tests/api_read_clock_2n/platform.yaml
new file mode 100644
index 0000000..f4493b1
--- /dev/null
+++ b/tests/api_read_clock_2n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_read_eth0_ncom_2s1r/platform.yaml b/tests/api_read_eth0_ncom_2s1r/platform.yaml
new file mode 100644
index 0000000..b37d814
--- /dev/null
+++ b/tests/api_read_eth0_ncom_2s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_read_order_ncom_1s2r/platform.yaml b/tests/api_read_order_ncom_1s2r/platform.yaml
new file mode 100644
index 0000000..5371cd9
--- /dev/null
+++ b/tests/api_read_order_ncom_1s2r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_read_wlan0_ncom_2s1r/platform.yaml b/tests/api_read_wlan0_ncom_2s1r/platform.yaml
new file mode 100644
index 0000000..f80f8e7
--- /dev/null
+++ b/tests/api_read_wlan0_ncom_2s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_receivet0_eth0_1s1r/platform.yaml b/tests/api_receivet0_eth0_1s1r/platform.yaml
new file mode 100644
index 0000000..d55f59e
--- /dev/null
+++ b/tests/api_receivet0_eth0_1s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_receivet_eth0_1s1r/platform.yaml b/tests/api_receivet_eth0_1s1r/platform.yaml
new file mode 100644
index 0000000..d55f59e
--- /dev/null
+++ b/tests/api_receivet_eth0_1s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_send0_eth0_1s1r/platform.yaml b/tests/api_send0_eth0_1s1r/platform.yaml
new file mode 100644
index 0000000..d55f59e
--- /dev/null
+++ b/tests/api_send0_eth0_1s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_send_4interfaces_1s2r/platform.yaml b/tests/api_send_4interfaces_1s2r/platform.yaml
new file mode 100644
index 0000000..1665f05
--- /dev/null
+++ b/tests/api_send_4interfaces_1s2r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_send_eth0_1s1r/platform.yaml b/tests/api_send_eth0_1s1r/platform.yaml
new file mode 100644
index 0000000..6089a8d
--- /dev/null
+++ b/tests/api_send_eth0_1s1r/platform.yaml
@@ -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
diff --git a/tests/api_send_eth0_2s1r/platform.yaml b/tests/api_send_eth0_2s1r/platform.yaml
new file mode 100644
index 0000000..93e2f02
--- /dev/null
+++ b/tests/api_send_eth0_2s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_send_wlan0_1s2r/platform.yaml b/tests/api_send_wlan0_1s2r/platform.yaml
new file mode 100644
index 0000000..096d56a
--- /dev/null
+++ b/tests/api_send_wlan0_1s2r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_send_wlan0_2s1r/platform.yaml b/tests/api_send_wlan0_2s1r/platform.yaml
new file mode 100644
index 0000000..93e2f02
--- /dev/null
+++ b/tests/api_send_wlan0_2s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_sendt_eth0_1s1r/platform.yaml b/tests/api_sendt_eth0_1s1r/platform.yaml
new file mode 100644
index 0000000..d55f59e
--- /dev/null
+++ b/tests/api_sendt_eth0_1s1r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_sendt_wlan0_1s2r/platform.yaml b/tests/api_sendt_wlan0_1s2r/platform.yaml
new file mode 100644
index 0000000..096d56a
--- /dev/null
+++ b/tests/api_sendt_wlan0_1s2r/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_wait_2n/platform.yaml b/tests/api_wait_2n/platform.yaml
new file mode 100644
index 0000000..b6051a8
--- /dev/null
+++ b/tests/api_wait_2n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/api_wait_end_3n/platform.yaml b/tests/api_wait_end_3n/platform.yaml
new file mode 100644
index 0000000..2a5f416
--- /dev/null
+++ b/tests/api_wait_end_3n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/breakpoints_auto_1n/callback.py b/tests/breakpoints_auto_1n/callback.py
new file mode 100755
index 0000000..5c9c6bc
--- /dev/null
+++ b/tests/breakpoints_auto_1n/callback.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+def callback(simulator):
+ simulator.log("Hello Callback!")
diff --git a/tests/breakpoints_auto_1n/platform.yaml b/tests/breakpoints_auto_1n/platform.yaml
new file mode 100644
index 0000000..e8d4750
--- /dev/null
+++ b/tests/breakpoints_auto_1n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/breakpoints_auto_1n/simulator.py b/tests/breakpoints_auto_1n/simulator.py
deleted file mode 100755
index ac24a03..0000000
--- a/tests/breakpoints_auto_1n/simulator.py
+++ /dev/null
@@ -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)
diff --git a/tests/breakpoints_manual_1n/callback.py b/tests/breakpoints_manual_1n/callback.py
new file mode 100755
index 0000000..5c9c6bc
--- /dev/null
+++ b/tests/breakpoints_manual_1n/callback.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+def callback(simulator):
+ simulator.log("Hello Callback!")
diff --git a/tests/breakpoints_manual_1n/platform.yaml b/tests/breakpoints_manual_1n/platform.yaml
new file mode 100644
index 0000000..0860963
--- /dev/null
+++ b/tests/breakpoints_manual_1n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/breakpoints_manual_no_callback_1n/platform.yaml b/tests/breakpoints_manual_no_callback_1n/platform.yaml
new file mode 100644
index 0000000..43fd100
--- /dev/null
+++ b/tests/breakpoints_manual_no_callback_1n/platform.yaml
@@ -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 \ No newline at end of file
diff --git a/tests/hidden_node_2s1r/platform.yaml b/tests/hidden_node_2s1r/platform.yaml
new file mode 100644
index 0000000..3febd8e
--- /dev/null
+++ b/tests/hidden_node_2s1r/platform.yaml
@@ -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
diff --git a/tests/run.sh b/tests/run.sh
index 676d7c7..1a98c5d 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -13,6 +13,7 @@ do
cd $test
testcmd="${pythonexec} simulator.py"
[ -e "platform.yaml" ] && testcmd="esds run platform.yaml"
+ echo $testcmd
timeout $test_timeout ${testcmd} &> "$out"
# Ensure timeout