From 0584a21272f479f43c6a0317a425b289cd3be1bb Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 15 Dec 2017 16:55:16 -0500 Subject: [PATCH 1/3] Fix UT cases based on changes to support --delete --- xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index 760e651e5..83f596e8c 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -14,14 +14,14 @@ os:Linux hcp:openbmc cmd: rflash $$CN -a /tmp/abc123.tz check:rc==1 -check:output=~Error: Invalid option +check:output=~Error: Invalid firmware specified with -a end start:rflash_invalid_activate_and_delete -description: Cannot specify -a and -d at the same time +description: Cannot specify -a and --delete at the same time os:Linux hcp:openbmc -cmd: rflash $$CN -a 123 -d 123 +cmd: rflash $$CN -a 123 --delete 123 check:rc==1 check:output=~Error: Multiple options are not supported end @@ -66,7 +66,7 @@ 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 +cmd: rflash $$CN --delete 221d9020 221d9020 check:rc==1 check:output=~Error: More than one firmware specified is not supported end From 6ee77f1fbb70475b441c84eb31c7a209758db77d Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 15 Dec 2017 16:55:32 -0500 Subject: [PATCH 2/3] Fix the code to handle multiple activate, found bug with UT cases --- xCAT-server/lib/xcat/plugins/openbmc.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 92bc14928..c2be6d68a 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1180,7 +1180,10 @@ sub parse_args { } if (scalar @flash_arguments > 1) { - if ($filename_passed and $option_flag !~ /^-d$/) { + if (($option_flag =~ /^-a$|^--delete$/) or ($filename_passed and $option_flag !~ /^-d$/)) { + # Handles: + # - Multiple options not supported to activate/delete at the same time + # - Filename passed in and option is not -d for directory return ([1, "More than one firmware specified is not supported."]); } elsif ($option_flag =~ /^-d$/) { return ([1, "More than one directory specified is not supported."]); From d533fee0b1212474804568789e6f79f7e59a5a4e Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 18 Dec 2017 14:54:42 -0500 Subject: [PATCH 3/3] Add the --activate option into the test --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index c2be6d68a..1bb8f461e 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1180,7 +1180,7 @@ sub parse_args { } if (scalar @flash_arguments > 1) { - if (($option_flag =~ /^-a$|^--delete$/) or ($filename_passed and $option_flag !~ /^-d$/)) { + if (($option_flag =~ /^-a$|^--activate$|^--delete$/) or ($filename_passed and $option_flag !~ /^-d$/)) { # Handles: # - Multiple options not supported to activate/delete at the same time # - Filename passed in and option is not -d for directory