summaryrefslogtreecommitdiff
path: root/tests/common.sh
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2010-11-29 14:24:51 -0800
committerBill Richardson <wfrichar@chromium.org>2010-11-29 14:24:51 -0800
commit3430b32667937a75c7a3afc83f8f7a601a8187f7 (patch)
treeaf0492bff6b8493080d0ae959baa015434c3e3a7 /tests/common.sh
parent5f500b19ba0cdc174a47a68e40f939a4ed69861c (diff)
downloadvboot-3430b32667937a75c7a3afc83f8f7a601a8187f7.tar.gz
Add 'prioritize' command to cgpt tool.
This lets us reorder the priority of all the kernel partitions with a single command, instead of a bunch of complicated and error-prone shell script logic. Change-Id: I21d39763ec5a748488d5319a987bcfe7c34ce4d0 BUG=chromium-os:9167 TEST=manual In the chroot, do this: cd ~/trunk/src/platform/vboot_reference make make runtests make clean Everything should pass. Review URL: http://codereview.chromium.org/5352005
Diffstat (limited to 'tests/common.sh')
-rwxr-xr-xtests/common.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/common.sh b/tests/common.sh
index cd7695f0..5145004b 100755
--- a/tests/common.sh
+++ b/tests/common.sh
@@ -27,23 +27,41 @@ COL_BLUE='\E[34;1m'
COL_STOP='\E[0;m'
hash_algos=( sha1 sha256 sha512 )
-key_lengths=( 1024 2048 4096 8192 )
+key_lengths=( 1024 2048 4096 8192 )
function happy {
echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2
}
+# args: [nested level [message]]
function warning {
echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2
}
+# args: [nested level [message]]
function error {
- echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2
+ local lev=${1:-}
+ case "${1:-}" in
+ [0-9]*)
+ lev=$1
+ shift
+ ;;
+ *) lev=0
+ ;;
+ esac
+ local x=$(caller $lev)
+ local cline=${x%% *}
+ local cfunc=${x#* }
+ cfunc=${cfunc##*/}
+ local args="$*"
+ local spacer=${args:+: }
+ echo -e "${COL_RED}ERROR at ${cfunc}, line ${cline}${spacer}${args}" \
+ "${COL_STOP}" 1>&2
exit 1
}
function check_test_keys {
[ -d ${TESTKEY_DIR} ] || \
- error "You must run gen_test_keys.sh to generate test keys first."
+ error 1 "You must run gen_test_keys.sh to generate test keys first."
}