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