Skip to content

Commit

Permalink
Merge pull request #2405 from lf-lang/zephyr-tests
Browse files Browse the repository at this point in the history
Re-enable Zephyr CI tests and move to v3.7.0
  • Loading branch information
lhstrh authored Sep 22, 2024
2 parents 0fdf0cb + f1616d8 commit 3d8cfd6
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 49 deletions.
19 changes: 4 additions & 15 deletions .github/actions/setup-flexpret/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,12 @@ runs:
git clone --recurse-submodules https://github.com/pretis/flexpret
# This rest is copied directly from FlexPRET's `azure-pipelines.yml`
# Ubuntu 20.04 only has Verilator 4.028 but we neeed a more modern version
# so we do not use 'sudo apt-get install -y -qq verilator' here.
wget -q https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb -O verilator.deb
sudo dpkg -i verilator.deb
sudo apt install verilator
# Install riscv compiler
wget https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-4.0.0/riscv32-unknown-elf.gcc-12.1.0.tar.gz
sudo mkdir /opt/riscv
sudo tar -xzf riscv32-unknown-elf.gcc-12.1.0.tar.gz -C /opt/riscv/
rm riscv32-unknown-elf.gcc-12.1.0.tar.gz
# Update submodules
git submodule update --init --recursive
# Save location of RISC-V compiler to reuse later
echo "FP_RISCV_COMPILER=/opt/riscv" >> "$GITHUB_ENV"
wget -q --show-progress https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-linux-x64.tar.gz -O gcc.tar.gz
tar xvf gcc.tar.gz --directory=/opt
echo "RISCV_TOOL_PATH_PREFIX=/opt/xpack-riscv-none-elf-gcc-14.2.0-2" >> $GITHUB_ENV
shell: bash
- name: Build FlexPRET and install to SDK
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-zephyr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
steps:
- name: Setup environment variables
run: |
echo "SDK_VERSION=0.16.3" >> $GITHUB_ENV
echo "SDK_VERSION=0.16.8" >> $GITHUB_ENV
shell: bash
- name: Dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/run-zephyr-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Skip
skip=("FileReader" "FilePkgReader")
skip=("FileReader" "FilePkgReader" "AsyncCallback" "AsyncCallbackDrop" "AsyncCallbackReplace")

find_kconfig_folders() {
if [ -f "$folder/CMakeLists.txt" ]; then
Expand Down Expand Up @@ -45,7 +45,7 @@ run_qemu_zephyr_test() {
pid=$!
return_val=2
wait_count=0
timeout=60
timeout=120
# Parse the file and match on known outputs. With timeout.
while [ "$wait_count" -le "$timeout" ]; do
sleep 1
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/c-flexpret-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- name: Run FlexPRET smoke tests
run: |
cd "$FP_DIR" && source env.bash && cd -
export RISCV_TOOL_PATH_PREFIX=$FP_RISCV_COMPILER
./gradlew core:integrationTest \
--tests org.lflang.tests.runtime.CFlexPRETTest.* \
core:integrationTestCodeCoverageReport
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/c-zephyr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ jobs:
path: core/src/main/resources/lib/c/reactor-c
ref: ${{ inputs.runtime-ref }}
if: ${{ inputs.runtime-ref }}
# - name: Run Zephyr smoke tests
# run: |
# ./gradlew core:integrationTest \
# --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrUnthreaded* \
# --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrThreaded* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run basic tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildBasic* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run concurrent tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildConcurrent* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run Zephyr board tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrBoards* core:integrationTestCodeCoverageReport
# rm -rf test/C/src-gen
- name: Run Zephyr smoke tests
run: |
./gradlew core:integrationTest \
--tests org.lflang.tests.runtime.CZephyrTest.buildZephyrUnthreaded* \
--tests org.lflang.tests.runtime.CZephyrTest.buildZephyrThreaded* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run basic tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildBasic* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run concurrent tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildConcurrent* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run Zephyr board tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrBoards* core:integrationTestCodeCoverageReport
rm -rf test/C/src-gen
- name: Smoke test of lf-west-template
run: |
export LFC=$(pwd)/bin/lfc-dev
Expand All @@ -68,8 +68,8 @@ jobs:
west lfc apps/NrfBlinky/src/NrfBlinky.lf --lfc $LFC --build "-p always"
west lfc apps/NrfBlinky/src/NrfToggleGPIO.lf --lfc $LFC --build "-p always"
west build -b qemu_cortex_m3 -p always apps/HelloZephyr
# - name: Report to CodeCov
# uses: ./.github/actions/report-code-coverage
# with:
# files: core/build/reports/jacoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml
# if: ${{ github.repository == 'lf-lang/lingua-franca' }}
- name: Report to CodeCov
uses: ./.github/actions/report-code-coverage
with:
files: core/build/reports/jacoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml
if: ${{ github.repository == 'lf-lang/lingua-franca' }}
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ CodeBuilder generateCMakeCode(
cMakeCode.pr("# Selecting default board");
cMakeCode.pr("set(BOARD qemu_cortex_m3)");
}
cMakeCode.pr("# We recommend Zephyr v3.4.0 but we are compatible with older versions also");
cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.4.0)");
cMakeCode.pr("# We recommend Zephyr v3.7.0 but we are compatible with older versions also");
cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.7.0)");
cMakeCode.newLine();
cMakeCode.pr("project(" + executableName + " LANGUAGES C)");
cMakeCode.newLine();
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/lib/platform/zephyr/prj_lf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ CONFIG_PRINTK=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_THREAD_CUSTOM_DATA=y
CONFIG_MAIN_STACK_SIZE=2048
2 changes: 1 addition & 1 deletion test/C/src/concurrent/ScheduleAt.lf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ reactor Scheduler {
reaction(act) {=
microstep_t microstep = lf_tag().microstep;
instant_t elapsed_time = lf_time_logical_elapsed();
if (elapsed_time == self->action_hit_list_times[self->action_hit_list_index] &&
if (self->action_hit_list_index < 9 && elapsed_time == self->action_hit_list_times[self->action_hit_list_index] &&
microstep == self->action_hit_list_microstep[self->action_hit_list_index]) {
self->action_hit_list_index++;
}
Expand Down

0 comments on commit 3d8cfd6

Please sign in to comment.