vboot2: Move vb2_verify_fw inside of futility

Update the unit tests which use it to use futility.  No functional
changes to it, just relocation.

Remove the futility test which checks the exact list of supported
commands.  This doesn't have a good way of handling
conditionally-compiled commands, and will be even harder to maintain
as we add more commands in the future.  Presence of sub-commands is
still ensured by the other tests which use them (such as
vb2_firmware_tests.sh)

BUG=chromium:231547
BRANCH=none
TEST=make runtests && VBOOT2=1 make runtests

Change-Id: Idddb639276e4c6449d023d40ac7977123113bd28
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/213191
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Randall Spangler
2014-08-19 14:42:08 -07:00
committed by chrome-internal-fetch
parent 31d95c2386
commit 028f468aff
4 changed files with 17 additions and 23 deletions

View File

@@ -490,11 +490,6 @@ UTIL_NAMES += \
utility/signature_digest_utility \
utility/verify_data
ifneq (${VBOOT2},)
UTIL_NAMES += \
utility/vb2_verify_fw
endif
endif
UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC})
@@ -550,6 +545,11 @@ FUTIL_SRCS = \
futility/cmd_vbutil_key.c \
futility/cmd_vbutil_keyblock.c
ifneq (${VBOOT2},)
FUTIL_SRCS += \
futility/cmd_vb2_verify_fw.c
endif
FUTIL_LDS = futility/futility.lds
FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o}

View File

@@ -11,6 +11,7 @@
#include "2sysincludes.h"
#include "2api.h"
#include "futility.h"
const char *progname = "vb2_verify_fw";
@@ -133,12 +134,18 @@ int hash_body(struct vb2_context *ctx)
return VB2_SUCCESS;
}
int main(int argc, char *argv[])
int do_vb2_verify_fw(int argc, char *argv[])
{
struct vb2_context ctx;
uint8_t workbuf[16384];
int rv;
progname = strrchr(argv[0], '/');
if (progname)
progname++;
else
progname = argv[0];
if (argc < 4) {
fprintf(stderr,
"usage: %s <gbb> <vblock> <body>\n", progname);
@@ -207,3 +214,6 @@ int main(int argc, char *argv[])
return 0;
}
DECLARE_FUTIL_COMMAND(vb2_verify_fw, do_vb2_verify_fw,
"Verifies firmware using vboot2 library");

View File

@@ -12,22 +12,6 @@ cd "$OUTDIR"
# No args returns nonzero exit code
"$FUTILITY" && false
# Make sure all built-in commands are listed and have help
expected=\
'dev_sign_file
dump_fmap
dump_kernel_config
gbb_utility
help
vbutil_firmware
vbutil_kernel
vbutil_key
vbutil_keyblock'
got=$("$FUTILITY" help |
egrep '^[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+' |
awk '{print $1}')
[ "$expected" = "$got" ]
# It's weird but okay if the command is a full path.
"$FUTILITY" /fake/path/to/help > "$TMP"
grep Usage "$TMP"

View File

@@ -52,6 +52,6 @@ ${BIN_DIR}/vbutil_firmware \
echo 'Verifying test firmware using vb2_verify_fw'
# Verify the firmware using vboot2 utility
${BIN_DIR}/vb2_verify_fw gbb.test vblock.test body.test
${BIN_DIR}/futility vb2_verify_fw gbb.test vblock.test body.test
happy 'vb2_verify_fw succeeded'