mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-24 23:26:50 +00:00
8a3478c19e
* Added Rim test workflow * bug fixes * added rim tool setup * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * updates to rim_tests.yml * updates to rim_tests.yml * updates to rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * Update rim_tests.yml * added run all script * added run all script * updates to rim_tests.yml * Updates to paths in composite_rim_create_pass.sh * Added all passing rim tests * updates to rim_tests.yml * switched to gradle-build-action@v3 * switched to setup-gradle@v3 * switched to setup-java@v4 * updates to rim_tests.yml * testing failed script * fixed failed test * testing artifacts * updates to rim_tests.yml * Update rim_tests.yml * updates to rim_tests.yml * changes to rim_tests.yml * testing log file * testing log file * testing log files * testing log files * testing log file * testing log file * testing log file * testing log file * testing log file * Update rim_tests.yml * verbose run * updated paths and references * updates to README.md * deleted rim docker testing directory
89 lines
2.0 KiB
Bash
Executable File
89 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# This script will run all the tests in rim/scrips directory. it will ignore specified files.
|
|
# counters that will provide information about the script status.
|
|
testsFailed=0
|
|
testsPassed=0
|
|
testsRan=0
|
|
# Capture location of this script to allow from invocation from any location
|
|
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
|
|
# go to the script directory so everything runs smoothly ...
|
|
pushd $scriptDir > /dev/null
|
|
|
|
|
|
# adding the verbose option.
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
'-v'|'--verbose')
|
|
ARG_VERBOSE=YES
|
|
echo "verbose parameters"
|
|
shift # past argument
|
|
;;
|
|
'-*'|'--*')
|
|
echo "Unknown option $1"
|
|
exit 1
|
|
;;
|
|
*)
|
|
echo "Unknown argument $1"
|
|
exit 1
|
|
shift # past argument
|
|
;;
|
|
esac
|
|
done
|
|
|
|
#List of files in the scripts directory to ignore.
|
|
exclude=("run_all_tests.sh" "rim_functions.sh")
|
|
|
|
#loop through the test/rim/scripts directory
|
|
for script in *.sh; do
|
|
#ignoring specified (non test) files.
|
|
if [[ ! "${exclude[*]}" =~ $script ]]; then
|
|
((testsRan++))
|
|
echo ""
|
|
echo "----------------"
|
|
echo "RUNNING $script"
|
|
|
|
if [ -n "$ARG_VERBOSE" ]; then
|
|
./"$script"
|
|
else
|
|
./"$script" >/dev/null
|
|
fi
|
|
|
|
#checking the exit stats of the script (test).
|
|
if [ $? -eq 0 ];then
|
|
if [ -z "$ARG_VERBOSE" ]; then
|
|
echo "PASSED $script"
|
|
fi
|
|
echo "----------------"
|
|
((testsPassed++))
|
|
else
|
|
if [ -z "$ARG_VERBOSE" ]; then
|
|
echo -e "\033[31mFAILED $script\033[0m"
|
|
fi
|
|
echo "----------------"
|
|
((testsFailed++))
|
|
fi
|
|
else
|
|
echo ""
|
|
echo "----------------"
|
|
echo "skipping $script"
|
|
echo "----------------"
|
|
fi
|
|
|
|
done
|
|
|
|
#return to whatever directory you started at
|
|
popd > /dev/null
|
|
|
|
#test results
|
|
echo ""
|
|
echo "**** Test Results *****"
|
|
echo "Number of tests ran = $testsRan"
|
|
echo "Number of tests passed = $testsPassed"
|
|
echo "Number of tests failed = $testsFailed"
|
|
|
|
#tests status
|
|
if [ "$testsFailed" -eq 0 ]; then
|
|
exit 0
|
|
else
|
|
exit 1
|
|
fi |