pack_firmware_funnctest.py: Convert to use 'dummy' flashrom drv
Once futility now uses flashrom in-process address space
it needs to be run with escalated privileges. This problem
was not detected before in the test as futility spawned
flashrom as a separate pid.
Therefore pass the alternative programmer 'dummy' to futility
that passes down to flashrom to allow for emulation over attempting
to use the host/internal programmer.
BUG=b:203715651
TEST=builds
Cq-Depend: chromium:3247853
Co-Author: Sam McNally <sammc@chromium.org>
Change-Id: I86729cd29658722c9d6f580a882ea12af282dfb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/firmware/+/3295109
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
diff --git a/functest/bin/flashrom b/functest/bin/flashrom
deleted file mode 100755
index 50c7908..0000000
--- a/functest/bin/flashrom
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-case "$1" in
- -r)
- cp -f "${FAKE_BIOS_BIN}" "${2}"
- ;;
- *)
- echo "Unsupported: $*"
- exit 1
-esac
diff --git a/pack_firmware_functest.py b/pack_firmware_functest.py
index f92d1f5..2abb94b 100755
--- a/pack_firmware_functest.py
+++ b/pack_firmware_functest.py
@@ -127,9 +127,9 @@
List of lines output from the script
"""
# These are used by our fake vpd/mosys programs (see functest/ directory).
- os.environ['FAKE_BIOS_BIN'] = os.path.join(self.indir, 'image.bin')
os.environ['FAKE_WHITELABEL_TAG'] = whitelabel_tag
os.environ['FAKE_MODEL'] = model
+ input_path = os.path.join(self.indir, 'image.bin')
new_path = ':'.join((os.path.join(self.basedir, 'functest/bin'),
os.environ.get('PATH')))
@@ -137,6 +137,8 @@
cmd += ['--mode', mode]
if mode == 'output':
cmd += ['--model', model, '--output_dir', self.outdir]
+ cmd += ['-p', 'dummy:emulate=VARIABLE_SIZE,image=%s,size=%d' % (
+ input_path, os.stat(input_path).st_size)]
cmd += ['--verbose', '--debug']
result = cros_build_lib.run(cmd, capture_output=True,
extra_env={'PATH': new_path},