From 12c5fa0d9a5463a0da9c8889094eee1a38d8a0a3 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 8 Nov 2017 12:58:58 -0500 Subject: [PATCH 1/8] Add some UT cases for rflash that hit against the option parsing in error situations --- .../testcase/UT_openbmc/rflash_cases0 | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 new file mode 100644 index 000000000..4121cc43b --- /dev/null +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -0,0 +1,47 @@ +start:rflash_check +os:Linux +mgt:openbmc +cmd:rflash $$CN --check +check:rc==0 +check:output=~$$CN: BMC Firmware Product +check:output=~$$CN: HOST Firmware Product +check:rc==0 +end + +start:rflash_invalid_activate +cmd: rflash $$CN -a /tmp/abc123.tz +check:rc==1 +check:output=~Error: Invalid option +end + +start:rflash_invalid_activate_and_delete +cmd: rflash $$CN -a 123 -d 123 +check:rc==1 +check:output=~Error: Multiple options specified is not supported +end + +start:rflash_invalid_id +cmd: rflash $$CN -a 123 +check:rc==1 +check:output=~Error: Invalid ID provided to activate +end + +start:rflash_invalid_multiple_id_3 +cmd: rflash $$CN -a 123 abc asdbas +check:rc==1 +check:output=~Error: More than one firmware specified is not supported +end + +start:rflash_invalid_multiple_id_2 +cmd: rflash $$CN -a asdbas 123 +check:rc==1 +check:output=~Error: More than one firmware specified is not supported +end + +start:rflash_invalid_node +cmd: rflash -a 221d9020 +check:rc==1 +check:output=~Error: Invalid nodes and/or groups in noderange: 221d9020 +end + + From de873ca26a0364347b494fc58bd7492564bbe880 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 8 Nov 2017 13:35:25 -0500 Subject: [PATCH 2/8] Create a test case that exposes the problem in rinv #4236 --- .../autotest/testcase/UT_openbmc/rinv_cases0 | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 new file mode 100644 index 000000000..e3c5ca1f6 --- /dev/null +++ b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 @@ -0,0 +1,39 @@ +start:rinv_check_active_fw +description: Ensure that there is only 1 active BMC and 1 Active PNOR +os:Linux +mgt:openbmc +cmd:rinv $$CN firm | grep -i ibm +check:rc==0 +check:output=~$$CN: BMC Firmware Product +check:rc==0 +check:output=~$$CN: HOST Firmware Product +check:rc==0 +end + +start:rinv_check_active_fw_count +description: Ensure that there are only 2 active firmware (if previous test is OK) +os:Linux +mgt:openbmc +# show the output +cmd:rinv $$CN firm | grep -i ibm +check:rc==0 +# check based on wc +cmd:rinv $$CN firm | grep -i ibm | wc -l +check:output=~2 +check:rc==0 +end + +start:rinv_check_active_fw_verbose_count +description: Ensure that there is only 2 active firmware (in verbose mode) (Issue #4236) +os:Linux +mgt:openbmc +# show the output +cmd:rinv $$CN firm -V | grep -i Active +check:rc==0 +# validate test cased on word count +cmd:rinv $$CN firm -V | grep -i Active | wc -l +check:rc==0 +check:rc==0 +check:output=~2 +check:rc==0 +end From f0048944d9f56ab8b23b03c99298576f28005133 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 13:50:20 -0500 Subject: [PATCH 3/8] Add descriptions for rflash UT cases --- xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index 4121cc43b..54569b5ff 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -1,4 +1,5 @@ start:rflash_check +description: Make sure the --check option works os:Linux mgt:openbmc cmd:rflash $$CN --check @@ -9,36 +10,42 @@ check:rc==0 end start:rflash_invalid_activate +description: Provide an invalid option for activte, file does not end in .tar cmd: rflash $$CN -a /tmp/abc123.tz check:rc==1 check:output=~Error: Invalid option end start:rflash_invalid_activate_and_delete +description: Cannot specify -a and -d at the same time cmd: rflash $$CN -a 123 -d 123 check:rc==1 check:output=~Error: Multiple options specified is not supported end start:rflash_invalid_id +description: Passing an invalid ID to activate cmd: rflash $$CN -a 123 check:rc==1 check:output=~Error: Invalid ID provided to activate end start:rflash_invalid_multiple_id_3 +description: Code does not currently support multiple IDs to activate cmd: rflash $$CN -a 123 abc asdbas check:rc==1 check:output=~Error: More than one firmware specified is not supported end start:rflash_invalid_multiple_id_2 +description: Code does not currently support multiple IDs to activate cmd: rflash $$CN -a asdbas 123 check:rc==1 check:output=~Error: More than one firmware specified is not supported end start:rflash_invalid_node +description: Activate a valid ID hash but forget to put in a node range cmd: rflash -a 221d9020 check:rc==1 check:output=~Error: Invalid nodes and/or groups in noderange: 221d9020 From a27d830e148e389d1151916010e5309a7d673388 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 13:52:15 -0500 Subject: [PATCH 4/8] Add OS and hpc values since we need to run these cases only on openbmc mgt nodes --- .../autotest/testcase/UT_openbmc/rflash_cases0 | 14 +++++++++++++- xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index 54569b5ff..cb2bd77b1 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -1,7 +1,7 @@ start:rflash_check description: Make sure the --check option works os:Linux -mgt:openbmc +hcp:openbmc cmd:rflash $$CN --check check:rc==0 check:output=~$$CN: BMC Firmware Product @@ -11,6 +11,8 @@ end start:rflash_invalid_activate description: Provide an invalid option for activte, file does not end in .tar +os:Linux +hcp:openbmc cmd: rflash $$CN -a /tmp/abc123.tz check:rc==1 check:output=~Error: Invalid option @@ -18,6 +20,8 @@ end start:rflash_invalid_activate_and_delete description: Cannot specify -a and -d at the same time +os:Linux +hcp:openbmc cmd: rflash $$CN -a 123 -d 123 check:rc==1 check:output=~Error: Multiple options specified is not supported @@ -25,6 +29,8 @@ end start:rflash_invalid_id description: Passing an invalid ID to activate +os:Linux +hcp:openbmc cmd: rflash $$CN -a 123 check:rc==1 check:output=~Error: Invalid ID provided to activate @@ -32,6 +38,8 @@ end start:rflash_invalid_multiple_id_3 description: Code does not currently support multiple IDs to activate +os:Linux +hcp:openbmc cmd: rflash $$CN -a 123 abc asdbas check:rc==1 check:output=~Error: More than one firmware specified is not supported @@ -39,6 +47,8 @@ end start:rflash_invalid_multiple_id_2 description: Code does not currently support multiple IDs to activate +os:Linux +hcp:openbmc cmd: rflash $$CN -a asdbas 123 check:rc==1 check:output=~Error: More than one firmware specified is not supported @@ -46,6 +56,8 @@ end start:rflash_invalid_node description: Activate a valid ID hash but forget to put in a node range +os:Linux +hcp:openbmc cmd: rflash -a 221d9020 check:rc==1 check:output=~Error: Invalid nodes and/or groups in noderange: 221d9020 diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 index e3c5ca1f6..c25188b0b 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 @@ -1,7 +1,7 @@ start:rinv_check_active_fw description: Ensure that there is only 1 active BMC and 1 Active PNOR os:Linux -mgt:openbmc +hcp:openbmc cmd:rinv $$CN firm | grep -i ibm check:rc==0 check:output=~$$CN: BMC Firmware Product @@ -13,7 +13,7 @@ end start:rinv_check_active_fw_count description: Ensure that there are only 2 active firmware (if previous test is OK) os:Linux -mgt:openbmc +hcp:openbmc # show the output cmd:rinv $$CN firm | grep -i ibm check:rc==0 @@ -26,7 +26,7 @@ end start:rinv_check_active_fw_verbose_count description: Ensure that there is only 2 active firmware (in verbose mode) (Issue #4236) os:Linux -mgt:openbmc +hcp:openbmc # show the output cmd:rinv $$CN firm -V | grep -i Active check:rc==0 From 61228441fbc683f06e029c2638995d4e18ce58d0 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 13:53:46 -0500 Subject: [PATCH 5/8] Remove the check rc on output checking commands --- xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 | 1 - xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index cb2bd77b1..69b4f56b1 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -6,7 +6,6 @@ cmd:rflash $$CN --check check:rc==0 check:output=~$$CN: BMC Firmware Product check:output=~$$CN: HOST Firmware Product -check:rc==0 end start:rflash_invalid_activate diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 index c25188b0b..3ae3b2807 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 @@ -5,9 +5,7 @@ hcp:openbmc cmd:rinv $$CN firm | grep -i ibm check:rc==0 check:output=~$$CN: BMC Firmware Product -check:rc==0 check:output=~$$CN: HOST Firmware Product -check:rc==0 end start:rinv_check_active_fw_count @@ -19,8 +17,8 @@ cmd:rinv $$CN firm | grep -i ibm check:rc==0 # check based on wc cmd:rinv $$CN firm | grep -i ibm | wc -l -check:output=~2 check:rc==0 +check:output=~2 end start:rinv_check_active_fw_verbose_count @@ -33,7 +31,5 @@ check:rc==0 # validate test cased on word count cmd:rinv $$CN firm -V | grep -i Active | wc -l check:rc==0 -check:rc==0 check:output=~2 -check:rc==0 end From 56c8437b5e3b9a109feb379d4e5d7c9d74a151d1 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 14:23:08 -0500 Subject: [PATCH 6/8] Save the output for rinv and run test against the output file to speed things up --- .../autotest/testcase/UT_openbmc/rinv_cases0 | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 index 3ae3b2807..529ba0933 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 @@ -1,35 +1,29 @@ -start:rinv_check_active_fw -description: Ensure that there is only 1 active BMC and 1 Active PNOR -os:Linux +start:rinv_check_active_fw_count +description: Ensure that there is only 2 active firmware, one for bmc and one for pnor hcp:openbmc -cmd:rinv $$CN firm | grep -i ibm +cmd: rinv $$CN firm | tee /tmp/xcattest.rinv_check_active_fw_count.output +check:rc==0 +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'HOST Firmware Product' | grep -i 'Active)*' | wc -l +check:rc==0 +check:output=~1 +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'BMC Firmware Product'|grep -i 'Active)*' | wc -l +check:rc==0 +check:output=~1 +cmd : rm -rf /tmp/xcattest.rinv_check_active_fw_count.output check:rc==0 -check:output=~$$CN: BMC Firmware Product -check:output=~$$CN: HOST Firmware Product end -start:rinv_check_active_fw_count -description: Ensure that there are only 2 active firmware (if previous test is OK) -os:Linux +start:rinv_check_active_fw_count_verbose +description: Ensure that there is only 2 active firmware, one for bmc and one for pnor (in verbose mode) (Issue #4236) hcp:openbmc -# show the output -cmd:rinv $$CN firm | grep -i ibm +cmd: rinv $$CN firm -V | tee /tmp/xcattest.rinv_check_active_fw_count_verbose.output check:rc==0 -# check based on wc -cmd:rinv $$CN firm | grep -i ibm | wc -l +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output| grep -i 'HOST Firmware Product' | grep -i 'Active)*' | wc -l +check:rc==0 +check:output=~1 +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output | grep -i 'BMC Firmware Product'|grep -i 'Active)*' | wc -l +check:rc==0 +check:output=~1 +cmd : rm -rf /tmp/xcattest.rinv_check_active_fw_count_verbose.output check:rc==0 -check:output=~2 -end - -start:rinv_check_active_fw_verbose_count -description: Ensure that there is only 2 active firmware (in verbose mode) (Issue #4236) -os:Linux -hcp:openbmc -# show the output -cmd:rinv $$CN firm -V | grep -i Active -check:rc==0 -# validate test cased on word count -cmd:rinv $$CN firm -V | grep -i Active | wc -l -check:rc==0 -check:output=~2 end From a74cc4263a8297120ce57e3a4a982d934f73e38c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 14:46:43 -0500 Subject: [PATCH 7/8] add testcase to test multiple deletes of firmware --- xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index 69b4f56b1..aee589f48 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -62,4 +62,11 @@ check:rc==1 check:output=~Error: Invalid nodes and/or groups in noderange: 221d9020 end - +start:rflash_invalid_delete_2 +description: Attempt to delete more than 1 ID from the FW +os:Linux +hcp:openbmc +cmd: rflash $$CN -d 221d9020 221d9020 +check:rc==1 +check:output=~Error: More than one firmware specified is not supported +end From b95be0f3207432b76e804579b77ddfdbf539c8e2 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 Nov 2017 14:53:55 -0500 Subject: [PATCH 8/8] Need to backslash the * to make the grep effective --- xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 index 529ba0933..80717745b 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rinv_cases0 @@ -3,10 +3,10 @@ description: Ensure that there is only 2 active firmware, one for bmc and one fo hcp:openbmc cmd: rinv $$CN firm | tee /tmp/xcattest.rinv_check_active_fw_count.output check:rc==0 -cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'HOST Firmware Product' | grep -i 'Active)*' | wc -l +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'HOST Firmware Product' | grep -i 'Active)\*' | wc -l check:rc==0 check:output=~1 -cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'BMC Firmware Product'|grep -i 'Active)*' | wc -l +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count.output | grep -i 'BMC Firmware Product'|grep -i 'Active)\*' | wc -l check:rc==0 check:output=~1 cmd : rm -rf /tmp/xcattest.rinv_check_active_fw_count.output @@ -18,10 +18,10 @@ description: Ensure that there is only 2 active firmware, one for bmc and one fo hcp:openbmc cmd: rinv $$CN firm -V | tee /tmp/xcattest.rinv_check_active_fw_count_verbose.output check:rc==0 -cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output| grep -i 'HOST Firmware Product' | grep -i 'Active)*' | wc -l +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output| grep -i 'HOST Firmware Product' | grep -i 'Active)\*' | wc -l check:rc==0 check:output=~1 -cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output | grep -i 'BMC Firmware Product'|grep -i 'Active)*' | wc -l +cmd: grep -i ibm /tmp/xcattest.rinv_check_active_fw_count_verbose.output | grep -i 'BMC Firmware Product'|grep -i 'Active)\*' | wc -l check:rc==0 check:output=~1 cmd : rm -rf /tmp/xcattest.rinv_check_active_fw_count_verbose.output