diff options
Diffstat (limited to 'tests/simple_read_eth0_ncom_2s1r')
| -rw-r--r-- | tests/simple_read_eth0_ncom_2s1r/out | 9 | ||||
| -rw-r--r-- | tests/simple_read_eth0_ncom_2s1r/receiver.py | 12 | ||||
| -rw-r--r-- | tests/simple_read_eth0_ncom_2s1r/sender.py | 9 | ||||
| -rwxr-xr-x | tests/simple_read_eth0_ncom_2s1r/simulator.py | 17 |
4 files changed, 47 insertions, 0 deletions
diff --git a/tests/simple_read_eth0_ncom_2s1r/out b/tests/simple_read_eth0_ncom_2s1r/out new file mode 100644 index 0000000..087e62b --- /dev/null +++ b/tests/simple_read_eth0_ncom_2s1r/out @@ -0,0 +1,9 @@ +[t=0.000,src=n2] eth0 is 0 +[t=624.000,src=n2] eth0 is 0 +[t=1248.000,src=n0] Send 50 bytes to n2 on eth0 +[t=1249.000,src=n2] eth0 is 1 +[t=1249.000,src=n1] Send 50 bytes to n2 on eth0 +[t=1250.000,src=n2] eth0 is 2 +[t=1513.667,src=n2] Receive 50 bytes on eth0 +[t=1514.667,src=n2] Receive 50 bytes on eth0 +[t=1514.667,src=esds] Simulation ends diff --git a/tests/simple_read_eth0_ncom_2s1r/receiver.py b/tests/simple_read_eth0_ncom_2s1r/receiver.py new file mode 100644 index 0000000..819fc84 --- /dev/null +++ b/tests/simple_read_eth0_ncom_2s1r/receiver.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +def execute(api): + api.log("eth0 is {}".format(api.read("eth0_ncom"))) + api.wait(624) + api.log("eth0 is {}".format(api.read("eth0_ncom"))) + api.wait(624) + # Now we are at 624*2=1248 (first sender start a communication) + api.wait(1) # Let the communication starts + api.log("eth0 is {}".format(api.read("eth0_ncom"))) # Should print 1 + api.wait(1) # Now second sender start a communication + api.log("eth0 is {}".format(api.read("eth0_ncom"))) # Should print 2 diff --git a/tests/simple_read_eth0_ncom_2s1r/sender.py b/tests/simple_read_eth0_ncom_2s1r/sender.py new file mode 100644 index 0000000..7c9259a --- /dev/null +++ b/tests/simple_read_eth0_ncom_2s1r/sender.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +def execute(api): + api.wait(1248) + if api.node_id==0: + api.send("eth0","hello",50,2) + else: + api.wait(1) + api.send("eth0","hello",50,2) diff --git a/tests/simple_read_eth0_ncom_2s1r/simulator.py b/tests/simple_read_eth0_ncom_2s1r/simulator.py new file mode 100755 index 0000000..5294b9d --- /dev/null +++ b/tests/simple_read_eth0_ncom_2s1r/simulator.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# Load ESDS +import sys +sys.path.append("../../") +import esds +import numpy as np + +B=np.full((3,3),3) +L=np.full((3,3),0) +s=esds.Simulator(B,L) + +s.create_node("sender") +s.create_node("sender") +s.create_node("receiver") + +s.run(interferences=False) |
