Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions: unit_test and updater timeouts #2807

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ jobs:
- name: 'Flash unit tests firmware'
id: flashing
if: success()
timeout-minutes: 5
run: |
./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1

- name: 'Wait for flipper and format ext'
id: format_ext
if: steps.flashing.outcome == 'success'
timeout-minutes: 5
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
Expand All @@ -43,6 +45,7 @@ jobs:
- name: 'Copy assets and unit data, reboot and wait for flipper'
id: copy
if: steps.format_ext.outcome == 'success'
timeout-minutes: 3
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/resources /ext
Expand All @@ -53,7 +56,7 @@ jobs:
- name: 'Run units and validate results'
id: run_units
if: steps.copy.outcome == 'success'
timeout-minutes: 2.5
timeout-minutes: 5
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/units.py ${{steps.device.outputs.flipper}}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/updater_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ jobs:

- name: 'Flashing target firmware'
id: first_full_flash
timeout-minutes: 5
run: |
source scripts/toolchain/fbtenv.sh
./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}

- name: 'Validating updater'
id: second_full_flash
timeout-minutes: 5
if: success()
run: |
source scripts/toolchain/fbtenv.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TUPLE_DEF2(
M_DEFAULT_OPLIST)

/* Define the array, register the oplist and define further algorithms on it */
ARRAY_DEF(SubGhzFrequencyAnalyzerLogItemArray, SubGhzFrequencyAnalyzerLogItem_t)
ARRAY_DEF(SubGhzFrequencyAnalyzerLogItemArray, SubGhzFrequencyAnalyzerLogItem_t) //-V779
#define M_OPL_SubGhzFrequencyAnalyzerLogItemArray_t() \
ARRAY_OPLIST(SubGhzFrequencyAnalyzerLogItemArray, M_OPL_SubGhzFrequencyAnalyzerLogItem_t())
ALGO_DEF(SubGhzFrequencyAnalyzerLogItemArray, SubGhzFrequencyAnalyzerLogItemArray_t)
Expand Down
5 changes: 4 additions & 1 deletion scripts/testing/await_flipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
def flp_serial_by_name(flp_name):
if sys.platform == "darwin": # MacOS
flp_serial = "/dev/cu.usbmodemflip_" + flp_name + "1"
logging.info(f"Darwin, looking for {flp_serial}")
elif sys.platform == "linux": # Linux
flp_serial = (
"/dev/serial/by-id/usb-Flipper_Devices_Inc._Flipper_"
Expand All @@ -16,10 +17,12 @@ def flp_serial_by_name(flp_name):
+ flp_name
+ "-if00"
)
logging.info(f"linux, looking for {flp_serial}")

if os.path.exists(flp_serial):
return flp_serial
else:
logging.info(f"Couldn't find {logging.info} on this attempt.")
if os.path.exists(flp_name):
return flp_name
else:
Expand All @@ -38,7 +41,7 @@ def main():
level=logging.INFO,
datefmt="%Y-%m-%d %H:%M:%S",
)
logging.info("Waiting for Flipper to be ready...")
logging.info(f"Waiting for Flipper {flipper_name} to be ready...")

while flipper == "" and elapsed < UPDATE_TIMEOUT:
elapsed += 1
Expand Down
4 changes: 2 additions & 2 deletions scripts/testing/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def main():
logging.error("Flipper not found!")
sys.exit(1)

with serial.Serial(flp_serial, timeout=1) as flipper:
with serial.Serial(flp_serial, timeout=10) as flipper:
logging.info(f"Found Flipper at {flp_serial}")
flipper.baudrate = 230400
flipper.flushOutput()
flipper.flushInput()

flipper.timeout = 180
flipper.timeout = 300

flipper.read_until(b">: ").decode("utf-8")
flipper.write(b"unit_tests\r")
Expand Down