summaryrefslogtreecommitdiff
path: root/tests/api_send_eth0_1s1r
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api_send_eth0_1s1r')
-rw-r--r--tests/api_send_eth0_1s1r/out2
-rw-r--r--tests/api_send_eth0_1s1r/receiver.py7
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/api_send_eth0_1s1r/out b/tests/api_send_eth0_1s1r/out
index 8768500..d01fb93 100644
--- a/tests/api_send_eth0_1s1r/out
+++ b/tests/api_send_eth0_1s1r/out
@@ -7,7 +7,7 @@
[t=3.000,src=n1] Received: Hello World!
[t=3.000,src=n1] Turned off
[t=4.000,src=n1] Turned on
-[t=5.000,src=n1] Receive failed code=-1
+[t=5.000,src=n1] Receive failed code=RCode.TIMEOUT_EXPIRE
[t=18.000,src=n0] End transmission
[t=18.000,src=n0] Send 15 bytes to n1 on eth0
[t=33.000,src=n1] Receive 15 bytes on eth0
diff --git a/tests/api_send_eth0_1s1r/receiver.py b/tests/api_send_eth0_1s1r/receiver.py
index ae1169c..b1332af 100644
--- a/tests/api_send_eth0_1s1r/receiver.py
+++ b/tests/api_send_eth0_1s1r/receiver.py
@@ -1,21 +1,22 @@
#!/usr/bin/env python
+from esds import RCode
def execute(api):
##### Simple receive
code, data=api.receive("eth0")
- msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
+ msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
api.log(msg)
##### Test if we still receive the data when we are not receiving
api.wait(2)
code, data=api.receive("eth0")
- msg="Received: "+data if code == 0 else "Receive failed code="+str(code)
+ msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
api.log(msg)
##### Ensure data is not receive when turned off but communication must still be ongoing
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)
+ msg="Received: "+data if code == RCode.SUCCESS else "Receive failed code="+str(code)
api.log(msg)
##### Ensure communication get aborted on turned off for the sender
api.wait(28) # Goto t=33s