-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5d1e36
commit 3e69073
Showing
14 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Unit Test | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
- name: esp-idf build | ||
uses: espressif/esp-idf-ci-action@v1 | ||
with: | ||
esp_idf_version: v5.4 | ||
target: esp32s3 | ||
command: GITHUB_ACTIONS="true" idf.py build | ||
path: 'test-ci' | ||
- name: Run tests and show result | ||
uses: bitaxeorg/esp32-qemu-test-action@main | ||
with: | ||
path: 'test-ci' | ||
- name: Inspect log | ||
run: cat report.xml | ||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v1 | ||
if: always() | ||
with: | ||
files: report.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This is the project CMakeLists.txt file for the test subproject | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# Include the components directory of the main application: | ||
# | ||
set(EXTRA_COMPONENT_DIRS "../components") | ||
|
||
# Set the components to include the tests for. | ||
# This can be overriden from CMake cache: | ||
# - when invoking CMake directly: cmake -D TEST_COMPONENTS="xxxxx" .. | ||
# - when using idf.py: idf.py -T xxxxx build | ||
# | ||
set(TEST_COMPONENTS "bm1397 stratum" CACHE STRING "List of components to test") | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
|
||
set(IDF_TARGET "esp32s3") | ||
|
||
idf_build_set_property(COMPILE_DEFINITIONS "-DCONFIG_ASIC_FREQUENCY=100" APPEND) | ||
|
||
project(unit_test_stratum) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
CODE_PATH="$1" | ||
. $IDF_PATH/export.sh | ||
cd test/build | ||
esptool.py --chip esp32s3 merge_bin --fill-flash-size 16MB -o flash_image.bin @flash_args | ||
/opt/qemu/bin/qemu-system-xtensa -nographic -no-reboot -machine esp32 -drive file=flash_image.bin,if=mtd,format=raw -serial file:output.log | ||
grep -q -E '[[:digit:]]+ Tests [[:digit:]]+ Failures [[:digit:]]+ Ignored' output.log && ruby /opt/Unity-*/auto/parse_output.rb -xml output.log || exit 1 | ||
mv report.xml /github/workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
idf_component_register(SRCS "unit_test_all.c" | ||
INCLUDE_DIRS ".") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include "unity.h" | ||
|
||
static void print_banner(const char *text); | ||
|
||
void app_main(void) | ||
{ | ||
print_banner("Running all the registered tests"); | ||
UNITY_BEGIN(); | ||
unity_run_tests_by_tag("[not-on-qemu]", true); | ||
UNITY_END(); | ||
|
||
// print_banner("Starting interactive test menu"); | ||
/* This function will not return, and will be busy waiting for UART input. | ||
* Make sure that task watchdog is disabled if you use this function. | ||
*/ | ||
// unity_run_menu(); | ||
|
||
exit(0); | ||
} | ||
|
||
static void print_banner(const char *text) | ||
{ | ||
printf("\n#### %s #####\n\n", text); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CONFIG_ESP_INT_WDT=n | ||
CONFIG_ESP_TASK_WDT=n | ||
CONFIG_MBEDTLS_HARDWARE_SHA=n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ void app_main(void) | |
static void print_banner(const char *text) | ||
{ | ||
printf("\n#### %s #####\n\n", text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
CONFIG_ESP_INT_WDT=n | ||
CONFIG_ESP_TASK_WDT=n | ||
CONFIG_ESP_TASK_WDT=n |