source "${OET_PATH}/libs/locallibs/common_lib.sh"
function pre_test() {
LOG_INFO "Start environmental preparation."
DNF_INSTALL "python-bashate"
echo -e "#!/bin/bash\nif [ \$1 -eq 0 ]; then\n echo 'Hello'\nfi" > ./test_script.sh
LOG_INFO "End of environmental preparation!"
}
function run_test() {
LOG_INFO "Start to run test."
bashate ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command failed"
bashate -i E005 ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command with -i parameter failed"
bashate -w E006 ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command with -w parameter failed"
bashate -e E044 ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command with -e parameter failed"
bashate --max-line-length 80 ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command with --max-line-length parameter failed"
bashate -v ./test_script.sh
CHECK_RESULT $? 1 0 "bashate command with -v parameter failed"
bashate --version
CHECK_RESULT $? 0 0 "bashate command with --version parameter failed"
bashate -s ./test_script.sh
CHECK_RESULT $? 0 0 "bashate command with -s parameter failed"
LOG_INFO "End of the test."
}
function post_test() {
LOG_INFO "start environment cleanup."
DNF_REMOVE "python-bashate"
rm -f ./test_script.sh
LOG_INFO "End of environment cleanup!"
}
main "$@"