2020-06-16 14:39:50 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-06-16 15:25:41 -07:00
|
|
|
#
|
2022-01-18 05:30:11 -08:00
|
|
|
# this script is used by github actions
|
|
|
|
#
|
|
|
|
# TODO: this script validates that it has three arguments but then proceeds to use environment variables not arguments!
|
|
|
|
# TODO: clean this up!
|
2020-06-16 15:25:41 -07:00
|
|
|
#
|
|
|
|
|
2020-06-16 15:55:18 -07:00
|
|
|
if [ ! "$1" ] || [ ! "$2" ] || [ ! "$3" ]; then
|
2021-10-25 05:22:31 -07:00
|
|
|
echo "No SSH Secrets, not even generating coverage"
|
2020-06-16 15:55:18 -07:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2020-06-16 14:39:50 -07:00
|
|
|
rm -rf gcov_working_area
|
|
|
|
|
|
|
|
mkdir gcov_working_area
|
|
|
|
cd gcov_working_area
|
|
|
|
|
|
|
|
echo "Looking for source code"
|
|
|
|
find .. -name *.c* > source_files.txt
|
|
|
|
find ../../firmware/console/ -name *.c* >> source_files.txt
|
|
|
|
find ../../firmware/controllers/ -name *.c* >> source_files.txt
|
|
|
|
|
|
|
|
wc -l source_files.txt
|
|
|
|
|
|
|
|
xargs -L 1 -I {} cp {} . < source_files.txt
|
|
|
|
|
|
|
|
cp ../build/obj/* .
|
|
|
|
|
2020-11-19 18:32:14 -08:00
|
|
|
echo -e "\nGenerating rusEFI unit test coverage"
|
2020-06-16 14:39:50 -07:00
|
|
|
gcov *.c* > gcov.log 2>gcov.err
|
|
|
|
|
2020-11-19 18:32:14 -08:00
|
|
|
echo -e "\nCollecting rusEFI unit test coverage"
|
2020-06-16 14:39:50 -07:00
|
|
|
lcov --capture --directory . --output-file coverage.info
|
|
|
|
|
2020-11-19 18:32:14 -08:00
|
|
|
echo -e "\nGenerating rusEFI unit test HTML"
|
2020-06-16 14:39:50 -07:00
|
|
|
genhtml coverage.info --output-directory gcov
|
2020-11-19 18:32:14 -08:00
|
|
|
echo -e "\nGenerating rusEFI unit test HTML"
|
2020-06-16 14:39:50 -07:00
|
|
|
|
2020-11-19 18:32:14 -08:00
|
|
|
echo -e "\nUploading HTML"
|
2022-01-18 16:25:59 -08:00
|
|
|
tar -czf - -C gcov . | sshpass -p "$RUSEFI_SSH_PASS" ssh -o StrictHostKeyChecking=no "$RUSEFI_SSH_USER"@"$RUSEFI_SSH_SERVER" "tar -xzf - -C docs/unit_tests_coverage"
|
2020-11-19 18:57:18 -08:00
|
|
|
echo -e "\nHappy End."
|