fix up function style
The "function" keyword is superfluous, not in POSIX, is inconsistent
between bash files, and generally makes me angry. So convert every
instance to the form:
foo() {
BUG=None
TEST=`cbuildbot x86-generic-paladin` works
TEST=`bash -n cros_gestures/setup_cros_gestures.sh` works
TEST=`bash -n cros_run_unit_tests` works
TEST=`cros_run_unit_tests --help` works
TEST=`bash -n run_remote_tests.sh` works
TEST=`run_remote_tests.sh --help` works
Change-Id: Ib4ea9c6a71658f64366522550a640232c4fb6826
Reviewed-on: https://gerrit.chromium.org/gerrit/22469
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/cros_gestures/setup_cros_gestures.sh b/cros_gestures/setup_cros_gestures.sh
index 2cc8d38..6c4fd4f 100755
--- a/cros_gestures/setup_cros_gestures.sh
+++ b/cros_gestures/setup_cros_gestures.sh
@@ -14,7 +14,7 @@
"${SRC_BASE}/src/third_party/autotest-private/cros_gestures_boto"
declare AUTOTEST_SRC="${SRC_BASE}/src/third_party/autotest/files"
-function check_and_set_var() {
+check_and_set_var() {
local var_name=$1
local var_value=$2
local dir_or_file=$3
@@ -26,7 +26,7 @@
fi
}
-function clear_vars() {
+clear_vars() {
for v in BOTO_CONFIG BOTO_VALIDATE_CONFIG GSUTIL_BIN_DIR TRACKPAD_TEST_DIR
do
unset $v
diff --git a/cros_run_unit_tests b/cros_run_unit_tests
index fd95d43..a69c768 100755
--- a/cros_run_unit_tests
+++ b/cros_run_unit_tests
@@ -34,7 +34,7 @@
# List of packages with no unit tests.
NO_UNITTESTS=""
-function check_src_test() {
+check_src_test() {
egrep '^src_test()' "${1}" > /dev/null
}
diff --git a/run_remote_tests.sh b/run_remote_tests.sh
index 8c4fefe..1b47f1a 100755
--- a/run_remote_tests.sh
+++ b/run_remote_tests.sh
@@ -45,7 +45,7 @@
RAN_ANY_TESTS=${FLAGS_FALSE}
-function stop_ssh_agent() {
+stop_ssh_agent() {
# Call this function from the exit trap of the main script.
# Iff we started ssh-agent, be nice and clean it up.
# Note, only works if called from the main script - no subshells.
@@ -55,7 +55,7 @@
fi
}
-function start_ssh_agent() {
+start_ssh_agent() {
local tmp_private_key=$TMP/autotest_key
if [ -z "$SSH_AGENT_PID" ]; then
eval $(ssh-agent)
@@ -68,7 +68,7 @@
ssh-add $tmp_private_key
}
-function cleanup() {
+cleanup() {
# Always remove the build path in case it was used.
[[ -n "${BUILD_DIR}" ]] && sudo rm -rf "${BUILD_DIR}"
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \
@@ -87,7 +87,7 @@
# either "server" or "client".
# Arguments:
# $1 - control file path
-function read_test_type() {
+read_test_type() {
local control_file=$1
# Assume a line starts with TEST_TYPE =
local test_type=$(egrep -m1 \
@@ -102,7 +102,7 @@
echo ${test_type}
}
-function create_tmp() {
+create_tmp() {
# Set global TMP for remote_access.sh's sake
# and if --results_dir_root is specified,
# set TMP and create dir appropriately
@@ -114,7 +114,7 @@
fi
}
-function prepare_build_env() {
+prepare_build_env() {
info "Pilfering toolchain shell environment from Portage."
local ebuild_dir="${TMP}/chromeos-base/autotest-build"
mkdir -p "${ebuild_dir}"
@@ -131,7 +131,7 @@
export BUILD_ENV="${P_tmp}/${E_dir}/temp/environment"
}
-function autodetect_build() {
+autodetect_build() {
if [ ${FLAGS_use_emerged} -eq ${FLAGS_TRUE} ]; then
AUTOTEST_DIR="/build/${FLAGS_board}/usr/local/autotest"
FLAGS_build=${FLAGS_FALSE}
@@ -182,7 +182,7 @@
}
# Convert potentially relative control file path to an absolute path.
-function normalize_control_path() {
+normalize_control_path() {
local control_file=$(remove_quotes "$1")
if [[ ${control_file:0:1} == "/" ]]; then
echo "${control_file}"
@@ -192,7 +192,7 @@
}
# Generate a control file which has a profiler enabled.
-function generate_profiled_control_file() {
+generate_profiled_control_file() {
local control_file_path="$1"
local results_dir="$2"
@@ -214,7 +214,7 @@
# Given a control_type (client or server) and a list of control files, assembles
# them all into a single control file. Useful for reducing repeated packaging
# between tests sharing the same resources.
-function generate_combined_control_file() {
+generate_combined_control_file() {
local control_type="$1"
shift
local control_files="$@"
@@ -251,7 +251,7 @@
# Given a list of control files, returns "client", "server", or "" respectively
# if there are only client, only server, or both types of control files.
-function check_control_file_types() {
+check_control_file_types() {
# Check to make sure only client or only server control files have been
# requested, otherwise fall back to uncombined execution.
local client_controls=${FLAGS_FALSE}
@@ -279,7 +279,7 @@
}
-function main() {
+main() {
cd "${SCRIPTS_DIR}"
FLAGS "$@" || exit 1