diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-08-19 14:42:08 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-25 20:52:44 +0000 |
commit | 028f468aff976ef5e76f20133c64ec19cb9d1517 (patch) | |
tree | 7e0308ea39cbe62d5c9ad9d88d7c99976086c9b5 | |
parent | 31d95c2386df8d3d5ec619a077960645d052fa38 (diff) | |
download | vboot-028f468aff976ef5e76f20133c64ec19cb9d1517.tar.gz |
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>
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | futility/cmd_vb2_verify_fw.c (renamed from utility/vb2_verify_fw.c) | 12 | ||||
-rwxr-xr-x | tests/futility/test_main.sh | 16 | ||||
-rwxr-xr-x | tests/vb2_firmware_tests.sh | 2 |
4 files changed, 17 insertions, 23 deletions
@@ -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} diff --git a/utility/vb2_verify_fw.c b/futility/cmd_vb2_verify_fw.c index f7ec0b50..7343d7a4 100644 --- a/utility/vb2_verify_fw.c +++ b/futility/cmd_vb2_verify_fw.c @@ -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"); diff --git a/tests/futility/test_main.sh b/tests/futility/test_main.sh index 62177e68..5a09c282 100755 --- a/tests/futility/test_main.sh +++ b/tests/futility/test_main.sh @@ -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" diff --git a/tests/vb2_firmware_tests.sh b/tests/vb2_firmware_tests.sh index a32dc6d8..e1981dba 100755 --- a/tests/vb2_firmware_tests.sh +++ b/tests/vb2_firmware_tests.sh @@ -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' |