lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.tests.runtime.CppTest Class Reference

Collection of tests for the Cpp target. More...

Inherits org.lflang.tests.RuntimeTest.

Public Member Functions

 CppTest ()
void runAsFederated ()
void runBasicTests ()
void runConcurrentTests ()
void runDockerFederatedTests ()
 Run federated docker tests, provided that the platform is Linux, the target supports Docker, and the target supports federated execution.
void runDockerTests ()
 Run docker tests, provided that the platform is Linux and the target supports Docker.
void runEnclaveTests ()
 Run enclave tests if the target supports enclaves.
void runFederatedTests ()
void runGenericsTests ()
void runModalTests ()
 Run the tests for modal reactors.
void runMultiportTests ()
void runNoInliningTests ()
 Run the tests for non-inlined reaction bodies.
void runRos2Tests ()
void runTargetSpecificTests ()
void runWithThreadingOff ()

Static Public Member Functions

static boolean compatibleWithThreadingOff (TestCategory category)
 Given a test category, return true if it is compatible with single-threaded execution.
static TestLevel pathToLevel (Path path)
 Static function for converting a path to its associated test level.
static void runSingleTestAndPrintResults (LFTest test, Class<? extends TestBase > testClass, TestLevel level)
 Run a test, print results on stderr.
static String stackTraceToString (Throwable t)

Static Public Attributes

static final String THICK_LINE
 Content separator used in test output, 78 characters wide.
static final String THIN_LINE
 Content separator used in test output, 78 characters wide.

Protected Member Functions

void applyDefaultConfiguration (TargetConfig config)
 Adjust target configuration for all runs of this test class.
ProcessBuilder getExecCommand (LFTest test) throws TestError
 Return a preconfigured ProcessBuilder for executing the test program.
GeneratorArguments getGeneratorArguments ()
 Return generator arguments suitable for testing.
final void runTestsAndPrintResults (Target target, Predicate< TestCategory > selected, TestLevel level, Transformer transformer, Configurator configurator, boolean copy)
 Run selected tests for a given target and configurator up to the specified level.
void runTestsFor (List< Target > subset, String description, Predicate< TestCategory > selected, Transformer transformer, Configurator configurator, TestLevel level, boolean copy)
 Run tests in the given selection for a subset of given targets.
void runTestsForTargets (String description, Predicate< TestCategory > selected, Transformer transformer, Configurator configurator, TestLevel level, boolean copy)
 Run tests in the given selection for all targets enabled in this class.
boolean supportsDockerOption ()
 Whether to enable runDockerTests() and runDockerFederatedTests().
boolean supportsEnclaves ()
 Whether to enable runEnclaveTests().
boolean supportsFederatedExecution ()
 Whether to enable runFederatedTests().
boolean supportsGenericTypes ()
 Whether to enable runGenericsTests().
boolean supportsSingleThreadedExecution ()
 Whether to enable threading.

Static Protected Member Functions

static boolean isLinux ()
 Determine whether the current platform is Linux.
static boolean isMac ()
 Determine whether the current platform is MacOS.
static boolean isWindows ()
 Determine whether the current platform is Windows.
static void printTestHeader (Target target, String description)
 Print a header that describes a collection of tests.

Package Attributes

JavaIoFileSystemAccess fileAccess
LFGenerator generator
Provider< ResourceSet > resourceSetProvider
TestRegistry testRegistry
IResourceValidator validator

Detailed Description

Collection of tests for the Cpp target.

Even though all tests are implemented in the base class, we override them here 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

Constructor & Destructor Documentation

◆ CppTest()

org.lflang.tests.runtime.CppTest.CppTest ( )

Member Function Documentation

◆ applyDefaultConfiguration()

void org.lflang.tests.TestBase.applyDefaultConfiguration ( TargetConfig config)
protectedinherited

Adjust target configuration for all runs of this test class.

Reimplemented in org.lflang.tests.runtime.PythonTest, and org.lflang.tests.serialization.SerializationTest.

◆ compatibleWithThreadingOff()

boolean org.lflang.tests.RuntimeTest.compatibleWithThreadingOff ( TestCategory category)
staticinherited

Given a test category, return true if it is compatible with single-threaded execution.

◆ getExecCommand()

ProcessBuilder org.lflang.tests.TestBase.getExecCommand ( LFTest test) throws TestError
protectedinherited

Return a preconfigured ProcessBuilder for executing the test program.

Parameters
testThe test to get the execution command for.

Reimplemented in org.lflang.tests.runtime.CPatmosTest.

◆ getGeneratorArguments()

GeneratorArguments org.lflang.tests.TestBase.getGeneratorArguments ( )
protectedinherited

Return generator arguments suitable for testing.

◆ isLinux()

boolean org.lflang.tests.TestBase.isLinux ( )
staticprotectedinherited

Determine whether the current platform is Linux.

Returns
true if the current platform is Linux, false otherwise.

◆ isMac()

boolean org.lflang.tests.TestBase.isMac ( )
staticprotectedinherited

Determine whether the current platform is MacOS.

Returns
true if the current platform is MacOS, false otherwise.

◆ isWindows()

boolean org.lflang.tests.TestBase.isWindows ( )
staticprotectedinherited

Determine whether the current platform is Windows.

Returns
true if the current platform is Windwos, false otherwise.

◆ pathToLevel()

TestLevel org.lflang.tests.TestBase.pathToLevel ( Path path)
staticinherited

Static function for converting a path to its associated test level.

Author
Anirudh Rengarajan

◆ printTestHeader()

void org.lflang.tests.TestBase.printTestHeader ( Target target,
String description )
staticprotectedinherited

Print a header that describes a collection of tests.

Parameters
targetThe target for which the tests are being performed.
descriptionA string the describes the collection of tests.

◆ runAsFederated()

void org.lflang.tests.RuntimeTest.runAsFederated ( )
inherited

◆ runBasicTests()

void org.lflang.tests.runtime.CppTest.runBasicTests ( )

Reimplemented from org.lflang.tests.RuntimeTest.

◆ runConcurrentTests()

void org.lflang.tests.runtime.CppTest.runConcurrentTests ( )

Reimplemented from org.lflang.tests.RuntimeTest.

◆ runDockerFederatedTests()

void org.lflang.tests.RuntimeTest.runDockerFederatedTests ( )
inherited

Run federated docker tests, provided that the platform is Linux, the target supports Docker, and the target supports federated execution.

If any of these requirements are not met, skip the tests.

Reimplemented in org.lflang.tests.runtime.CTest, org.lflang.tests.runtime.PythonTest, and org.lflang.tests.runtime.TypeScriptTest.

◆ runDockerTests()

void org.lflang.tests.RuntimeTest.runDockerTests ( )
inherited

Run docker tests, provided that the platform is Linux and the target supports Docker.

Skip if platform is not Linux or target does not support Docker.

Reimplemented in org.lflang.tests.runtime.CTest, org.lflang.tests.runtime.PythonTest, and org.lflang.tests.runtime.TypeScriptTest.

◆ runEnclaveTests()

void org.lflang.tests.RuntimeTest.runEnclaveTests ( )
inherited

Run enclave tests if the target supports enclaves.

Reimplemented in org.lflang.tests.runtime.CTest.

◆ runFederatedTests()

void org.lflang.tests.runtime.CppTest.runFederatedTests ( )

Reimplemented from org.lflang.tests.RuntimeTest.

◆ runGenericsTests()

void org.lflang.tests.RuntimeTest.runGenericsTests ( )
inherited

◆ runModalTests()

void org.lflang.tests.RuntimeTest.runModalTests ( )
inherited

Run the tests for modal reactors.

Reimplemented in org.lflang.tests.runtime.CTest.

◆ runMultiportTests()

void org.lflang.tests.runtime.CppTest.runMultiportTests ( )

Reimplemented from org.lflang.tests.RuntimeTest.

◆ runNoInliningTests()

void org.lflang.tests.RuntimeTest.runNoInliningTests ( )
inherited

Run the tests for non-inlined reaction bodies.

Reimplemented in org.lflang.tests.runtime.CTest.

◆ runRos2Tests()

void org.lflang.tests.runtime.CppTest.runRos2Tests ( )

◆ runSingleTestAndPrintResults()

void org.lflang.tests.TestBase.runSingleTestAndPrintResults ( LFTest test,
Class<? extends TestBase > testClass,
TestLevel level )
staticinherited

Run a test, print results on stderr.

Parameters
testTest case.
testClassThe test class that will execute the test. This is target-specific, it may provide some target-specific configuration. We pass a class and not a new instance because this method needs to ensure the object is properly injected, and so, it needs to control its entire lifecycle.
levelLevel to which to run the test.

◆ runTargetSpecificTests()

void org.lflang.tests.runtime.CppTest.runTargetSpecificTests ( )

Reimplemented from org.lflang.tests.RuntimeTest.

◆ runTestsAndPrintResults()

final void org.lflang.tests.TestBase.runTestsAndPrintResults ( Target target,
Predicate< TestCategory > selected,
TestLevel level,
Transformer transformer,
Configurator configurator,
boolean copy )
protectedinherited

Run selected tests for a given target and configurator up to the specified level.

Parameters
targetThe target to run tests for.
selectedA predicate that given a test category returns whether it should be included in this test run or not.
levelThe test level.
transformerThe transformer to apply to tests.
configuratorA procedure for configuring the tests.
copyWhether to work on copies of tests in the test. registry.

◆ runTestsFor()

void org.lflang.tests.TestBase.runTestsFor ( List< Target > subset,
String description,
Predicate< TestCategory > selected,
Transformer transformer,
Configurator configurator,
TestLevel level,
boolean copy )
protectedinherited

Run tests in the given selection for a subset of given targets.

Parameters
subsetThe subset of targets to run the selected tests for.
descriptionA string that describes the collection of tests.
selectedA predicate that given a test category returns whether it should be included in this test run or not.
transformerThe transformer to apply to tests.
configuratorA procedure for configuring the tests.
levelThe test level.
copyWhether to work on copies of tests in the test. registry.

◆ runTestsForTargets()

void org.lflang.tests.TestBase.runTestsForTargets ( String description,
Predicate< TestCategory > selected,
Transformer transformer,
Configurator configurator,
TestLevel level,
boolean copy )
protectedinherited

Run tests in the given selection for all targets enabled in this class.

Parameters
descriptionA string that describes the collection of tests.
selectedA predicate that given a test category returns whether it should be included in this test run or not.
transformerThe transformer to apply to tests.
configuratorA procedure for configuring the tests.
levelThe test level.
copyWhether to work on copies of tests in the test. registry.

◆ runWithThreadingOff()

void org.lflang.tests.RuntimeTest.runWithThreadingOff ( )
inherited

Reimplemented in org.lflang.tests.runtime.CTest.

◆ stackTraceToString()

String org.lflang.tests.TestBase.stackTraceToString ( Throwable t)
staticinherited

◆ supportsDockerOption()

boolean org.lflang.tests.runtime.CppTest.supportsDockerOption ( )
protected

Whether to enable runDockerTests() and runDockerFederatedTests().

Reimplemented from org.lflang.tests.RuntimeTest.

◆ supportsEnclaves()

boolean org.lflang.tests.runtime.CppTest.supportsEnclaves ( )
protected

Whether to enable runEnclaveTests().

Reimplemented from org.lflang.tests.RuntimeTest.

◆ supportsFederatedExecution()

boolean org.lflang.tests.RuntimeTest.supportsFederatedExecution ( )
protectedinherited

◆ supportsGenericTypes()

boolean org.lflang.tests.RuntimeTest.supportsGenericTypes ( )
protectedinherited

Whether to enable runGenericsTests().

Reimplemented in org.lflang.tests.runtime.RustTest.

◆ supportsSingleThreadedExecution()

boolean org.lflang.tests.TestBase.supportsSingleThreadedExecution ( )
protectedinherited

Whether to enable threading.

Reimplemented in org.lflang.tests.runtime.CTest, and org.lflang.tests.runtime.PythonTest.

Member Data Documentation

◆ fileAccess

JavaIoFileSystemAccess org.lflang.tests.TestBase.fileAccess
packageinherited

◆ generator

LFGenerator org.lflang.tests.TestBase.generator
packageinherited

◆ resourceSetProvider

Provider<ResourceSet> org.lflang.tests.TestBase.resourceSetProvider
packageinherited

◆ testRegistry

TestRegistry org.lflang.tests.TestBase.testRegistry
packageinherited

◆ THICK_LINE

final String org.lflang.tests.TestBase.THICK_LINE
staticinherited
Initial value:
=
"=============================================================================="
+ System.lineSeparator()

Content separator used in test output, 78 characters wide.

◆ THIN_LINE

final String org.lflang.tests.TestBase.THIN_LINE
staticinherited
Initial value:
=
"------------------------------------------------------------------------------"
+ System.lineSeparator()

Content separator used in test output, 78 characters wide.

◆ validator

IResourceValidator org.lflang.tests.TestBase.validator
packageinherited

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/integrationTest/java/org/lflang/tests/runtime/CppTest.java