summaryrefslogtreecommitdiff
path: root/cesar/test_general
diff options
context:
space:
mode:
authorjelisavcic2009-10-05 15:46:42 +0000
committerjelisavcic2009-10-05 15:46:42 +0000
commita2dbbb9d395e0b405bee7e2cd35322e8c638d122 (patch)
tree5ddaea9ff2949df82d5e79f5ac81e9911e7d9ad7 /cesar/test_general
parent1de377dc92030069eadfa73cd22990dba7dec8c0 (diff)
[CESAR][TEST_GENERAL][EOC] Add simulator for CCO.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5926 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general')
-rw-r--r--cesar/test_general/station/compliance-eoc/Makefile9
-rw-r--r--cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_cco.py94
-rw-r--r--cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_sta.py10
-rw-r--r--cesar/test_general/station/compliance-eoc/simu-cco-Config11
-rw-r--r--cesar/test_general/station/compliance-eoc/simu-cco-Makefile6
-rw-r--r--cesar/test_general/station/compliance-eoc/simu-cco-ecos.ecc.sh5
6 files changed, 127 insertions, 8 deletions
diff --git a/cesar/test_general/station/compliance-eoc/Makefile b/cesar/test_general/station/compliance-eoc/Makefile
index 347bed82a8..71987aa73e 100644
--- a/cesar/test_general/station/compliance-eoc/Makefile
+++ b/cesar/test_general/station/compliance-eoc/Makefile
@@ -1,6 +1,6 @@
-all: board-cco board-sta simu-sta
+all: board-cco board-sta simu-sta simu-cco
-clean: board-cco-clean board-sta-clean simu-sta-clean
+clean: board-cco-clean board-sta-clean simu-sta-clean simu-cco-clean
board-cco: board-cco-Makefile board-cco-ecos.ecc.sh
make -f board-cco-Makefile
@@ -16,3 +16,8 @@ simu-sta: simu-sta-Makefile simu-sta-ecos.ecc.sh
make -f simu-sta-Makefile
simu-sta-clean: simu-sta-Makefile
make -f simu-sta-Makefile clean
+
+simu-cco: simu-cco-Makefile simu-cco-ecos.ecc.sh
+ make -f simu-cco-Makefile
+simu-cco-clean: simu-cco-Makefile
+ make -f simu-cco-Makefile clean
diff --git a/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_cco.py b/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_cco.py
new file mode 100644
index 0000000000..b975b124ee
--- /dev/null
+++ b/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_cco.py
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+
+#############################################################################
+# See Phase II certification
+# Compliance Certification Test plan.
+# Version 1.0.22
+#
+# Section 6.2.1 DUT as a CCo
+# Purpose: Verify that in a single AVLN there is only one DUT that is acting
+# as a Central Coordinator.
+#
+# Expected Results:
+# There is only one DUT with CCo Capability value equals to 0b01 or test is
+# failed.
+#############################################################################
+
+
+import sys
+base_path = sys.path[0] + '/../../../../'
+
+sys.path.append (base_path + '/test_general/station/common/py')
+from startup import Startup
+
+startup = Startup (base_path = base_path,
+ executable = sys.path[0] + '/../obj/simu-cco/station.elf')
+startup.add_option ('-g', '--gdb', action = 'store_true',
+ default = False, help = 'launch the test in debug mode')
+startup.add_option ('-t', '--trace', action = 'store_true',
+ default = False,
+ help = 'dump trace of all stations using command: "pkill -USR2 -f'
+ + ' maximus"')
+argv, proto, options = startup.parse ()
+
+from csicore import csiCore, csiSta
+from define import SECURITY_LEVEL_SC
+
+
+# If trace dumping is enabled.
+if options.trace:
+ # Handler for dump all the trace of the station.
+ import signal
+ def trace_signal_handler (signal, frame):
+ dump_trace ()
+ # Bind handler to SIGUSR2.
+ signal.signal (signal.SIGUSR2, trace_signal_handler)
+
+# Initialize CSI.
+csi = csiCore(1247);
+# Create an AVLN.
+avln = csi.avln_add ("HomePlugAV0123", "AVLN")
+
+# Add one CCO.
+macs = ["00:01:01:00:00:01"]
+print macs
+
+stas = []
+for i in range (len (macs)):
+ stas.append (avln.sta_add (macs[i], False, False,
+ "ABCD-EFGH-IJKL-MNOP", "Spidcom Station " + str(i),
+ "Spidcom Sta SPC300", SECURITY_LEVEL_SC,
+ debug = options.gdb))
+
+csi.process_init (argv, proto)
+csi.process_avlns_launch ()
+csi.process_wait_sec (30)
+
+# Class which do the real check.
+import unittest
+class TestDUTAsACCo(unittest.TestCase):
+ def setUp (self):
+ pass
+ def tearDown (self):
+ pass
+
+ def test (self):
+ # Check STA CCo status.
+ from own_data import Station_own_data
+
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (csi.get_maximus(), stas[0].get_sta_cesar())
+ sta1_cco_status = data.is_cco
+
+ self.failUnless (sta1_cco_status)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestDUTAsACCo)
+testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+
+if options.trace:
+ for i in range (len (macs)):
+ csi.debug_trace_dump ('all', stas[i])
+
+csi.process_avlns_remove ()
+# For nightly build errors
+sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_sta.py b/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_sta.py
index ba8e06066b..5bffe4af9a 100644
--- a/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_sta.py
+++ b/cesar/test_general/station/compliance-eoc/py/test01_eoc_init_one_sta.py
@@ -48,8 +48,9 @@ if options.trace:
csi = csiCore(1247);
# Create an AVLN.
avln = csi.avln_add ("HomePlugAV0123", "AVLN")
-# Add two STA.
-macs = startup.get_macs ()
+
+# Add one STA.
+macs = ["00:01:01:00:00:23"]
print macs
stas = []
@@ -79,10 +80,7 @@ class TestDUTAsACCo(unittest.TestCase):
data = sta_data.get_data (csi.get_maximus(), stas[0].get_sta_cesar())
sta1_cco_status = data.is_cco
- data = sta_data.get_data (csi.get_maximus(), stas[1].get_sta_cesar())
- sta2_cco_status = data.is_cco
-
- self.failUnless (sta1_cco_status ^ sta2_cco_status)
+ self.failUnless (sta1_cco_status == 0)
suite = unittest.TestLoader().loadTestsFromTestCase(TestDUTAsACCo)
testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/test_general/station/compliance-eoc/simu-cco-Config b/cesar/test_general/station/compliance-eoc/simu-cco-Config
new file mode 100644
index 0000000000..f4908dc67d
--- /dev/null
+++ b/cesar/test_general/station/compliance-eoc/simu-cco-Config
@@ -0,0 +1,11 @@
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_PBPROC_FC_EOC = y
+CONFIG_CP_BEACON_REGION = n
+CONFIG_ATU_FACTOR = 3
+CONFIG_CP_BEACON_DISCOVER = n
+CONFIG_CP_EOC_SCHEDULER = y
+CONFIG_MAC_COMMON_EOC_MFS = y
+CONFIG_CP_EOC_MULTI_STA_FSM_DEF="cp/eoc/multi_sta_fsm/src/fsm/multi_sta.fsm"
+CONFIG_CP_STA_MGR_EOC = y
+CONFIG_CP_MSG_VS_EOC = y
+CONFIG_CP_FSM_DEF = "cp/fsm/src/fsm/cp_eoc_cco.fsm"
diff --git a/cesar/test_general/station/compliance-eoc/simu-cco-Makefile b/cesar/test_general/station/compliance-eoc/simu-cco-Makefile
new file mode 100644
index 0000000000..7f1985d880
--- /dev/null
+++ b/cesar/test_general/station/compliance-eoc/simu-cco-Makefile
@@ -0,0 +1,6 @@
+BASE = ../../..
+ECOS = y
+VARIANT = simu-cco
+TARGET_OPTIMIZE = -Os
+
+include Makefile-cco.mk
diff --git a/cesar/test_general/station/compliance-eoc/simu-cco-ecos.ecc.sh b/cesar/test_general/station/compliance-eoc/simu-cco-ecos.ecc.sh
new file mode 100644
index 0000000000..e0278271fe
--- /dev/null
+++ b/cesar/test_general/station/compliance-eoc/simu-cco-ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new maximus default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check