37
37
optAddons = dict () # Store all addons found. We'll loop through it a couple time below
38
38
# Look at the top level of the addons for any directories and load their Setup modules
39
39
40
+ qemu_default = "qemu-system-ppc64"
41
+
42
+ def get_parser ():
43
+ parser = argparse .ArgumentParser (
44
+ description = __doc__ ,
45
+ formatter_class = argparse .RawDescriptionHelpFormatter
46
+ )
47
+ parser .add_argument ("-c" , "--config-file" , help = "Configuration File" ,
48
+ metavar = "FILE" )
49
+ tgroup = parser .add_argument_group ('Test' ,
50
+ 'Tests to run' )
51
+ tgroup .add_argument ("--list-suites" , action = 'store_true' ,
52
+ help = "List available suites to run" )
53
+ tgroup .add_argument ("--run-suite" , action = 'append' ,
54
+ help = "Run a test suite(s)" )
55
+ tgroup .add_argument ("--run" , action = 'append' ,
56
+ help = "Run individual tests" )
57
+ tgroup .add_argument ("--quiet" , action = 'store_true' , default = False ,
58
+ help = "Don't splat lots of things to the console" )
59
+
60
+ parser .add_argument ("--machine-state" , help = "Current machine state" ,
61
+ choices = ['UNKNOWN' , 'OFF' , 'PETITBOOT' ,
62
+ 'PETITBOOT_SHELL' , 'OS' ])
63
+
64
+ # Options to set the output directory and suffix on the output
65
+ parser .add_argument ("-o" , "--output" , help = "Output directory for test reports. Can also be set via OP_TEST_OUTPUT env variable." )
66
+ parser .add_argument ("--suffix" , help = "Suffix to add to all reports. Default is current time." )
67
+
68
+ bmcgroup = parser .add_argument_group ('BMC' ,
69
+ 'Options for Service Processor' )
70
+ # The default supported BMC choices in --bmc-type
71
+ bmcChoices = ['AMI' , 'SMC' , 'FSP' , 'OpenBMC' , 'qemu' ]
72
+ # Loop through any addons let it append the extra bmcChoices
73
+ for opt in optAddons :
74
+ bmcChoices = optAddons [opt ].addBMCType (bmcChoices )
75
+ bmcgroup .add_argument ("--bmc-type" ,
76
+ choices = bmcChoices ,
77
+ help = "Type of service processor" )
78
+ bmcgroup .add_argument ("--bmc-ip" , help = "BMC address" )
79
+ bmcgroup .add_argument ("--bmc-username" , help = "SSH username for BMC" )
80
+ bmcgroup .add_argument ("--bmc-password" , help = "SSH password for BMC" )
81
+ bmcgroup .add_argument ("--bmc-usernameipmi" , help = "IPMI username for BMC" )
82
+ bmcgroup .add_argument ("--bmc-passwordipmi" , help = "IPMI password for BMC" )
83
+ bmcgroup .add_argument ("--bmc-prompt" , default = "#" ,
84
+ help = "Prompt for BMC ssh session" )
85
+ bmcgroup .add_argument ("--smc-presshipmicmd" )
86
+ bmcgroup .add_argument ("--qemu-binary" , default = qemu_default ,
87
+ help = "[QEMU Only] qemu simulator binary" )
88
+
89
+ hostgroup = parser .add_argument_group ('Host' , 'Installed OS information' )
90
+ hostgroup .add_argument ("--host-ip" , help = "Host address" )
91
+ hostgroup .add_argument ("--host-user" , help = "SSH username for Host" )
92
+ hostgroup .add_argument ("--host-password" , help = "SSH password for Host" )
93
+ hostgroup .add_argument ("--host-lspci" , help = "Known 'lspci -n -m' for host" )
94
+ hostgroup .add_argument ("--host-scratch-disk" , help = "A block device we can erase" , default = "" )
95
+ hostgroup .add_argument ("--proxy" , default = "" , help = "proxy for the Host to access the internet. "
96
+ "Only needed for tests that install an OS" )
97
+ hostgroup .add_argument ("--host-prompt" , default = "#" ,
98
+ help = "Prompt for Host SSH session" )
99
+
100
+ hostgroup .add_argument ("--platform" ,
101
+ help = "Platform (used for EnergyScale tests)" ,
102
+ choices = ['unknown' ,'habanero' ,'firestone' ,'garrison' ,'firenze' ,'p9dsu' ])
103
+
104
+ osgroup = parser .add_argument_group ('OS Images' , 'OS Images to boot/install' )
105
+ osgroup .add_argument ("--ubuntu-cdrom" , help = "Ubuntu ppc64el CD/DVD install image" )
106
+
107
+ imagegroup = parser .add_argument_group ('Images' , 'Firmware LIDs/images to flash' )
108
+ imagegroup .add_argument ("--bmc-image" , help = "BMC image to flash(*.tar in OpenBMC, *.bin in SMC)" )
109
+ imagegroup .add_argument ("--host-pnor" , help = "PNOR image to flash" )
110
+ imagegroup .add_argument ("--host-hpm" , help = "HPM image to flash" )
111
+ imagegroup .add_argument ("--host-img-url" , help = "URL to Host Firmware image to flash on FSP systems (Must be URL accessible petitboot shell on the host)" )
112
+ imagegroup .add_argument ("--flash-skiboot" ,
113
+ help = "skiboot to use/flash. Depending on platform, may need to be xz compressed" )
114
+ imagegroup .add_argument ("--flash-kernel" ,
115
+ help = "petitboot zImage.epapr to use/flash." )
116
+ imagegroup .add_argument ("--flash-initramfs" ,
117
+ help = "petitboot rootfs to use/flash. Not all platforms support this option" )
118
+ imagegroup .add_argument ("--noflash" ,"--no-flash" , action = 'store_true' , default = False ,
119
+ help = "Even if images are specified, don't flash them" )
120
+ imagegroup .add_argument ("--only-flash" , action = 'store_true' , default = False ,
121
+ help = "Only flash, don't run any tests (even if specified)" )
122
+ imagegroup .add_argument ("--pflash" ,
123
+ help = "pflash to copy to BMC (if needed)" )
124
+ imagegroup .add_argument ("--pupdate" ,
125
+ help = "pupdate to flash PNOR for Supermicro systems" )
126
+
127
+ return parser
128
+
129
+
40
130
class OpTestConfiguration ():
41
131
def __init__ (self ):
42
132
self .args = []
@@ -48,16 +138,10 @@ def __init__(self):
48
138
49
139
def parse_args (self , argv = None ):
50
140
conf_parser = argparse .ArgumentParser (add_help = False )
51
- parser = argparse .ArgumentParser (
52
- description = __doc__ ,
53
- formatter_class = argparse .RawDescriptionHelpFormatter
54
- )
55
141
56
142
# We have two parsers so we have correct --help, we need -c in both
57
143
conf_parser .add_argument ("-c" , "--config-file" , help = "Configuration File" ,
58
144
metavar = "FILE" )
59
- parser .add_argument ("-c" , "--config-file" , help = "Configuration File" ,
60
- metavar = "FILE" )
61
145
62
146
args , remaining_args = conf_parser .parse_known_args (argv )
63
147
defaults = {}
@@ -70,89 +154,12 @@ def parse_args(self, argv=None):
70
154
except ConfigParser .NoSectionError :
71
155
pass
72
156
157
+ parser = get_parser ()
73
158
parser .set_defaults (** defaults )
74
159
75
- qemu_default = "qemu-system-ppc64"
76
160
if defaults .get ('qemu_binary' ):
77
161
qemu_default = defaults ['qemu_binary' ]
78
162
79
- tgroup = parser .add_argument_group ('Test' ,
80
- 'Tests to run' )
81
- tgroup .add_argument ("--list-suites" , action = 'store_true' ,
82
- help = "List available suites to run" )
83
- tgroup .add_argument ("--run-suite" , action = 'append' ,
84
- help = "Run a test suite(s)" )
85
- tgroup .add_argument ("--run" , action = 'append' ,
86
- help = "Run individual tests" )
87
- tgroup .add_argument ("--quiet" , action = 'store_true' , default = False ,
88
- help = "Don't splat lots of things to the console" )
89
-
90
- parser .add_argument ("--machine-state" , help = "Current machine state" ,
91
- choices = ['UNKNOWN' , 'OFF' , 'PETITBOOT' ,
92
- 'PETITBOOT_SHELL' , 'OS' ])
93
-
94
- # Options to set the output directory and suffix on the output
95
- parser .add_argument ("-o" , "--output" , help = "Output directory for test reports. Can also be set via OP_TEST_OUTPUT env variable." )
96
- parser .add_argument ("--suffix" , help = "Suffix to add to all reports. Default is current time." )
97
-
98
- bmcgroup = parser .add_argument_group ('BMC' ,
99
- 'Options for Service Processor' )
100
- # The default supported BMC choices in --bmc-type
101
- bmcChoices = ['AMI' , 'SMC' , 'FSP' , 'OpenBMC' , 'qemu' ]
102
- # Loop through any addons let it append the extra bmcChoices
103
- for opt in optAddons :
104
- bmcChoices = optAddons [opt ].addBMCType (bmcChoices )
105
- bmcgroup .add_argument ("--bmc-type" ,
106
- choices = bmcChoices ,
107
- help = "Type of service processor" )
108
- bmcgroup .add_argument ("--bmc-ip" , help = "BMC address" )
109
- bmcgroup .add_argument ("--bmc-username" , help = "SSH username for BMC" )
110
- bmcgroup .add_argument ("--bmc-password" , help = "SSH password for BMC" )
111
- bmcgroup .add_argument ("--bmc-usernameipmi" , help = "IPMI username for BMC" )
112
- bmcgroup .add_argument ("--bmc-passwordipmi" , help = "IPMI password for BMC" )
113
- bmcgroup .add_argument ("--bmc-prompt" , default = "#" ,
114
- help = "Prompt for BMC ssh session" )
115
- bmcgroup .add_argument ("--smc-presshipmicmd" )
116
- bmcgroup .add_argument ("--qemu-binary" , default = qemu_default ,
117
- help = "[QEMU Only] qemu simulator binary" )
118
-
119
- hostgroup = parser .add_argument_group ('Host' , 'Installed OS information' )
120
- hostgroup .add_argument ("--host-ip" , help = "Host address" )
121
- hostgroup .add_argument ("--host-user" , help = "SSH username for Host" )
122
- hostgroup .add_argument ("--host-password" , help = "SSH password for Host" )
123
- hostgroup .add_argument ("--host-lspci" , help = "Known 'lspci -n -m' for host" )
124
- hostgroup .add_argument ("--host-scratch-disk" , help = "A block device we can erase" , default = "" )
125
- hostgroup .add_argument ("--proxy" , default = "" , help = "proxy for the Host to access the internet. "
126
- "Only needed for tests that install an OS" )
127
- hostgroup .add_argument ("--host-prompt" , default = "#" ,
128
- help = "Prompt for Host SSH session" )
129
-
130
- hostgroup .add_argument ("--platform" ,
131
- help = "Platform (used for EnergyScale tests)" ,
132
- choices = ['unknown' ,'habanero' ,'firestone' ,'garrison' ,'firenze' ,'p9dsu' ])
133
-
134
- osgroup = parser .add_argument_group ('OS Images' , 'OS Images to boot/install' )
135
- osgroup .add_argument ("--ubuntu-cdrom" , help = "Ubuntu ppc64el CD/DVD install image" )
136
-
137
- imagegroup = parser .add_argument_group ('Images' , 'Firmware LIDs/images to flash' )
138
- imagegroup .add_argument ("--bmc-image" , help = "BMC image to flash(*.tar in OpenBMC, *.bin in SMC)" )
139
- imagegroup .add_argument ("--host-pnor" , help = "PNOR image to flash" )
140
- imagegroup .add_argument ("--host-hpm" , help = "HPM image to flash" )
141
- imagegroup .add_argument ("--host-img-url" , help = "URL to Host Firmware image to flash on FSP systems (Must be URL accessible petitboot shell on the host)" )
142
- imagegroup .add_argument ("--flash-skiboot" ,
143
- help = "skiboot to use/flash. Depending on platform, may need to be xz compressed" )
144
- imagegroup .add_argument ("--flash-kernel" ,
145
- help = "petitboot zImage.epapr to use/flash." )
146
- imagegroup .add_argument ("--flash-initramfs" ,
147
- help = "petitboot rootfs to use/flash. Not all platforms support this option" )
148
- imagegroup .add_argument ("--noflash" ,"--no-flash" , action = 'store_true' , default = False ,
149
- help = "Even if images are specified, don't flash them" )
150
- imagegroup .add_argument ("--only-flash" , action = 'store_true' , default = False ,
151
- help = "Only flash, don't run any tests (even if specified)" )
152
- imagegroup .add_argument ("--pflash" ,
153
- help = "pflash to copy to BMC (if needed)" )
154
- imagegroup .add_argument ("--pupdate" ,
155
- help = "pupdate to flash PNOR for Supermicro systems" )
156
163
157
164
self .args , self .remaining_args = parser .parse_known_args (remaining_args )
158
165
stateMap = { 'UNKNOWN' : OpSystemState .UNKNOWN ,
0 commit comments