CI can protect us from loss of precision (#424)

This commit is contained in:
Matthew Kennedy 2024-05-11 15:59:07 -07:00 committed by GitHub
parent 8c8d18e435
commit 0097eb583b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -303,6 +303,10 @@ jobs:
- name: Build Firmware
run: bash misc/jenkins/compile_other_versions/compile.sh ${{matrix.folder}} ${{matrix.build-target}}
- name: Check for illegal time conversions
working-directory: ./firmware/
run: bash check_illegal_conversion.sh
# Build rusEFI console
- name: Build console
if: ${{ env.full == 'true' }}

View File

@ -0,0 +1,16 @@
#!/usr/bin/bash
# Trying to convert float -> long suggests you're probably trying to compute a
# time period in float, then add it to a timestamp to get some time in the future.
# If you do this naively, it'll try and do
# float offset;
# int64_t stamp;
# int64_t result = (int64_t)((float)stamp + offset);
# The resulting loss of precision is unacceptable.
set -euo pipefail
if grep "bl.*<__aeabi_f2lz>" build/fome.list; then
echo "Illegal float-to-long conversion detected!"
exit 1
fi