summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2012-08-06 14:04:52 -0500
committerGeorge Kraft <george.kraft@calxeda.com>2012-08-06 14:04:52 -0500
commite8d8f64370227461dc60ebed96f77441b6f5bfaa (patch)
treeb3d4dd1251771cedb1fd1fc970ce354147dcac5b
parent3fac15889dec0f15a2ba10e79c799a7d160f3268 (diff)
downloadcxmanage-e8d8f64370227461dc60ebed96f77441b6f5bfaa.tar.gz
cxmanage_test: Add tests for info_basic and info_ubootenv
-rw-r--r--cxmanage_test/controller_test.py45
-rw-r--r--cxmanage_test/target_test.py25
2 files changed, 70 insertions, 0 deletions
diff --git a/cxmanage_test/controller_test.py b/cxmanage_test/controller_test.py
index 566173a..53bd067 100644
--- a/cxmanage_test/controller_test.py
+++ b/cxmanage_test/controller_test.py
@@ -34,6 +34,7 @@ import time
import unittest
from cxmanage.controller import Controller
+from cxmanage.ubootenv import UbootEnv
from cxmanage_test import TestSensor
NUM_NODES = 128
@@ -278,6 +279,32 @@ class ControllerTargetTest(unittest.TestCase):
for image_type in ["S2_ELF", "SOC_ELF", "CDB"]:
self.assertTrue(image_type in updated_types)
+ def test_info_basic(self):
+ """ Test controller info basic command """
+ # Add targets
+ self.controller.add_target(ADDRESSES[0], "admin", "admin", True)
+
+ # Send config boot status command
+ self.assertFalse(self.controller.info_basic())
+
+ for target in self.controller.targets:
+ # Verify command
+ self.assertTrue(len(target.executed), 1)
+ self.assertEqual(target.executed[0], "info_basic")
+
+ def test_info_ubootenv(self):
+ """ Test controller info ubootenv command """
+ # Add targets
+ self.controller.add_target(ADDRESSES[0], "admin", "admin", True)
+
+ # Send config boot status command
+ self.assertFalse(self.controller.info_ubootenv())
+
+ for target in self.controller.targets:
+ # Verify command
+ self.assertTrue(len(target.executed), 1)
+ self.assertEqual(target.executed[0], "get_ubootenv")
+
def test_info_dump(self):
""" Test controller info dump command """
# Add targets
@@ -348,6 +375,17 @@ class DummyTarget:
self.executed.append("config_boot_status")
return ["disk", "pxe"]
+ def info_basic(self):
+ self.executed.append("info_basic")
+
+ class Result:
+ def __init__(self):
+ self.header = "Calxeda SoC (0x0096CD)"
+ self.version = "0.0.0"
+ self.build_number = "00000000"
+ self.timestamp = "0"
+ return Result()
+
def info_dump(self, tftp):
self.executed.append("info_dump")
@@ -355,6 +393,13 @@ class DummyTarget:
self.executed.append(("ipmitool_command", ipmitool_args))
return "Dummy output"
+ def get_ubootenv(self, tftp):
+ self.executed.append("get_ubootenv")
+
+ ubootenv = UbootEnv()
+ ubootenv.variables["bootcmd0"] = "run bootcmd_default"
+ ubootenv.variables["bootcmd_default"] = "run bootcmd_sata"
+ return ubootenv
class DummyImage:
def __init__(self, filename, image_type, *args):
diff --git a/cxmanage_test/target_test.py b/cxmanage_test/target_test.py
index 454414e..b960410 100644
--- a/cxmanage_test/target_test.py
+++ b/cxmanage_test/target_test.py
@@ -240,6 +240,19 @@ class TargetTest(unittest.TestCase):
self.assertEqual(result, ["disk", "pxe"])
+ def test_info_basic(self):
+ """ Test info_basic command """
+ for target in self.targets:
+ result = target.info_basic()
+
+ executed = target.bmc.executed
+ self.assertEqual(len(executed), 1)
+ self.assertEqual(executed[0], "info_basic")
+ self.assertTrue(hasattr(result, "header"))
+ self.assertTrue(hasattr(result, "version"))
+ self.assertTrue(hasattr(result, "build_number"))
+ self.assertTrue(hasattr(result, "timestamp"))
+
class DummyBMC(LanBMC):
""" Dummy BMC for the target tests """
def __init__(self, **kwargs):
@@ -380,6 +393,18 @@ class DummyBMC(LanBMC):
return sensors
+ def get_info_basic(self):
+ """ Get basic SoC info from this node """
+ self.executed.append("info_basic")
+
+ class Result:
+ def __init__(self):
+ self.header = "Calxeda SoC (0x0096CD)"
+ self.version = "0.0.0"
+ self.build_number = "00000000"
+ self.timestamp = "0"
+ return Result()
+
class Partition:
def __init__(self, slot, slot_type, offset=0,
size=0, version=0, daddr=0, in_use=None):