blob: 7ecde8b6ad14f3773bd7a35ca7b07f95a22d47dc [file] [log] [blame]
Patrick Ventureca97c832018-07-25 08:48:49 -07001#!/bin/bash
2
Patrick Williams5897fcc2022-12-08 06:23:37 -06003function SourceModule() {
4 # shellcheck source=tools/fan_rpm_loop_test.sh
5 . fan_rpm_loop_test.sh
Patrick Ventureca97c832018-07-25 08:48:49 -07006}
7
Patrick Williams5897fcc2022-12-08 06:23:37 -06008function SetupShims() {
9 function MkDir() { echo "MkDir $*"; }
10 function Mv() { echo "Mv $*"; }
11 function Sleep() { echo "Sleep $*"; }
12 function SystemCtl() { echo "SystemCtl $*"; }
13 function CommandRpm() { echo "CommandRpm $*"; }
Patrick Ventureca97c832018-07-25 08:48:49 -070014}
15
Patrick Williams5897fcc2022-12-08 06:23:37 -060016function TestRunRpmStepsWorks() {
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
Patrick Ventureca97c832018-07-25 08:48:49 -070021}
22
Patrick Williams5897fcc2022-12-08 06:23:37 -060023function TestMainRejectsLowMinAndMax() {
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
Patrick Ventureca97c832018-07-25 08:48:49 -070032}
33
Patrick Williams5897fcc2022-12-08 06:23:37 -060034function TestMainWorks() {
35 main 1000 5005 || return
Patrick Ventureca97c832018-07-25 08:48:49 -070036}
37
Patrick Williams5897fcc2022-12-08 06:23:37 -060038function main() {
39 SourceModule || return
40 SetupShims || return
41 TestRunRpmStepsWorks || return
42 TestMainRejectsLowMinAndMax || return
43 TestMainWorks || return
44 echo "All tests completed."
Patrick Ventureca97c832018-07-25 08:48:49 -070045}
46
47return 0 2>/dev/null
48main "$@"
49