-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2383 from EhsanKhodadad/master
Support for Patmos platform
- Loading branch information
Showing
12 changed files
with
238 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,34 @@ | ||
name: Install Patmos and dependencies (Linux only) | ||
description: Install Patmos and dependencies (Linux only) | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup | ||
run: | | ||
# install needed tools | ||
sudo apt install git openjdk-8-jdk cmake make g++ texinfo flex bison \ | ||
subversion libelf-dev graphviz libboost-dev libboost-program-options-dev ruby-full \ | ||
liblpsolve55-dev zlib1g-dev gtkwave gtkterm scala autoconf libfl2 expect verilator curl | ||
# install sbt | ||
sudo apt-get update | ||
sudo apt-get install apt-transport-https curl gnupg -yqq | ||
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list | ||
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list | ||
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import | ||
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg | ||
sudo apt-get update | ||
sudo apt-get install sbt | ||
# Clone the Patmos repository | ||
export PATH=$PATH:$HOME/t-crest/local/bin | ||
echo "PATH=$PATH:$HOME/t-crest/local/bin" >> "$GITHUB_ENV" | ||
echo $PATH | ||
mkdir ~/t-crest | ||
cd ~/t-crest | ||
git clone https://github.com/t-crest/patmos-misc.git misc | ||
./misc/build.sh | ||
patmos-clang --version | ||
which patmos-clang | ||
shell: bash |
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,56 @@ | ||
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: | | ||
./gradlew core:integrationTest \ | ||
--tests org.lflang.tests.runtime.CPatmosTest.* \ | ||
core:integrationTestCodeCoverageReport | ||
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' }} |
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
54 changes: 54 additions & 0 deletions
54
core/src/integrationTest/java/org/lflang/tests/runtime/CPatmosTest.java
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,54 @@ | ||
/************* | ||
* Copyright (c) 2023, The University of California at Berkeley. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
***************/ | ||
package org.lflang.tests.runtime; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Assumptions; | ||
import org.junit.jupiter.api.Test; | ||
import org.lflang.target.Target; | ||
import org.lflang.tests.Configurators; | ||
import org.lflang.tests.TestBase; | ||
import org.lflang.tests.TestRegistry.TestCategory; | ||
import org.lflang.tests.Transformers; | ||
|
||
public class CPatmosTest extends TestBase { | ||
|
||
public CPatmosTest() { | ||
super(Target.C); | ||
} | ||
|
||
@Test | ||
public void buildPatmosBasicTestsUnthreaded() { | ||
Assumptions.assumeTrue(isLinux(), "Patmos tests only supported on Linux"); | ||
super.runTestsFor( | ||
List.of(Target.C), | ||
"Build basic tests for Patmos in single threaded mode.", | ||
TestCategory.BASIC::equals, | ||
Transformers::noChanges, | ||
Configurators::makePatmosCompatibleUnthreaded, | ||
TestLevel.BUILD, | ||
false); | ||
} | ||
} |
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,11 @@ | ||
target C { | ||
platform: "Patmos", | ||
single-threaded: true, | ||
build-type: Debug | ||
} | ||
|
||
main reactor { | ||
reaction(startup) {= | ||
printf("Hello World!\n"); | ||
=} | ||
} |