summaryrefslogtreecommitdiff
path: root/cesar/test_general/station
diff options
context:
space:
mode:
authorThierry Carré2011-11-16 14:16:17 +0100
committerNélio Laranjeiro2011-11-28 17:12:44 +0100
commitd3a69adcaac64b784afc906ebdbcaaf07f4b7024 (patch)
tree8478f77b0f1c666afd19994cc67743dd939363bf /cesar/test_general/station
parent2b164dfcb0e888acdd106d79b06ab3920d41c8e9 (diff)
cesar: update and move cc0/s2 short_messages test to scenario
Diffstat (limited to 'cesar/test_general/station')
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc10_short_messages.py47
-rw-r--r--cesar/test_general/station/scenario/Makefile4
-rw-r--r--cesar/test_general/station/scenario/py/sc10_short_messages.py40
3 files changed, 42 insertions, 49 deletions
diff --git a/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py b/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py
deleted file mode 100644
index 9a07e8cd97..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-
-# Create 2 stations and request to send data of 14 bytes.
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-
-packet = csiPacket (payload_size = 12,
- avln = avln1,
- sta_src = stas[0],
- sta_dest = stas[1])
-
-csi.process_data_send (packet)
-csi.process_wait_sec (1)
-csi.process_avln_stop (avln1)
-csi.process_avln_remove (avln1)
-
-csi.process_verify_transmission ()
-# For nightly build errors
-result = csi.process_end_get_result ()
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/scenario/Makefile b/cesar/test_general/station/scenario/Makefile
index 89f6b2d9b5..2047ee3b02 100644
--- a/cesar/test_general/station/scenario/Makefile
+++ b/cesar/test_general/station/scenario/Makefile
@@ -12,10 +12,10 @@ test_scenario_MODULES = lib mac/common mac cl hle interface cp hal station \
include $(BASE)/common/make/top.mk
testbook: py/sc01_assoc_auth.py py/sc02_stas_communication.py \
- py/sc03_two_avln_coexisting.py py/sc04_cc_whoru.py \
+ py/sc03_two_avln_coexisting.py py/sc04_cc_whoru.py \
py/sc05_cc_leave.py py/sc06_discover_procedure.py \
py/sc07_bridge.py py/sc08_bentry_change.py \
- py/sc09_simple_connect.py
+ py/sc09_simple_connect.py py/sc10_short_messages.py
python testbook.py $^ > $@.rst
CLEAN_FILES += testbook.rst
diff --git a/cesar/test_general/station/scenario/py/sc10_short_messages.py b/cesar/test_general/station/scenario/py/sc10_short_messages.py
new file mode 100644
index 0000000000..b931fd0365
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc10_short_messages.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestShortMessage (unittest.TestCase):
+ """ Test a frame with the min size, between two station in an AVLN.
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testFrameWithoutPayload (self):
+ """A frame of 14 bytes is sent from sta1 to sta2.
+
+ Excepted results: This frame must be received.
+ """
+ avln = self.csi.avln_get (self.csi.avln_nb() - 1)
+ packets = list ()
+ packets.append (csiPacket (0, avln,
+ avln.get_sta(0), avln.get_sta(0).get_mac_addr (),
+ avln.get_sta(1), avln.get_sta(1).get_mac_addr ()))
+ self.failUnless (send_check_datas (self.csi, avln, packets))
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestShortMessage)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])