forked from lf-lang/lingua-franca
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support C federated tests with Rust RTI
- Most of C tests except federated tests are removed.
- Loading branch information
1 parent
2f0d82a
commit 04fde29
Showing
19 changed files
with
826 additions
and
96 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
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,43 @@ | ||
name: C 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: | ||
regular-tests: | ||
strategy: | ||
matrix: | ||
platform: ${{ (inputs.all-platforms && fromJSON('["ubuntu-latest"]')) || fromJSON('["ubuntu-latest"]') }} | ||
runs-on: ${{ matrix.platform }} | ||
timeout-minutes: 120 | ||
steps: | ||
- name: Check out lingua-franca repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: chanijjani/lingua-franca | ||
submodules: true | ||
ref: ${{ inputs.compiler-ref }} | ||
fetch-depth: 0 | ||
- name: Prepare build environment | ||
uses: ./.github/actions/prepare-build-env | ||
- name: Perform federated tests for C target with Rust RTI and default scheduler | ||
run: ./gradlew targetTest -Ptarget=RustRti | ||
if: ${{ !inputs.use-cpp && !inputs.scheduler }} |
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
89 changes: 89 additions & 0 deletions
89
core/src/integrationTest/java/org/lflang/tests/SimplifiedRuntimeTest.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,89 @@ | ||
package org.lflang.tests; | ||
|
||
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.TestRegistry.TestCategory; | ||
|
||
/** | ||
* A collection of JUnit tests to perform on a given set of targets. | ||
* | ||
* @author Marten Lohstroh | ||
*/ | ||
public abstract class SimplifiedRuntimeTest extends TestBase { | ||
|
||
/** | ||
* Construct a test instance that runs tests for a single target. | ||
* | ||
* @param target The target to run tests for. | ||
*/ | ||
protected SimplifiedRuntimeTest(Target target) { | ||
super(target); | ||
} | ||
|
||
/** | ||
* Construct a test instance that runs tests for a list of targets. | ||
* | ||
* @param targets The targets to run tests for. | ||
*/ | ||
protected SimplifiedRuntimeTest(List<Target> targets) { | ||
super(targets); | ||
} | ||
|
||
/** Whether to enable {@link #runEnclaveTests()}. */ | ||
protected boolean supportsEnclaves() { | ||
return false; | ||
} | ||
|
||
/** Whether to enable {@link #runFederatedTests()}. */ | ||
protected boolean supportsFederatedExecution() { | ||
return false; | ||
} | ||
|
||
/** Whether to enable {@link #runGenericsTests()}. */ | ||
protected boolean supportsGenericTypes() { | ||
return false; | ||
} | ||
|
||
/** Whether to enable {@link #runDockerTests()} and {@link #runDockerFederatedTests()}. */ | ||
protected boolean supportsDockerOption() { | ||
return false; | ||
} | ||
|
||
@Test | ||
public void runFederatedTestsWithRustRti() { | ||
Assumptions.assumeTrue(supportsFederatedExecution(), Message.NO_FEDERATION_SUPPORT); | ||
runTestsForTargetsWithRustRti( | ||
Message.DESC_FEDERATED_WITH_RUST_RTI, | ||
TestCategory.FEDERATED::equals, | ||
Transformers::noChanges, | ||
Configurators::noChanges, | ||
TestLevel.EXECUTION, | ||
false); | ||
} | ||
|
||
/** Given a test category, return true if it is compatible with single-threaded execution. */ | ||
public static boolean compatibleWithThreadingOff(TestCategory category) { | ||
|
||
// CONCURRENT, FEDERATED, DOCKER_FEDERATED, DOCKER | ||
// are not compatible with single-threaded execution. | ||
// ARDUINO and ZEPHYR have their own test suites, so we don't need to rerun. | ||
boolean excluded = | ||
category == TestCategory.CONCURRENT | ||
|| category == TestCategory.SERIALIZATION | ||
|| category == TestCategory.FEDERATED | ||
|| category == TestCategory.DOCKER_FEDERATED | ||
|| category == TestCategory.DOCKER | ||
|| category == TestCategory.ENCLAVE | ||
|| category == TestCategory.ARDUINO | ||
|| category == TestCategory.VERIFIER | ||
|| category == TestCategory.ZEPHYR_UNTHREADED | ||
|| category == TestCategory.ZEPHYR_BOARDS | ||
|| category == TestCategory.ZEPHYR_THREADED; | ||
|
||
// SERIALIZATION and TARGET tests are excluded on Windows. | ||
excluded |= isWindows() && category == TestCategory.TARGET; | ||
return !excluded; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
core/src/integrationTest/java/org/lflang/tests/runtime/RustRtiTest.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,71 @@ | ||
/************* | ||
* Copyright (c) 2019-2024, 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.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Assumptions; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
import org.lflang.target.Target; | ||
import org.lflang.tests.SimplifiedRuntimeTest; | ||
|
||
/** | ||
* Collection of tests for the C target with Rust RTI. | ||
* | ||
* <p>Tests that are implemented in the base class are still overridden so that each test can be | ||
* easily invoked individually from IDEs with JUnit support like Eclipse and IntelliJ. This is | ||
* typically done by right-clicking on the name of the test method and then clicking "Run".* | ||
* | ||
* @author Marten Lohstroh | ||
* @author Chanhee Lee | ||
*/ | ||
public class RustRtiTest extends SimplifiedRuntimeTest { | ||
|
||
public RustRtiTest() { | ||
super(Target.RustRti); | ||
} | ||
|
||
@Override | ||
protected boolean supportsSingleThreadedExecution() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean supportsFederatedExecution() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean supportsDockerOption() { | ||
return true; | ||
} | ||
|
||
@Test | ||
@Override | ||
public void runFederatedTestsWithRustRti() { | ||
super.runFederatedTestsWithRustRti(); | ||
} | ||
} |
Oops, something went wrong.