Skip to content

Commit

Permalink
Support C federated tests with Rust RTI
Browse files Browse the repository at this point in the history
- Most of C tests except federated tests are removed.
  • Loading branch information
chanijjani committed Feb 11, 2024
1 parent 2f0d82a commit 58d55fd
Show file tree
Hide file tree
Showing 20 changed files with 1,025 additions and 96 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/all-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,3 @@ concurrency:
jobs:
check-diff:
uses: ./.github/workflows/check-diff.yml

# Test the Gradle build.
building:
needs: check-diff
uses: ./.github/workflows/build.yml
with:
all-platforms: ${{ !github.event.pull_request.draft }}
if: ${{ needs.check-diff.outputs.run_build == 'true' }}

# Run tests for the standalone compiler.
cli:
if: ${{ needs.check-diff.outputs.run_misc == 'true' }}
needs: check-diff
uses: ./.github/workflows/cli-tests.yml
with:
all-platforms: ${{ !github.event.pull_request.draft }}

# Run language server tests.
lsp:
if: ${{ needs.check-diff.outputs.run_misc == 'true' }}
needs: check-diff
uses: ./.github/workflows/lsp-tests.yml
with:
all-platforms: ${{ !github.event.pull_request.draft }}

check-labels:
uses: ./.github/workflows/check-labels.yml
if: ${{ github.event_name == 'pull_request' }}
30 changes: 0 additions & 30 deletions .github/workflows/all-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,5 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
check-diff:
uses: ./.github/workflows/check-diff.yml

c:
uses: ./.github/workflows/only-c.yml
needs: check-diff
if: ${{ needs.check-diff.outputs.run_c == 'true' }}

cpp:
uses: ./.github/workflows/only-cpp.yml
needs: check-diff
if: ${{ needs.check-diff.outputs.run_cpp == 'true' }}

py:
uses: ./.github/workflows/only-py.yml
needs: check-diff
if: ${{ needs.check-diff.outputs.run_py == 'true' || needs.check-diff.outputs.run_c == 'true' }}

rs:
uses: ./.github/workflows/only-rs.yml
needs: check-diff
if: ${{ needs.check-diff.outputs.run_rs == 'true' }}

ts:
uses: ./.github/workflows/only-ts.yml
needs: check-diff
if: ${{ needs.check-diff.outputs.run_ts == 'true' }}

serialization:
if: ${{ needs.check-diff.outputs.run_c == 'true' || needs.check-diff.outputs.run_py == 'true' || needs.check-diff.outputs.run_ts == 'true' }}
needs: check-diff
uses: ./.github/workflows/serialization-tests.yml
43 changes: 43 additions & 0 deletions .github/workflows/c-tests-with-rust-rti.yml
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 }}
31 changes: 2 additions & 29 deletions .github/workflows/only-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,8 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
# Run the C integration tests.
# Run the C integration tests with Rust RTI.
default:
uses: ./.github/workflows/c-tests.yml
uses: ./.github/workflows/c-tests-with-rust-rti.yml
with:
all-platforms: ${{ !github.event.pull_request.draft }}

# Run the C benchmark tests.
benchmarking:
uses: lf-lang/benchmarks-lingua-franca/.github/workflows/benchmark-tests.yml@main
with:
target: "C"

# Run the C Arduino integration tests.
arduino:
uses: ./.github/workflows/c-arduino-tests.yml
with:
all-platforms: ${{ !github.event.pull_request.draft }}

# Run the C Zephyr integration tests.
zephyr:
uses: ./.github/workflows/c-zephyr-tests.yml

# Run the CCpp integration tests.
ccpp:
uses: ./.github/workflows/c-tests.yml
with:
use-cpp: true
all-platforms: ${{ !github.event.pull_request.draft }}

# Run the Uclid-based LF Verifier benchmarks.
verifier:
uses: ./.github/workflows/c-verifier-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.lflang.tests.runtime.CTest;
import org.lflang.tests.runtime.CppTest;
import org.lflang.tests.runtime.PythonTest;
import org.lflang.tests.runtime.RustRtiTest;
import org.lflang.tests.runtime.RustTest;
import org.lflang.tests.runtime.TypeScriptTest;

Expand Down Expand Up @@ -90,6 +91,8 @@ private static Class<? extends TestBase> getTestInstance(Target target) {
return PythonTest.class;
case Rust:
return RustTest.class;
case RustRti:
return RustRtiTest.class;
default:
throw new IllegalArgumentException();
}
Expand Down
16 changes: 16 additions & 0 deletions core/src/integrationTest/java/org/lflang/tests/RuntimeTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.lflang.tests;

import java.nio.file.Path;
import java.util.EnumSet;
import java.util.List;
import org.junit.jupiter.api.Assumptions;
Expand Down Expand Up @@ -142,6 +143,21 @@ public void runFederatedTests() {
false);
}

@Test
// public void runFederatedTestsWithRustRti(Path rustRtiProjectPath) {
public void runFederatedTestsWithRustRti() {
Assumptions.assumeTrue(supportsFederatedExecution(), Message.NO_FEDERATION_SUPPORT);
runTestsForTargetsWithRustRti(
Message.DESC_FEDERATED,
TestCategory.FEDERATED::equals,
Transformers::noChanges,
Configurators::noChanges,
TestLevel.EXECUTION,
// false,
// rustRtiProjectPath);
false);
}

/** Run the tests for modal reactors. */
@Test
public void runModalTests() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
package org.lflang.tests;

import java.nio.file.Path;
import java.util.EnumSet;
import java.util.List;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.lflang.ast.ASTUtils;
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 runBasicTests() {
// runTestsForTargets(
// Message.DESC_BASIC,
// TestCategory.BASIC::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

// @Test
// public void runGenericsTests() {
// runTestsForTargets(
// Message.DESC_GENERICS,
// TestCategory.GENERICS::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

// @Test
// public void runTargetSpecificTests() {
// runTestsForTargets(
// Message.DESC_TARGET_SPECIFIC,
// TestCategory.TARGET::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

// @Test
// public void runMultiportTests() {
// runTestsForTargets(
// Message.DESC_MULTIPORT,
// TestCategory.MULTIPORT::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

// @Test
// public void runFederatedTests() {}

@Test
// public void runFederatedTestsWithRustRti(Path rustRtiProjectPath) {
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,
// rustRtiProjectPath);
false);
}

/** Run the tests for modal reactors. */
// @Test
// public void runModalTests() {
// runTestsForTargets(
// Message.DESC_MODAL,
// TestCategory.MODAL_MODELS::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

/** Run the tests for non-inlined reaction bodies. */
// @Test
// public void runNoInliningTests() {
// runTestsForTargets(
// Message.DESC_MODAL,
// TestCategory.NO_INLINING::equals,
// Transformers::noChanges,
// Configurators::noChanges,
// TestLevel.EXECUTION,
// false);
// }

// @Test
// public void runWithThreadingOff() {
// Assumptions.assumeTrue(supportsSingleThreadedExecution(), Message.NO_SINGLE_THREADED_SUPPORT);
// this.runTestsForTargets(
// Message.DESC_SINGLE_THREADED,
// RuntimeTest::compatibleWithThreadingOff,
// Transformers::noChanges,
// Configurators::disableThreading,
// TestLevel.EXECUTION,
// true);
// }

/** Run enclave tests if the target supports enclaves. */
// @Test
// public void runEnclaveTests() {
// Assumptions.assumeTrue(supportsEnclaves(), Message.NO_ENCLAVE_SUPPORT);
// runTestsForTargets(
// Message.DESC_ENCLAVE,
// TestCategory.ENCLAVE::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;
}
}
Loading

0 comments on commit 58d55fd

Please sign in to comment.