factory.par: Add argument PHASE to gooftool and hwid
For gooftool and hwid, some verification works differently for different
PHASEs. However, there is no PHASE information on remote DUT. This CL
adds PHASE as an argument for gooftool and hwid, so that we can
temporary override current PHASE in cros.factory.test.rules.phase
without reading / writing files to /var/factory/state/PHASE (since this
path might not be available).
BUG=chromium:557573
test=manual test
Change-Id: Icf6e616c95c950e4dd86953d915fdcde98625ea5
Reviewed-on: https://chromium-review.googlesource.com/339361
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index dc17490..bfd5b4a 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -45,6 +45,7 @@
from cros.factory.test import event_log
from cros.factory.test.env import paths
from cros.factory.test.factory import FACTORY_LOG_PATH
+from cros.factory.test.rules import phase
from cros.factory.test.rules.privacy import FilterDict
from cros.factory.utils import file_utils
from cros.factory.utils.debug_utils import SetupLogging
@@ -1031,11 +1032,16 @@
help='Write logs to this file.'),
CmdArg('--suppress-event-logs', action='store_true',
help='Suppress event logging.'),
+ CmdArg('--phase', default=None,
+ help=('override phase for phase checking (defaults to the current '
+ 'as returned by the "factory phase" command)')),
verbosity_cmd_arg)
SetupLogging(options.verbosity, options.log)
event_log.SetGlobalLoggerDefaultPrefix('gooftool')
event_log.GetGlobalLogger().suppress = options.suppress_event_logs
logging.debug('gooftool options: %s', repr(options))
+
+ phase.OverridePhase(options.phase)
try:
logging.debug('GOOFTOOL command %r', options.command_name)
options.command(options)