diff options
author | Gaurav Shah <gauravsh@chromium.org> | 2010-03-19 16:19:09 -0700 |
---|---|---|
committer | Gaurav Shah <gauravsh@chromium.org> | 2010-03-19 16:19:09 -0700 |
commit | 445925fe0f11280c585879247eada43de32090ca (patch) | |
tree | 99038ddd0545394f0f473080e363a7d903839a00 /tests/common.sh | |
parent | 528a2c113e76b795ec907b4c3412ef3ef1630783 (diff) | |
download | vboot-445925fe0f11280c585879247eada43de32090ca.tar.gz |
Vboot Reference: Spring cleaning of test scripts.
Moved duplicated code to "common.sh". Make directory detection more robust.
Review URL: http://codereview.chromium.org/1101004
Diffstat (limited to 'tests/common.sh')
-rwxr-xr-x | tests/common.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/common.sh b/tests/common.sh new file mode 100755 index 00000000..82fdb850 --- /dev/null +++ b/tests/common.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Copyright (c) 2010 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. + +# Determine script directory. +if [[ $0 == '/'* ]]; +then + SCRIPT_DIR="`dirname $0`" +elif [[ $0 == './'* ]]; +then + SCRIPT_DIR="`pwd`" +else + SCRIPT_DIR="`pwd`"/"`dirname $0`" +fi + +UTIL_DIR=`dirname ${SCRIPT_DIR}`/utils +TEST_DIR=${SCRIPT_DIR} +TESTKEY_DIR=${SCRIPT_DIR}/testkeys +TESTCASE_DIR=${SCRIPT_DIR}/testcases + +# Color output encodings. +COL_RED='\E[31;1m' +COL_GREEN='\E[32;1m' +COL_YELLOW='\E[33;1m' +COL_BLUE='\E[34;1m' +COL_STOP='\E[0;m' + +hash_algos=( sha1 sha256 sha512 ) +key_lengths=( 1024 2048 4096 8192 ) + +function check_test_keys { + if [ ! -d ${TESTKEY_DIR} ] + then + echo "You must run gen_test_keys.sh to generate test keys first." + exit 1 + fi +} |