OLD | NEW |
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 if [[ $0 == '/'* ]]; | 8 if [[ $0 == '/'* ]]; |
9 then | 9 then |
10 SCRIPT_DIR="`dirname $0`" | 10 SCRIPT_DIR="`dirname $0`" |
11 elif [[ $0 == './'* ]]; | 11 elif [[ $0 == './'* ]]; |
12 then | 12 then |
13 SCRIPT_DIR="`pwd`" | 13 SCRIPT_DIR="`pwd`" |
14 else | 14 else |
15 SCRIPT_DIR="`pwd`"/"`dirname $0`" | 15 SCRIPT_DIR="`pwd`"/"`dirname $0`" |
16 fi | 16 fi |
17 | 17 |
18 UTIL_DIR=`dirname ${SCRIPT_DIR}`/utility | 18 ROOT_DIR="$(dirname ${SCRIPT_DIR})" |
19 TEST_DIR=${SCRIPT_DIR} | 19 BUILD_DIR="${ROOT_DIR}/build" |
| 20 UTIL_DIR="${BUILD_DIR}/utility" |
| 21 TEST_DIR="${BUILD_DIR}/tests" |
20 TESTKEY_DIR=${SCRIPT_DIR}/testkeys | 22 TESTKEY_DIR=${SCRIPT_DIR}/testkeys |
21 TESTCASE_DIR=${SCRIPT_DIR}/testcases | 23 TESTCASE_DIR=${SCRIPT_DIR}/testcases |
| 24 TESTKEY_SCRATCH_DIR=${TEST_DIR}/testkeys |
| 25 |
| 26 if [ ! -d ${TESTKEY_SCRATCH_DIR} ]; then |
| 27 mkdir ${TESTKEY_SCRATCH_DIR} |
| 28 fi |
22 | 29 |
23 # Color output encodings. | 30 # Color output encodings. |
24 COL_RED='\E[31;1m' | 31 COL_RED='\E[31;1m' |
25 COL_GREEN='\E[32;1m' | 32 COL_GREEN='\E[32;1m' |
26 COL_YELLOW='\E[33;1m' | 33 COL_YELLOW='\E[33;1m' |
27 COL_BLUE='\E[34;1m' | 34 COL_BLUE='\E[34;1m' |
28 COL_STOP='\E[0;m' | 35 COL_STOP='\E[0;m' |
29 | 36 |
30 hash_algos=( sha1 sha256 sha512 ) | 37 hash_algos=( sha1 sha256 sha512 ) |
31 key_lengths=( 1024 2048 4096 8192 ) | 38 key_lengths=( 1024 2048 4096 8192 ) |
32 | 39 |
33 function happy { | 40 function happy { |
34 echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2 | 41 echo -e "${COL_GREEN}$*${COL_STOP}" 1>&2 |
35 } | 42 } |
36 | 43 |
37 function warning { | 44 function warning { |
38 echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2 | 45 echo -e "${COL_YELLOW}WARNING: $*${COL_STOP}" 1>&2 |
39 } | 46 } |
40 | 47 |
41 function error { | 48 function error { |
42 echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2 | 49 echo -e "${COL_RED}ERROR: $*${COL_STOP}" 1>&2 |
43 exit 1 | 50 exit 1 |
44 } | 51 } |
45 | 52 |
46 function check_test_keys { | 53 function check_test_keys { |
47 [ -d ${TESTKEY_DIR} ] || \ | 54 [ -d ${TESTKEY_DIR} ] || \ |
48 error "You must run gen_test_keys.sh to generate test keys first." | 55 error "You must run gen_test_keys.sh to generate test keys first." |
49 } | 56 } |
50 | 57 |
OLD | NEW |