Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: tests/common.sh

Issue 5352005: Add 'prioritize' command to cgpt tool. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « firmware/version.c ('k') | tests/run_cgpt_tests.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Determine script directory. 7 # Determine script directory.
8 SCRIPT_DIR=$(dirname $(readlink -f "$0")) 8 SCRIPT_DIR=$(dirname $(readlink -f "$0"))
9 9
10 ROOT_DIR="$(dirname ${SCRIPT_DIR})" 10 ROOT_DIR="$(dirname ${SCRIPT_DIR})"
11 BUILD_DIR="${ROOT_DIR}/build" 11 BUILD_DIR="${ROOT_DIR}/build"
12 UTIL_DIR="${BUILD_DIR}/utility" 12 UTIL_DIR="${BUILD_DIR}/utility"
13 TEST_DIR="${BUILD_DIR}/tests" 13 TEST_DIR="${BUILD_DIR}/tests"
14 TESTKEY_DIR=${SCRIPT_DIR}/testkeys 14 TESTKEY_DIR=${SCRIPT_DIR}/testkeys
15 TESTCASE_DIR=${SCRIPT_DIR}/testcases 15 TESTCASE_DIR=${SCRIPT_DIR}/testcases
16 TESTKEY_SCRATCH_DIR=${TEST_DIR}/testkeys 16 TESTKEY_SCRATCH_DIR=${TEST_DIR}/testkeys
17 17
18 if [ ! -d ${TESTKEY_SCRATCH_DIR} ]; then 18 if [ ! -d ${TESTKEY_SCRATCH_DIR} ]; then
19 mkdir ${TESTKEY_SCRATCH_DIR} 19 mkdir ${TESTKEY_SCRATCH_DIR}
20 fi 20 fi
21 21
22 # Color output encodings. 22 # Color output encodings.
23 COL_RED='\E[31;1m' 23 COL_RED='\E[31;1m'
24 COL_GREEN='\E[32;1m' 24 COL_GREEN='\E[32;1m'
25 COL_YELLOW='\E[33;1m' 25 COL_YELLOW='\E[33;1m'
26 COL_BLUE='\E[34;1m' 26 COL_BLUE='\E[34;1m'
27 COL_STOP='\E[0;m' 27 COL_STOP='\E[0;m'
28 28
29 hash_algos=( sha1 sha256 sha512 ) 29 hash_algos=( sha1 sha256 sha512 )
30 key_lengths=( 1024 2048 4096 8192 ) 30 key_lengths=( 1024 2048 4096 8192 )
31 31
32 function happy { 32 function happy {
33 echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2 33 echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2
34 } 34 }
35 35
36 # args: [nested level [message]]
36 function warning { 37 function warning {
37 echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2 38 echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2
38 } 39 }
39 40
41 # args: [nested level [message]]
40 function error { 42 function error {
41 echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2 43 local lev=${1:-}
44 case "${1:-}" in
45 [0-9]*)
46 lev=$1
47 shift
48 ;;
49 *) lev=0
50 ;;
51 esac
52 local x=$(caller $lev)
53 local cline=${x%% *}
54 local cfunc=${x#* }
55 cfunc=${cfunc##*/}
56 local args="$*"
57 local spacer=${args:+: }
58 echo -e "${COL_RED}ERROR at ${cfunc}, line ${cline}${spacer}${args}" \
59 "${COL_STOP}" 1>&2
42 exit 1 60 exit 1
43 } 61 }
44 62
45 function check_test_keys { 63 function check_test_keys {
46 [ -d ${TESTKEY_DIR} ] || \ 64 [ -d ${TESTKEY_DIR} ] || \
47 error "You must run gen_test_keys.sh to generate test keys first." 65 error 1 "You must run gen_test_keys.sh to generate test keys first."
48 } 66 }
49 67
OLDNEW
« no previous file with comments | « firmware/version.c ('k') | tests/run_cgpt_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698