summaryrefslogtreecommitdiff
path: root/maximus/python
diff options
context:
space:
mode:
authorburet2007-12-05 16:19:03 +0000
committerburet2007-12-05 16:19:03 +0000
commit02153b01c5d6154e6303d0ab0c9ffdc6a89b4270 (patch)
treebcb1d598289a5e6232f1b64c3f1bdece95d22725 /maximus/python
parent5aabda483b46f3c8bc6cdb18ec97e41fb2713b22 (diff)
Maximus V2: closes #51.
- Create a test bash - Correction in PHY SCI message reception git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1099 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'maximus/python')
-rw-r--r--maximus/python/py/test_cb.py3
-rw-r--r--maximus/python/test/test_channel.py4
-rw-r--r--maximus/python/test/test_ethernet.py17
-rw-r--r--maximus/python/test/test_interface.py4
-rw-r--r--maximus/python/test/test_macframe.py4
-rw-r--r--maximus/python/test/test_maximus.py3
-rw-r--r--maximus/python/test/test_mme.py4
-rw-r--r--maximus/python/test/test_simu.py4
8 files changed, 29 insertions, 14 deletions
diff --git a/maximus/python/py/test_cb.py b/maximus/python/py/test_cb.py
index fe793df2e6..9ca826057d 100644
--- a/maximus/python/py/test_cb.py
+++ b/maximus/python/py/test_cb.py
@@ -14,8 +14,7 @@ from interface import *
# Instantiate a Maximus object and initialize it.
maximus = Maximus()
-argv = ['test_cb.py', '-e', '../../stationtest/obj/test_cb.elf', '-l', '0']
-maximus.init(argv)
+maximus.init(sys.argv)
# Create three stations.
sta = maximus.create_sta()
diff --git a/maximus/python/test/test_channel.py b/maximus/python/test/test_channel.py
index 6d41445f57..fd8d54cde2 100644
--- a/maximus/python/test/test_channel.py
+++ b/maximus/python/test/test_channel.py
@@ -2,6 +2,7 @@
print __name__
+import sys
import startup
from maximus.channel import *
@@ -15,8 +16,7 @@ from interface import *
m = Maximus()
# Initialize Maximus with command line arguments
-argv = ['test_channel.py', '-e', '/home/buret/workspace/maximus/maximus/stationtest/obj/stationtest.elf']
-m.init(argv)
+m.init(sys.argv)
# Enable channel perturbation
m.disturb_channel()
diff --git a/maximus/python/test/test_ethernet.py b/maximus/python/test/test_ethernet.py
index eec026ae66..c653d7b660 100644
--- a/maximus/python/test/test_ethernet.py
+++ b/maximus/python/test/test_ethernet.py
@@ -5,6 +5,7 @@ print __name__
import startup
from maximus.ethernet import *
+from maximus.utils.exception import *
from scapy import *
@@ -22,6 +23,22 @@ e.send()
# Receive an Ethernet frame
e.recv()
+# Create an Ethernet frame using scapy
+f = Ether()
+f.dst = '41:42:43:44:45:46'
+f.src = '47:48:49:4A:4B:4C'
+f.type = 0x5152
+s = 'This is the Ethernet Payload'
+f.payload = s
+print str(f)
+if str(f) != 'ABCDEFGHIJKLQRThis is the Ethernet Payload':
+ raise Error('Ethernet frame')
+if len(f) != 14 + len(s):
+ raise Error('Ethernet frame')
+
+d = Dot1Q(vlan=0x4D4E4F50)/f
+print str(d)
+
# SCAPY TEST
diff --git a/maximus/python/test/test_interface.py b/maximus/python/test/test_interface.py
index 427a2371f0..afd59b6c41 100644
--- a/maximus/python/test/test_interface.py
+++ b/maximus/python/test/test_interface.py
@@ -2,6 +2,7 @@
print __name__
+import sys
import startup
import interface
@@ -24,8 +25,7 @@ import unittest
m = Maximus()
# Initialize Maximus with command line arguments
-argv = ['test_interface.py', '-e', '/home/buret/workspace/maximus/maximus/stationtest/obj/stationtest.elf', '-l', '0']
-m.init(argv)
+m.init(sys.argv)
def cb1(msg):
print "=>",cb1.func_name
diff --git a/maximus/python/test/test_macframe.py b/maximus/python/test/test_macframe.py
index be3897ea46..249f8b725a 100644
--- a/maximus/python/test/test_macframe.py
+++ b/maximus/python/test/test_macframe.py
@@ -2,6 +2,7 @@
print __name__
+import sys
import startup
from maximus.macframe import *
@@ -16,8 +17,7 @@ from struct import *
m = Maximus()
# Initialize Maximus with command line arguments
-argv = ['test_macframe.py', '-e', '/home/buret/workspace/maximus/maximus/stationtest/obj/stationtest.elf', '-l', '0']
-m.init(argv)
+m.init(sys.argv)
def prepare_rx(s):
m.create_fcall('prepare_rx').send(s)
diff --git a/maximus/python/test/test_maximus.py b/maximus/python/test/test_maximus.py
index a5a59e11ff..946e0e7929 100644
--- a/maximus/python/test/test_maximus.py
+++ b/maximus/python/test/test_maximus.py
@@ -9,7 +9,6 @@ print
print "MAXIMUS TEST"
import test_channel
import test_cli
-#import test_ethernet
import test_fsm
import test_interface
import test_macframe
@@ -35,7 +34,7 @@ doctest.testfile("test.txt")
print
print "UNIT TEST"
import unittest
-allTests = unittest.TestSuite([test_channel.suite, test_cli.suite, test_ethernet.suite, test_fsm.suite, test_interface.suite, test_macframe.suite, test_mme.suite, test_result.suite, test_simu.suite, test_station.suite, test_utils.suite])
+allTests = unittest.TestSuite([test_channel.suite, test_cli.suite, test_fsm.suite, test_interface.suite, test_macframe.suite, test_mme.suite, test_result.suite, test_simu.suite, test_station.suite, test_utils.suite])
testResult = unittest.TextTestRunner(verbosity=2).run(allTests)
diff --git a/maximus/python/test/test_mme.py b/maximus/python/test/test_mme.py
index c0db5e5cfd..449e70adaa 100644
--- a/maximus/python/test/test_mme.py
+++ b/maximus/python/test/test_mme.py
@@ -2,6 +2,7 @@
print __name__
+import sys
import startup
from maximus.mme import *
@@ -12,8 +13,7 @@ from struct import *
m = Maximus()
# Initialize Maximus with command line arguments
-argv = ['test_mme.py', '-e', '/home/buret/workspace/maximus/maximus/stationtest/obj/stationtest.elf']
-m.init(argv)
+m.init(sys.argv)
# MME TEST
diff --git a/maximus/python/test/test_simu.py b/maximus/python/test/test_simu.py
index 50cfe3551a..1114e6af0e 100644
--- a/maximus/python/test/test_simu.py
+++ b/maximus/python/test/test_simu.py
@@ -2,6 +2,7 @@
print __name__
+import sys
import startup
from maximus.simu import *
@@ -14,8 +15,7 @@ from interface import *
m = Maximus()
# Initialize Maximus with command line arguments
-argv = ['test_simu.py', '-e', '/home/buret/workspace/maximus/maximus/stationtest/obj/stationtest.elf', '-l', '0']
-m.init(argv)
+m.init(sys.argv)
# Transmission
rsp = send.sendnrecv(file='data', timeout=5000)