-
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 #743 from lf-lang/c-new-scheduler
C new scheduler
- Loading branch information
Showing
47 changed files
with
486 additions
and
125 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 |
---|---|---|
|
@@ -13,6 +13,9 @@ on: | |
required: false | ||
type: boolean | ||
default: false | ||
scheduler: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
run: | ||
|
@@ -53,14 +56,19 @@ jobs: | |
- name: Build RTI docker image | ||
uses: ./.github/actions/build-rti-docker | ||
if: ${{ runner.os == 'Linux' }} | ||
- name: Perform tests for C target | ||
- name: Perform tests for C target with default scheduler | ||
run: | | ||
./gradlew test --tests org.lflang.tests.runtime.CTest.* --tests org.lflang.tests.lsp.LspTests.lspWithDependenciesTestC | ||
if: ${{ !inputs.use-cpp }} | ||
- name: Perform tests for CCpp target | ||
if: ${{ !inputs.use-cpp && !inputs.scheduler }} | ||
- name: Perform tests for C target with specified scheduler (no LSP tests) | ||
run: | | ||
echo "Specified scheduler: ${{ inputs.scheduler }}" | ||
./gradlew test --tests org.lflang.tests.runtime.CSchedulerTest.* -Dscheduler=${{ inputs.scheduler }} | ||
if: ${{ !inputs.use-cpp && inputs.scheduler }} | ||
- name: Perform tests for CCpp target with default scheduler | ||
run: | | ||
./gradlew test --tests org.lflang.tests.runtime.CCppTest.* | ||
if: ${{ inputs.use-cpp }} | ||
if: ${{ inputs.use-cpp && !inputs.scheduler }} | ||
- name: Report to CodeCov | ||
uses: codecov/[email protected] | ||
with: | ||
|
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
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
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
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
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 |
---|---|---|
|
@@ -106,8 +106,8 @@ public class Main { | |
* @author Marten Lohstroh <[email protected]> | ||
*/ | ||
enum CLIOption { | ||
COMPILER(null, "target-compiler", true, false, "Target compiler to invoke.", true), | ||
CLEAN("c", "clean", false, false, "Clean before building.", true), | ||
COMPILER(null, "target-compiler", true, false, "Target compiler to invoke.", true), | ||
EXTERNAL_RUNTIME_PATH(null, "external-runtime-path", true, false, "Specify an external runtime library to be used by the compiled binary.", true), | ||
FEDERATED("f", "federated", false, false, "Treat main reactor as federated.", false), | ||
HELP("h", "help", false, false, "Display this information.", true), | ||
|
@@ -117,6 +117,7 @@ enum CLIOption { | |
QUIET("q", "quiet", false, false, "Suppress output of the target compiler and other commands", true), | ||
RTI("r", "rti", true, false, "Specify the location of the RTI.", true), | ||
RUNTIME_VERSION(null, "runtime-version", true, false, "Specify the version of the runtime library used for compiling LF programs.", true), | ||
SCHEDULER("s", "scheduler", true, false, "Specify the runtime scheduler (if supported).", true), | ||
THREADS("t", "threads", true, false, "Specify the default number of threads.", true), | ||
VERSION(null, "version", false, false, "Print version inforomation.", 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
75 changes: 75 additions & 0 deletions
75
org.lflang.tests/src/org/lflang/tests/runtime/CSchedulerTest.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,75 @@ | ||
package org.lflang.tests.runtime; | ||
|
||
import java.util.EnumSet; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.lflang.Target; | ||
import org.lflang.TargetProperty.SchedulerOption; | ||
import org.lflang.tests.Configurators; | ||
import org.lflang.tests.TestBase; | ||
import org.lflang.tests.TestRegistry.TestCategory; | ||
|
||
/** | ||
*/ | ||
public class CSchedulerTest extends TestBase { | ||
|
||
|
||
public CSchedulerTest() { | ||
super(Target.C); | ||
} | ||
|
||
/** | ||
* Swap the default runtime scheduler with other supported versions and | ||
* run all the supported tests. Only run tests for a specific non-default | ||
* scheduler if specified using a system property (e.g., -Dscheduler=GEDF_NP). | ||
*/ | ||
@Test | ||
public void runWithNonDefaultSchedulers() { | ||
EnumSet<TestCategory> categories = EnumSet.of(TestCategory.CONCURRENT, | ||
TestCategory.MULTIPORT); | ||
|
||
// Add federated and docker tests if supported | ||
if (!isWindows()) { | ||
categories.add(TestCategory.FEDERATED); | ||
if (isLinux()) { | ||
categories.add(TestCategory.DOCKER_FEDERATED); | ||
} | ||
} | ||
var name = System.getProperty("scheduler"); | ||
|
||
if (name != null) { | ||
var option = EnumSet.allOf(SchedulerOption.class).stream() | ||
.filter(it -> it.name().equals(name)).findFirst(); | ||
if (option.isPresent()) { | ||
this.runTest(option.get(), categories); | ||
} else { | ||
throw new RuntimeException("Cannot find runtime scheduler called " + name); | ||
} | ||
} else { | ||
for (SchedulerOption scheduler: EnumSet.allOf(SchedulerOption.class)) { | ||
if (scheduler == SchedulerOption.getDefault()) continue; | ||
this.runTest(scheduler, categories); | ||
} | ||
} | ||
} | ||
|
||
private void runTest(SchedulerOption scheduler, EnumSet<TestCategory> categories) { | ||
this.runTestsForTargets( | ||
Message.DESC_SCHED_SWAPPING + scheduler.toString() +".", | ||
categories::contains, | ||
test -> { | ||
test.getContext() | ||
.getArgs() | ||
.setProperty( | ||
"scheduler", | ||
scheduler.toString() | ||
); | ||
return Configurators.useFourThreads(test); | ||
}, | ||
TestLevel.EXECUTION, | ||
true | ||
); | ||
} | ||
} | ||
|
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
Oops, something went wrong.