fix shellcheck failure detected by  CI

Found that failure at https://jenkins.openbmc.org/job/ci-repository/64626/console :

    Running shellcheck

    In tools/fan_rpm_loop_unittest.sh line 48:
    main "$@"
    ^-------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

    In tools/fan_rpm_loop_test.sh line 88:
    main "$@"
    ^-------^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).

    For more information:
      https://www.shellcheck.net/wiki/SC2317 -- Command appears to be unreachable...
    shellcheck: FAILED

Apply the trick in https://superuser.com/questions/731425/bash-detect-execute-vs-source-in-a-script
to detect execute vs sourve environment.

Change-Id: I6bea34c91c423e50101e397efb63c436c66e0587
Signed-off-by: Jinliang Wang <jinliangw@google.com>
diff --git a/tools/fan_rpm_loop_test.sh b/tools/fan_rpm_loop_test.sh
index 3d38ea6..5c56878 100755
--- a/tools/fan_rpm_loop_test.sh
+++ b/tools/fan_rpm_loop_test.sh
@@ -84,5 +84,7 @@
     RunRpmSteps "${max_rpm}" "${min_rpm}"  1 30
 }
 
-return 0 2>/dev/null
-main "$@"
+if [ "$0" = "${BASH_SOURCE[0]}" ]; then
+    # not sourced, execute main function
+    main "$@"
+fi