beautysh: re-format

beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh
files to have a consistent formatting.  Re-run the formatter on the
whole repository.

Change-Id: Ie7df79b3878cbbc3893ab66ce30ba73c2b200da5
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tools/fan_rpm_loop_test.sh b/tools/fan_rpm_loop_test.sh
index 1e966d6..3d38ea6 100755
--- a/tools/fan_rpm_loop_test.sh
+++ b/tools/fan_rpm_loop_test.sh
@@ -1,17 +1,17 @@
 #!/bin/bash
 
 # shim system-level operations to allow for unit testing
-MkDir()     { mkdir     "$@"; }
-Mv()        { mv        "$@"; }
-Sleep()     { sleep     "$@"; }
-SystemCtl() { systemctl "$@"; }
+function MkDir() { mkdir     "$@"; }
+function Mv() { mv        "$@"; }
+function Sleep() { sleep     "$@"; }
+function SystemCtl() { systemctl "$@"; }
 
 # Store commanded rpm as thermal set-point.
 #
 # Arg:
 #   rpm - rpm set-point.
-CommandRpm() {
-  printf '%d\n' "$1" > /etc/thermal.d/set-point
+function CommandRpm() {
+    printf '%d\n' "$1" > /etc/thermal.d/set-point
 }
 
 # Sweep or step rpm over range.
@@ -21,44 +21,44 @@
 #   stop_rpm: stop RPM value
 #   num_steps: number of control steps; i.e., not including start.
 #   dwell: dwell time at each point, in seconds
-RunRpmSteps() {
-  local -i start_rpm=$1
-  local -i stop_rpm=$2
-  local -i num_steps=$3
-  local -i dwell=$4
+function RunRpmSteps() {
+    local -i start_rpm=$1
+    local -i stop_rpm=$2
+    local -i num_steps=$3
+    local -i dwell=$4
 
-  # Rounding offset when dividing range into num_steps
-  local -i h=$((num_steps / 2))
+    # Rounding offset when dividing range into num_steps
+    local -i h=$((num_steps / 2))
 
-  # To avoid asymmetrical division behavior for negative numbers,
-  # rearrange negative slope to positive slope running backward;
-  # I.e., to run using loop variable p: {num_steps downto 0}.
-  local -i rpm0=$((start_rpm))
-  local -i range=$((stop_rpm - start_rpm))
-  local -i s=1
-  if ((range < 0)); then
-    ((rpm0 = stop_rpm))
-    ((range = -range))
-    ((s = -1))
-  fi
+    # To avoid asymmetrical division behavior for negative numbers,
+    # rearrange negative slope to positive slope running backward;
+    # I.e., to run using loop variable p: {num_steps downto 0}.
+    local -i rpm0=$((start_rpm))
+    local -i range=$((stop_rpm - start_rpm))
+    local -i s=1
+    if ((range < 0)); then
+        ((rpm0 = stop_rpm))
+        ((range = -range))
+        ((s = -1))
+    fi
 
-  echo "Running RPM from ${start_rpm} to ${stop_rpm} in ${num_steps} steps"
-  CommandRpm "${start_rpm}"
-  SystemCtl start phosphor-pid-control.service
-  Sleep 60
+    echo "Running RPM from ${start_rpm} to ${stop_rpm} in ${num_steps} steps"
+    CommandRpm "${start_rpm}"
+    SystemCtl start phosphor-pid-control.service
+    Sleep 60
 
-  local i
-  for ((i = 0; i <= num_steps; ++i)); do
-    local -i p=$((s < 0 ? num_steps - i : i))
-    local -i rpm=$((rpm0 + (range * p + h) / num_steps))
-    echo "Setting RPM to ${rpm} and sleep ${dwell} seconds"
-    CommandRpm "${rpm}"
-    Sleep "${dwell}"
-  done
+    local i
+    for ((i = 0; i <= num_steps; ++i)); do
+        local -i p=$((s < 0 ? num_steps - i : i))
+        local -i rpm=$((rpm0 + (range * p + h) / num_steps))
+        echo "Setting RPM to ${rpm} and sleep ${dwell} seconds"
+        CommandRpm "${rpm}"
+        Sleep "${dwell}"
+    done
 
-  SystemCtl stop phosphor-pid-control.service
-  Mv /tmp/swampd.log ~/"${start_rpm}_${stop_rpm}_${num_steps}_${dwell}.csv"
-  echo "Done!!"
+    SystemCtl stop phosphor-pid-control.service
+    Mv /tmp/swampd.log ~/"${start_rpm}_${stop_rpm}_${num_steps}_${dwell}.csv"
+    echo "Done!!"
 }
 
 # Sweep and step fans from min to max and max to min.
@@ -66,22 +66,22 @@
 # Args:
 #   min_rpm: min RPM for the platform
 #   max_rpm: max RPM for the platform
-main() {
-  local min_rpm=$1
-  local max_rpm=$2
+function main() {
+    local min_rpm=$1
+    local max_rpm=$2
 
-  if ((min_rpm < 1 || max_rpm < min_rpm)); then
-    echo "Invalid arguments. Usage: fan_rpm_loop_test.sh <MIN_RPM> <MAX_RPM>"
-    return 1
-  fi
+    if ((min_rpm < 1 || max_rpm < min_rpm)); then
+        echo "Invalid arguments. Usage: fan_rpm_loop_test.sh <MIN_RPM> <MAX_RPM>"
+        return 1
+    fi
 
-  MkDir -p /etc/thermal.d/
-  SystemCtl stop phosphor-pid-control.service
+    MkDir -p /etc/thermal.d/
+    SystemCtl stop phosphor-pid-control.service
 
-  RunRpmSteps "${min_rpm}" "${max_rpm}" 10 30
-  RunRpmSteps "${max_rpm}" "${min_rpm}" 10 30
-  RunRpmSteps "${min_rpm}" "${max_rpm}"  1 30
-  RunRpmSteps "${max_rpm}" "${min_rpm}"  1 30
+    RunRpmSteps "${min_rpm}" "${max_rpm}" 10 30
+    RunRpmSteps "${max_rpm}" "${min_rpm}" 10 30
+    RunRpmSteps "${min_rpm}" "${max_rpm}"  1 30
+    RunRpmSteps "${max_rpm}" "${min_rpm}"  1 30
 }
 
 return 0 2>/dev/null
diff --git a/tools/fan_rpm_loop_unittest.sh b/tools/fan_rpm_loop_unittest.sh
index d4a001e..7ecde8b 100755
--- a/tools/fan_rpm_loop_unittest.sh
+++ b/tools/fan_rpm_loop_unittest.sh
@@ -1,47 +1,47 @@
 #!/bin/bash
 
-SourceModule() {
-  # shellcheck source=tools/fan_rpm_loop_test.sh
-  . fan_rpm_loop_test.sh
+function SourceModule() {
+    # shellcheck source=tools/fan_rpm_loop_test.sh
+    . fan_rpm_loop_test.sh
 }
 
-SetupShims() {
-  MkDir()      { echo "MkDir      $*"; }
-  Mv()         { echo "Mv         $*"; }
-  Sleep()      { echo "Sleep      $*"; }
-  SystemCtl()  { echo "SystemCtl  $*"; }
-  CommandRpm() { echo "CommandRpm $*"; }
+function SetupShims() {
+    function MkDir() { echo "MkDir      $*"; }
+    function Mv() { echo "Mv         $*"; }
+    function Sleep() { echo "Sleep      $*"; }
+    function SystemCtl() { echo "SystemCtl  $*"; }
+    function CommandRpm() { echo "CommandRpm $*"; }
 }
 
-TestRunRpmStepsWorks() {
-  RunRpmSteps 1000 5000 3 30 || return
-  RunRpmSteps 5000 1000 3 30 || return
-  RunRpmSteps 1000 5000 1 30 || return
-  RunRpmSteps 5000 1000 1 30 || return
+function TestRunRpmStepsWorks() {
+    RunRpmSteps 1000 5000 3 30 || return
+    RunRpmSteps 5000 1000 3 30 || return
+    RunRpmSteps 1000 5000 1 30 || return
+    RunRpmSteps 5000 1000 1 30 || return
 }
 
-TestMainRejectsLowMinAndMax() {
-  if main 0 0; then
-    echo "main 0 0 not rejected?"
-    return 1
-  fi
-  if main 1 0; then
-    echo "main 1 0 not rejected?"
-    return 1
-  fi
+function TestMainRejectsLowMinAndMax() {
+    if main 0 0; then
+        echo "main 0 0 not rejected?"
+        return 1
+    fi
+    if main 1 0; then
+        echo "main 1 0 not rejected?"
+        return 1
+    fi
 }
 
-TestMainWorks() {
-  main 1000 5005 || return
+function TestMainWorks() {
+    main 1000 5005 || return
 }
 
-main() {
-  SourceModule                || return
-  SetupShims                  || return
-  TestRunRpmStepsWorks        || return
-  TestMainRejectsLowMinAndMax || return
-  TestMainWorks               || return
-  echo "All tests completed."
+function main() {
+    SourceModule                || return
+    SetupShims                  || return
+    TestRunRpmStepsWorks        || return
+    TestMainRejectsLowMinAndMax || return
+    TestMainWorks               || return
+    echo "All tests completed."
 }
 
 return 0 2>/dev/null