1#!/bin/bash 2 3SourceModule() { 4 # shellcheck source=tools/fan_rpm_loop_test.sh 5 . fan_rpm_loop_test.sh 6} 7 8SetupShims() { 9 MkDir() { echo "MkDir $*"; } 10 Mv() { echo "Mv $*"; } 11 Sleep() { echo "Sleep $*"; } 12 SystemCtl() { echo "SystemCtl $*"; } 13 CommandRpm() { echo "CommandRpm $*"; } 14} 15 16TestRunRpmStepsWorks() { 17 RunRpmSteps 1000 5000 3 30 || return 18 RunRpmSteps 5000 1000 3 30 || return 19 RunRpmSteps 1000 5000 1 30 || return 20 RunRpmSteps 5000 1000 1 30 || return 21} 22 23TestMainRejectsLowMinAndMax() { 24 if main 0 0; then 25 echo "main 0 0 not rejected?" 26 return 1 27 fi 28 if main 1 0; then 29 echo "main 1 0 not rejected?" 30 return 1 31 fi 32} 33 34TestMainWorks() { 35 main 1000 5005 || return 36} 37 38main() { 39 SourceModule || return 40 SetupShims || return 41 TestRunRpmStepsWorks || return 42 TestMainRejectsLowMinAndMax || return 43 TestMainWorks || return 44 echo "All tests completed." 45} 46 47return 0 2>/dev/null 48main "$@" 49 50