diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-03-07 12:54:29 -0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-03-11 08:38:46 -0700 |
commit | feb2518166b1cd181e607c611cbb610f0c7300da (patch) | |
tree | 33a22857fad5a1f2246caf064b3b4eec8867e00f /futility/tests/run_futility_tests.sh | |
parent | 5fed2a667096341160db8643a4a057e328953a1d (diff) | |
download | vboot-feb2518166b1cd181e607c611cbb610f0c7300da.tar.gz |
Wrap all vboot utilities with futility.firmware-spring-3833.Bfactory-spring-3842.B
This moves all the old userspace utilities generated by vboot_reference into
a subdirectory not in $PATH, and replaces them with symlinks to a single
executable named 'futility'. At the moment that utility just execs the
original utilities (optionally logging that fact first).
Ultimately, the old utilities will be subsumed into a single binary instead
of multiple separate executables.
There is a matching CL needed to make the recovery image creation work.
BUG=chromium-os:37062
BRANCH=none
CQ-DEPEND=CL:44864
TEST=auto
To test, build everything, test everything. It should work as before in all
cases. I have built normal images, test images, factory installers, recovery
images; they all seem to work.
I've run trybots on daisy-paladin link-paladin lumpy-paladin and alex-paladin.
Change-Id: Ie93db676f2ed2a64e4b13b3b5dc6b65a77db0f8c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'futility/tests/run_futility_tests.sh')
-rwxr-xr-x | futility/tests/run_futility_tests.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/futility/tests/run_futility_tests.sh b/futility/tests/run_futility_tests.sh new file mode 100755 index 00000000..ff2de4be --- /dev/null +++ b/futility/tests/run_futility_tests.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Load common constants and variables. +. "$(dirname "$0")/common.sh" + +# Where are the programs I'm testing against? +[ -z "${1:-}" ] && error "Directory argument is required" +BINDIR="$1" +shift + +FUTILITY="$BINDIR/futility" +OLDDIR="$BINDIR/old_bins" + +BUILD=$(dirname "${BINDIR}") + +# Here are the old programs to be wrapped +# FIXME(chromium-os:37062): There are others besides these. +# FIXME: dev_debug_vboot isn't tested right now. +PROGS=${*:-cgpt crossystem dev_sign_file dumpRSAPublicKey + dump_fmap dump_kernel_config enable_dev_usb_boot gbb_utility + tpm_init_temp_fix tpmc vbutil_firmware vbutil_kernel vbutil_key + vbutil_keyblock vbutil_what_keys} + +# Get ready +pass=0 +progs=0 +pwd +OUTDIR="${BUILD}/tests/futility_test_dir" +[ -d "$OUTDIR" ] || mkdir -p "$OUTDIR" + +# For now just compare results of invoking each program with no args. +# FIXME(chromium-os:37062): Create true rigorous tests for every program. +for i in $PROGS; do + : $(( progs++ )) + + # Try the real thing first + echo -n "$i ... " + rc=$("${OLDDIR}/$i" \ + 1>"${OUTDIR}/$i.stdout.orig" 2>"${OUTDIR}/$i.stderr.orig" \ + || echo "$?") + echo "${rc:-0}" > "${OUTDIR}/$i.return.orig" + + # Then try the symlink + rc=$("$BINDIR/$i" 1>"${OUTDIR}/$i.stdout.link" \ + 2>"${OUTDIR}/$i.stderr.link" || echo "$?") + echo "${rc:-0}" > "${OUTDIR}/$i.return.link" + + # And finally try the explicit wrapper + rc=$("$FUTILITY" "$i" 1>"${OUTDIR}/$i.stdout.futil" \ + 2>"${OUTDIR}/$i.stderr.futil" || echo "$?") + echo "${rc:-0}" > "${OUTDIR}/$i.return.futil" + + # Different? + if cmp -s "${OUTDIR}/$i.return.orig" "${OUTDIR}/$i.return.link" && + cmp -s "${OUTDIR}/$i.stdout.orig" "${OUTDIR}/$i.stdout.link" && + cmp -s "${OUTDIR}/$i.stderr.orig" "${OUTDIR}/$i.stderr.link" && + cmp -s "${OUTDIR}/$i.return.orig" "${OUTDIR}/$i.return.futil" && + cmp -s "${OUTDIR}/$i.stdout.orig" "${OUTDIR}/$i.stdout.futil" && + cmp -s "${OUTDIR}/$i.stderr.orig" "${OUTDIR}/$i.stderr.futil" ; then + green "passed" + : $(( pass++ )) + rm -f ${OUTDIR}/$i.{stdout,stderr,return}.{orig,link,futil} + else + red "failed" + fi +done + +# done +if [ "$pass" -eq "$progs" ]; then + green "Success: $pass / $progs passed" + exit 0 +fi + +red "FAIL: $pass / $progs passed" +exit 1 |