summaryrefslogtreecommitdiff
path: root/tests/api_send_eth0_1s1r
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-07-01 10:03:54 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-07-01 10:03:54 +0200
commit1eee1ac81a0ef7f86c7acc2d431b0ac084aebf14 (patch)
tree7c96d65453044eaf4edb1db551181b79cfeaae71 /tests/api_send_eth0_1s1r
parent48ca1f43f20518949bacd86a59c6cbc38e4a7408 (diff)
Change API. Indeed, currently wired communications
are aborted when receiver node turned off. This may not be desire when implementing UDP communications. Now user can use a boolean when using send()/sendt() to change this behavior.
Diffstat (limited to 'tests/api_send_eth0_1s1r')
-rw-r--r--tests/api_send_eth0_1s1r/out6
-rw-r--r--tests/api_send_eth0_1s1r/receiver.py8
-rw-r--r--tests/api_send_eth0_1s1r/sender.py1
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/api_send_eth0_1s1r/out b/tests/api_send_eth0_1s1r/out
index 1634d95..d331337 100644
--- a/tests/api_send_eth0_1s1r/out
+++ b/tests/api_send_eth0_1s1r/out
@@ -7,5 +7,9 @@
[t=3.000,src=n1] Received: Hello World!
[t=3.000,src=n1] Turned off
[t=4.000,src=n1] Turned on
+[t=4.000,src=n0] Send 10 bytes to n1 on eth0
[t=5.000,src=n1] Receive failed code=-1
-[t=5.000,src=esds] Simulation ends
+[t=5.000,src=n1] Turned off
+[t=6.000,src=n1] Turned on
+[t=7.000,src=n1] Receive failed code=-1
+[t=14.000,src=esds] Simulation ends
diff --git a/tests/api_send_eth0_1s1r/receiver.py b/tests/api_send_eth0_1s1r/receiver.py
index 96305bf..364c24c 100644
--- a/tests/api_send_eth0_1s1r/receiver.py
+++ b/tests/api_send_eth0_1s1r/receiver.py
@@ -17,4 +17,10 @@ def execute(api):
code, data=api.receivet("eth0",1)
msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
api.log(msg)
-
+ ##### Ensure data is not receive turned off but communication is not cancel
+ api.turn_off()
+ api.wait(1)
+ api.turn_on()
+ code, data=api.receivet("eth0",1)
+ msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
+ api.log(msg)
diff --git a/tests/api_send_eth0_1s1r/sender.py b/tests/api_send_eth0_1s1r/sender.py
index 9f4aa85..a01b371 100644
--- a/tests/api_send_eth0_1s1r/sender.py
+++ b/tests/api_send_eth0_1s1r/sender.py
@@ -5,3 +5,4 @@ def execute(api):
api.send("eth0","Hello World!",1,1)
api.wait(1) # Goto 3 seconds
api.send("eth0","Hello World!",1,1)
+ api.send("eth0","Hello World!",10,1,False) # Now communication should not be aborted even if receiver turned_off (e.g UDP)