Skip to content
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
49 changes: 47 additions & 2 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
tests: [apogee_detect, error_int, fin_calib, flash_appa, flight, fsm_appa, launch_detect, main, prelaunch, sensor_calibrate]
tests: [state_transition, error_int, fin_calib, flash_appa, flight, fsm_appa, main, prelaunch, sensor_calibrate]
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
Expand Down Expand Up @@ -62,6 +62,51 @@ jobs:
- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.promote-results.outputs.artifact-id }}'
- run: echo "🍏 This job's status is ${{ job.status }}."

mod-unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
tests: [commands, debug_sdr, error_sdr, mahony, math_sdr, sensor, telemetry]
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }}."
- name: Install test environment
run: |
python -m pip install --upgrade pip
pip install gcovr
- name: Check out FCF repository code
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.fw-branch || github.ref }}
submodules: 'recursive'
- run: echo "💡 The repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}

- name: Build and run the appa/${{ matrix.tests }} tests
run: |
cd ${{ github.workspace }}/mod/_test/mod/${{ matrix.tests }}
make test
- name: Check for fails.
run: |
cd ${{ github.workspace }}/mod/_test/mod/${{ matrix.tests }}
tail -3 results.txt | grep "Result: PASS"
- name: Consolidate ${{ matrix.tests }} artifacts
run: mv ${{ github.workspace }}/mod/_test/mod/${{ matrix.tests }}/results.txt ${{ github.workspace }}/mod/_test/mod/${{ matrix.tests }}/coverage/results.txt
- name: "Promote Artifacts"
uses: actions/upload-artifact@v6
id: promote-results
with:
name: ${{ matrix.tests }}-artifacts
path: ${{ github.workspace }}/mod/_test/mod/${{ matrix.tests }}/coverage/
include-hidden-files: true
- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.promote-results.outputs.artifact-id }}'
- run: echo "🍏 This job's status is ${{ job.status }}."

driver-unit-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -207,7 +252,7 @@ jobs:
# Take coverage reports and merge them
consolidate-coverage:
runs-on: ubuntu-latest
needs: [app-unit-tests, driver-unit-tests, emulator-tests]
needs: [app-unit-tests, driver-unit-tests, mod-unit-tests, emulator-tests]
steps:
- name: Install gcovr
run: |
Expand Down
23 changes: 21 additions & 2 deletions app/rev2/flight.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ if ( *sensor_status != SENSOR_OK )
------------------------------------------------------------------------------*/
/* store in a local so that future improvements like a coast phase can use it */
fc_state = get_fc_state();
if ( ( fc_state == FC_STATE_ASCENT )
&& ( preset_data.config_settings.enabled_features & ACTIVE_ROLL_CONTROL_ENABLED ) )
if ( ( fc_state == FC_STATE_ASCENT
|| fc_state == FC_STATE_COAST )
&& ( preset_data.config_settings.enabled_features & ACTIVE_ROLL_CONTROL_ENABLED ) )
{
pid_loop();
}
Expand Down Expand Up @@ -515,11 +516,20 @@ switch( get_fc_state() )
case FC_STATE_LANDED: /* intentional fallthrough; not yet implemented */
/* no applicable transitions; do nothing */
break;
/**
* GCOVR_EXCL_START
*
* This branch is tested, but gcovr doesn't see these statements in
* release mode so it reports a coverage hole on the emulator.
*/
default:
#ifdef DEBUG /* for caution, throw error in debug mode only */
error_fail_fast( ERROR_INVALID_STATE_ERROR );
#endif
break;
/**
* GCOVR_EXCL_STOP
*/
}

} /* update_state */
Expand Down Expand Up @@ -557,10 +567,19 @@ switch( get_fc_state() )
led_set_color( LED_PURPLE );
}
break;
/**
* GCOVR_EXCL_START
*
* This branch is tested, but gcovr doesn't see these statements in
* release mode so it reports a coverage hole on the emulator.
*/
default:
#ifdef DEBUG /* for caution, throw error in debug mode only */
error_fail_fast( ERROR_INVALID_STATE_ERROR );
#endif
break;
/**
* GCOVR_EXCL_STOP
*/
}
} /* set_state_color */
8 changes: 7 additions & 1 deletion app/rev2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ if ( servo_status != SERVO_OK )
error_fail_fast( ERROR_SERVO_INIT_ERROR );
}

sensor_init( &preset_data );
/* Sensor */
sensor_status = sensor_init( &preset_data );
if ( sensor_status != SENSOR_OK )
{
error_fail_fast( ERROR_SENSOR_CMD_ERROR );
}


/*------------------------------------------------------------------------------
Expand Down Expand Up @@ -337,6 +342,7 @@ return -1;
* Handle debug console outputs. *
* *
*******************************************************************************/

static void debug_writer
(
void* msg,
Expand Down
93 changes: 0 additions & 93 deletions test/app/rev2/apogee_detect/mock/MOCK_hal.c

This file was deleted.

27 changes: 0 additions & 27 deletions test/app/rev2/apogee_detect/mock/test.h

This file was deleted.

Loading
Loading