[PATCH openbmc-test-automation 44/60] created loops for tests

OpenBMC Patches openbmc-patches at stwcx.xyz
Tue Jan 12 03:50:10 AEDT 2016


From: Chris Austen <austenc at us.ibm.com>

---
 data/variables.py          |  4 ++++
 lib/resource.txt           |  4 ++++
 tests/test_inventory.robot | 26 +++++++++++++-------------
 3 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/data/variables.py b/data/variables.py
index 820a251..a342701 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -28,6 +28,10 @@ INVENTORY={
                  "/org/openbmc/inventory/system/chassis/motherboard", 
                  "/org/openbmc/inventory/system/chassis/motherboard/bmc", 
                  "/org/openbmc/inventory/system/chassis/fan3"],
+}
+
+
+INVENTORY_ITEMS={
 
     "DIMM" : [  "Asset Tag",
                 "Custom Field 1",
diff --git a/lib/resource.txt b/lib/resource.txt
index 85bf2fd..a8b8614 100644
--- a/lib/resource.txt
+++ b/lib/resource.txt
@@ -19,6 +19,10 @@ Get Inventory Schema
     [Arguments]    ${machine}
     [Return]    &{INVENTORY}[${machine}]
 
+Get Inventory Items Schema
+    [Arguments]    ${machine}
+    [Return]    &{INVENTORY_ITEMS}[${machine}]
+
 Get Sensor Schema
     [Arguments]    ${machine}
     [Return]    &{SENSORS}[${machine}]
\ No newline at end of file
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
index f326a72..fde52e1 100644
--- a/tests/test_inventory.robot
+++ b/tests/test_inventory.robot
@@ -4,6 +4,8 @@ Suite Teardown    Delete All Sessions
 Resource          ../lib/rest_client.robot
 Resource          ../lib/resource.txt
 
+Library           String
+
 *** Test Cases ***
 List Inventory
     ${resp} =    OpenBMC Get Request    /org/openbmc/inventory/list
@@ -14,29 +16,27 @@ List Inventory
     \    Should Contain    ${jsondata}    ${ELEMENT}
 
 
-Verify dimm0 vpd
-	${value} =	Read attribute	/org/openbmc/inventory/system/chassis/motherboard/dimm0	fru_type
-	Should Be Equal	${value}	"DIMM"
+Verify dimm vpd
+	: FOR 	${INDEX} 	IN RANGE 	0 	4
+	\	log 	${INDEX}
+	\	${value} =	Read attribute	/org/openbmc/inventory/system/chassis/motherboard/dimm${INDEX}	fru_type
+	\	Should Be Equal	${value}	"DIMM"
 
 
-Verify dimm1 vpd
-	${value} =	Read attribute	/org/openbmc/inventory/system/chassis/motherboard/dimm1	fru_type
-	Should Be Equal	${value}	"DIMM"
+Verify dimm vpd properties
+	: FOR 	${INDEX} 	IN RANGE 	0 	4
+	\	log 	${INDEX}
+	\	${props} =	Read Properties	/org/openbmc/inventory/system/chassis/motherboard/dimm${INDEX}
+	\	Should Be Valid Dimm Properties	${props}
 
-Verify dimm0 properties
-	${props} =	Read Properties	/org/openbmc/inventory/system/chassis/motherboard/dimm0
-	Should Be Valid Dimm Properties	${props}
 
-Verify dimm1 properties
-	${props} =	Read Properties	/org/openbmc/inventory/system/chassis/motherboard/dimm1
-	Should Be Valid Dimm Properties	${props}
 
 
 
 *** Keywords ***
 Should Be Valid Dimm Properties
 	[arguments]	${props}
-	${ret}=    Get Inventory Schema	DIMM
+	${ret}=    Get Inventory Items Schema	DIMM
 	: FOR    ${ELEMENT}    IN    @{ret}
 	\    Should Contain    ${props}    ${ELEMENT}
 
-- 
2.6.4




More information about the openbmc mailing list