Gaurav Shah | 445925f | 2010-03-19 16:19:09 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 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 |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | # Determine script directory. |
Bill Richardson | 793e1b4 | 2010-08-20 07:58:43 -0700 | [diff] [blame] | 8 | SCRIPT_DIR=$(dirname $(readlink -f "$0")) |
Gaurav Shah | 445925f | 2010-03-19 16:19:09 -0700 | [diff] [blame] | 9 | |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 10 | ROOT_DIR="$(dirname ${SCRIPT_DIR})" |
| 11 | BUILD_DIR="${ROOT_DIR}/build" |
| 12 | UTIL_DIR="${BUILD_DIR}/utility" |
| 13 | TEST_DIR="${BUILD_DIR}/tests" |
Gaurav Shah | 445925f | 2010-03-19 16:19:09 -0700 | [diff] [blame] | 14 | TESTKEY_DIR=${SCRIPT_DIR}/testkeys |
| 15 | TESTCASE_DIR=${SCRIPT_DIR}/testcases |
vbendeb | 70e9509 | 2010-06-14 15:41:27 -0700 | [diff] [blame] | 16 | TESTKEY_SCRATCH_DIR=${TEST_DIR}/testkeys |
| 17 | |
| 18 | if [ ! -d ${TESTKEY_SCRATCH_DIR} ]; then |
| 19 | mkdir ${TESTKEY_SCRATCH_DIR} |
| 20 | fi |
Gaurav Shah | 445925f | 2010-03-19 16:19:09 -0700 | [diff] [blame] | 21 | |
| 22 | # Color output encodings. |
| 23 | COL_RED='\E[31;1m' |
| 24 | COL_GREEN='\E[32;1m' |
| 25 | COL_YELLOW='\E[33;1m' |
| 26 | COL_BLUE='\E[34;1m' |
| 27 | COL_STOP='\E[0;m' |
| 28 | |
| 29 | hash_algos=( sha1 sha256 sha512 ) |
| 30 | key_lengths=( 1024 2048 4096 8192 ) |
| 31 | |
Bill Richardson | f1372d9 | 2010-06-11 09:15:55 -0700 | [diff] [blame] | 32 | function happy { |
| 33 | echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2 |
Gaurav Shah | 445925f | 2010-03-19 16:19:09 -0700 | [diff] [blame] | 34 | } |
Bill Richardson | f1372d9 | 2010-06-11 09:15:55 -0700 | [diff] [blame] | 35 | |
| 36 | function warning { |
| 37 | echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2 |
| 38 | } |
| 39 | |
| 40 | function error { |
| 41 | echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2 |
| 42 | exit 1 |
| 43 | } |
| 44 | |
| 45 | function check_test_keys { |
| 46 | [ -d ${TESTKEY_DIR} ] || \ |
| 47 | error "You must run gen_test_keys.sh to generate test keys first." |
| 48 | } |
| 49 | |