From 153af0b58be56418e6f329c2c0281cbc00a887de Mon Sep 17 00:00:00 2001 From: Ehsan Khodadad Date: Mon, 5 Aug 2024 15:11:11 +0200 Subject: [PATCH] Patmos test added to the github workflow --- .github/actions/setup-patmos/action.yml | 17 ++++++ .github/workflows/c-embedded.yml | 4 ++ .github/workflows/c-patmos-tests.yml | 53 +++++++++++++++++++ .../lflang/generator/c/CCmakeGenerator.java | 9 +++- core/src/main/resources/lib/cpp/reactor-cpp | 2 +- 5 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/actions/setup-patmos/action.yml create mode 100644 .github/workflows/c-patmos-tests.yml diff --git a/.github/actions/setup-patmos/action.yml b/.github/actions/setup-patmos/action.yml new file mode 100644 index 0000000000..d640876b9a --- /dev/null +++ b/.github/actions/setup-patmos/action.yml @@ -0,0 +1,17 @@ +name: Install Patmos and dependencies (Linux only) +description: Install Patmos and dependencies (Linux only) +runs: + using: "composite" + steps: + - name: Setup + run: | + # Clone the Patmos repository + mkdir ~/t-crest + cd ~/t-crest + git clone https://github.com/t-crest/patmos-misc.git misc + ./misc/build.sh + + # Save location in PATH + export PATH=$PATH:$HOME/t-crest/misc + shell: bash + diff --git a/.github/workflows/c-embedded.yml b/.github/workflows/c-embedded.yml index f36bf3c73b..14bc557947 100644 --- a/.github/workflows/c-embedded.yml +++ b/.github/workflows/c-embedded.yml @@ -23,3 +23,7 @@ jobs: # Run the C FlexPRET integration tests. flexpret: uses: ./.github/workflows/c-flexpret-tests.yml + + # Run the C Patmos integration tests. + patmos: + uses: ./.github/workflows/c-patmos-tests.yml diff --git a/.github/workflows/c-patmos-tests.yml b/.github/workflows/c-patmos-tests.yml new file mode 100644 index 0000000000..5cffb01ce9 --- /dev/null +++ b/.github/workflows/c-patmos-tests.yml @@ -0,0 +1,53 @@ +name: C Patmos tests + +on: + workflow_call: + inputs: + compiler-ref: + required: false + type: string + runtime-ref: + required: false + type: string + use-cpp: + required: false + type: boolean + default: false + scheduler: + required: false + type: string + all-platforms: + required: false + default: true + type: boolean + +jobs: + Patmos-tests: + runs-on: ubuntu-latest + steps: + - name: Check out lingua-franca repository + uses: actions/checkout@v3 + with: + repository: lf-lang/lingua-franca + submodules: true + ref: ${{ inputs.compiler-ref }} + fetch-depth: 0 + - name: Prepare build environment + uses: ./.github/actions/prepare-build-env + - name: Setup and build Patmos + uses: ./.github/actions/setup-patmos + - name: Check out specific ref of reactor-c + uses: actions/checkout@v3 + with: + repository: lf-lang/reactor-c + path: core/src/main/resources/lib/c/reactor-c + ref: ${{ inputs.runtime-ref }} + if: ${{ inputs.runtime-ref }} + - name: Run Patmos smoke tests + run: | + rm -rf test/C/src-gen + - 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' }} diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 2cf6f58239..7648637fc7 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -225,7 +225,14 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("set(FP_FLASH_DEVICE " + selectedFlashDevice.value() + ")"); cMakeCode.newLine(); } // No FP_FLASH_DEVICE will automatically become /dev/ttyUSB0 - + break; + case PATMOS: + cMakeCode.newLine(); + cMakeCode.pr("# Find and set Patmos compiler"); + cMakeCode.pr("find_program(CLANG_EXECUTABLE NAMES patmos-clang clang DOC \"Path to the clang front-end.\")"); + cMakeCode.pr("set(CMAKE_C_COMPILER ${CLANG_EXECUTABLE})"); + cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); + cMakeCode.newLine(); break; default: cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); diff --git a/core/src/main/resources/lib/cpp/reactor-cpp b/core/src/main/resources/lib/cpp/reactor-cpp index dfdac2c19e..65dff1fd22 160000 --- a/core/src/main/resources/lib/cpp/reactor-cpp +++ b/core/src/main/resources/lib/cpp/reactor-cpp @@ -1 +1 @@ -Subproject commit dfdac2c19e8d111cf4741c8bf8f304678a59d025 +Subproject commit 65dff1fd22d80305473acaf34a7e5209521b5ec0