Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support for the C target #532

Merged
merged 120 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5af79fa
Updated core file paths to user '/' since they will be copied from cl…
Soroosh129 Sep 6, 2021
1e15285
Renamed handle_t to trigger_handle_t to prevent naming collision with…
Soroosh129 Sep 7, 2021
b01e686
Fixed compile errors on Windows. Still getting runtime exception
Soroosh129 Sep 7, 2021
6d28fa7
Attempt to fix compile error for Unix-based systems that was introduc…
Soroosh129 Sep 7, 2021
c2f37ea
Resolved segmentation fault. Tracing doesn't work.
Soroosh129 Sep 7, 2021
c8c26f6
Added new line to printf
Soroosh129 Sep 7, 2021
c73e2b5
Updated timing functions. Changed __ prefixes to _lf_.
Soroosh129 Sep 17, 2021
c76f05e
Adjusted timing functions. Bug fixes and code format corrections.
Soroosh129 Sep 17, 2021
7f24db4
Updated Python runtime to match the API name change
Soroosh129 Sep 17, 2021
6cd71f2
Updated test to report time per reaction
Soroosh129 Sep 17, 2021
d26ac36
Minor fixes
Soroosh129 Sep 17, 2021
734b491
Add Windows test for the Python target
Soroosh129 Sep 17, 2021
4f1261f
Trying protobuf on Windows again
Soroosh129 Sep 17, 2021
d4e2053
Removed stray SIGPIPE
Soroosh129 Sep 17, 2021
13addb0
Updated Python target to use lf_reserved_prefix
Soroosh129 Sep 17, 2021
ce565c9
More usage of _lf_
Soroosh129 Sep 17, 2021
a626423
Added lf_reserved_prefix for federated execution
Soroosh129 Sep 17, 2021
94105f8
Tabs to spaces
Soroosh129 Sep 22, 2021
5d9463d
Merge remote-tracking branch 'origin/master' into windows-c-target
Soroosh129 Sep 22, 2021
c768358
Merge remote-tracking branch 'origin/master' into windows-c-target
Soroosh129 Sep 24, 2021
3406cb6
More renaming
Soroosh129 Sep 24, 2021
ae53db9
More renaming
Soroosh129 Sep 24, 2021
9a2500c
Added files
Soroosh129 Sep 24, 2021
b225992
Updated example to use the CCpp target
Soroosh129 Sep 25, 2021
5097bb5
Factored out some of the code generation from doGenerate
Soroosh129 Sep 25, 2021
dfad180
Misc. runtime updates
Soroosh129 Sep 25, 2021
46e030a
Added a debug message for reaction blocking
Soroosh129 Sep 25, 2021
e6c4c76
Added an unsigned modifier
Soroosh129 Sep 25, 2021
a612b96
Enabled debug messages for test
Soroosh129 Sep 25, 2021
32c5943
Attempt at fixing concurrency bug in C runtime.
lhstrh Sep 29, 2021
feb640f
Moved break statement back into else clause
lhstrh Sep 29, 2021
9948631
Typo
lhstrh Sep 29, 2021
21ec34d
Merge branch 'master' into windows-c-target
lhstrh Sep 29, 2021
52adfe3
Merge branch 'master' into c-runtime-fix
lhstrh Sep 29, 2021
15a3b8a
Merge remote-tracking branch 'origin/windows-c-target' into c-runtime…
Soroosh129 Sep 29, 2021
c13c6b6
Typo
Soroosh129 Sep 29, 2021
0181b0a
Added a missing return value
Soroosh129 Sep 29, 2021
30afa2f
Updated test to use the platform support for threads
Soroosh129 Sep 29, 2021
dd59ea9
A few bug fixes regarding threads in Windows
Soroosh129 Sep 29, 2021
0f97a4b
Update org.lflang/src/lib/core/reactor_threaded.c
lhstrh Sep 29, 2021
b57be29
Updated test to make the output cleaner
Soroosh129 Sep 29, 2021
44b2356
Fixed an issue where time values were being treated as long, which on…
Soroosh129 Sep 29, 2021
25357d7
Typo
Soroosh129 Sep 27, 2021
2597dc2
Merge pull request #556 from lf-lang/c-runtime-fix
Soroosh129 Sep 29, 2021
7b7d3c4
Fixed an issue where a non-constant expression was being used to init…
Soroosh129 Sep 29, 2021
07ff4be
Moved serialization tests to a separate folder
Soroosh129 Sep 29, 2021
7f9d926
Enabled Windows for C tests
Soroosh129 Sep 29, 2021
fbe9d09
Added a serialization category. Skip federated and serialization test…
Soroosh129 Sep 29, 2021
e6a868b
Reverted back to using _width
Soroosh129 Sep 29, 2021
b8bd4f9
NPE fix
Soroosh129 Sep 29, 2021
bf5c933
Fixed an issue related to unsupported VLAs by dynamically allocating …
Soroosh129 Sep 29, 2021
751a797
Install the RTI only on macOS and Linux
Soroosh129 Sep 29, 2021
e4a20ae
Adapted the Python target to the latest change in the C runtime
Soroosh129 Sep 29, 2021
b694f07
Added test for runSerializationTests
Soroosh129 Sep 29, 2021
ee2e8e1
Fixed allocation issue
Soroosh129 Sep 29, 2021
4fa31b3
Moving platform.h up to see if it fixes the issue with Windows SDK 10…
Soroosh129 Sep 29, 2021
7710a79
Added an update Windows SDK task
Soroosh129 Sep 29, 2021
ee0beb9
Process is canceled, but closure of output is clumsy.
petervdonovan Sep 25, 2021
32b92c8
Remove duplicated code.
petervdonovan Sep 25, 2021
041f949
Use polling only. Avoid undefined behavior, deadlock.
petervdonovan Sep 27, 2021
a24939a
Add comments.
petervdonovan Sep 27, 2021
efbfe40
Allow timely interruption of TypeScript generator.
petervdonovan Sep 27, 2021
e4778ab
Allow timely interruption of Python generator.
petervdonovan Sep 27, 2021
cd1edf1
Move magic numbers to top.
petervdonovan Sep 28, 2021
94ec972
Add comments for constants.
petervdonovan Sep 28, 2021
56f971a
Explain cancellation.
petervdonovan Sep 28, 2021
c66deac
Fix style.
petervdonovan Sep 28, 2021
0f7e6c4
Allow interruption of CMake.
petervdonovan Sep 28, 2021
9ea6068
Allow interruption of protoc.
petervdonovan Sep 29, 2021
4596fa3
Updated the Carla Intersection example with the correct Carla install…
Soroosh129 Sep 27, 2021
c96938f
Set CMake to use the latest available SDK
Soroosh129 Sep 30, 2021
3e50ec0
Merge remote-tracking branch 'origin/master' into windows-c-target
Soroosh129 Sep 30, 2021
74d63ba
Suppress warnings about const char* only on Linux and MacOS
Soroosh129 Sep 30, 2021
6e68c35
Trying again with Windows 2022 beta
Soroosh129 Sep 30, 2021
2839833
Trying with specific Windows SDK versions
Soroosh129 Sep 30, 2021
9cb04d8
Moved stdbool.h to platform support files
Soroosh129 Sep 30, 2021
595c2dc
Added a Windows-specific bool
Soroosh129 Sep 30, 2021
109bdf9
Syntax fix
Soroosh129 Sep 30, 2021
47248c6
Pass a command-line argument to tell CMake to use the latest Windows …
Soroosh129 Sep 30, 2021
996a2f9
Updated async tests to use the platform functions for threads
Soroosh129 Sep 30, 2021
0d57149
Exit code generation with a soft error if a program is federated on W…
Soroosh129 Sep 30, 2021
2f13f14
Skip C++ tests because Visual Studio compiler does not process vargs …
Soroosh129 Sep 30, 2021
c054317
Added a check for the CCpp target, which doesn't work on Windows
Soroosh129 Sep 30, 2021
33a2765
Added a NEVER_TAG_INITIALIZER
Soroosh129 Sep 30, 2021
c7ed1da
Use lf_nanosleep instead of nanosleep for test
Soroosh129 Sep 30, 2021
620229d
Changed how ports in contained reactors are initialized in reactions …
Soroosh129 Oct 1, 2021
c00d7e4
Fixed an issue related to contained reactor initialization in reactions
Soroosh129 Oct 1, 2021
ec099b9
Only use the Windows-specific argument if the host OS is Windows
Soroosh129 Oct 1, 2021
a637be9
Reverted back temporary fix that was causing reactions to have access…
Soroosh129 Oct 1, 2021
63d08af
Merge remote-tracking branch 'origin/master' into windows-c-target
Soroosh129 Oct 1, 2021
858fc9a
Use the maximum bank width to get around the VLA issue
Soroosh129 Oct 1, 2021
aff5ecb
Reverted back to using unnamed structs for contained reactors
Soroosh129 Oct 1, 2021
4925318
Fixed exception
Soroosh129 Oct 1, 2021
4550cc2
Exclude SERIALIZATION tests from runWithFourThreads
Soroosh129 Oct 1, 2021
ea2520c
Updated test to use platform support for threads
Soroosh129 Oct 1, 2021
d7f5ea9
Always use \n as line ending since it looks like generated files use …
Soroosh129 Oct 1, 2021
d92f705
Added run-multiple-times for Windows
Soroosh129 Oct 2, 2021
1bc51ba
Always use calloc to allocate arrays because malloc can randomly prod…
Soroosh129 Oct 5, 2021
d514ab7
Merge remote-tracking branch 'origin/master' into windows-c-target
Soroosh129 Oct 5, 2021
fa1ab27
Restore accidental change to example
Soroosh129 Oct 5, 2021
8119d6e
Added a check for cmake on Windows
Soroosh129 Oct 5, 2021
fc91342
Moved Windows test skipping to child test classes instead of having t…
Soroosh129 Oct 5, 2021
e1a4678
Instead of skipping four threads tests altogether on Windows, skip ta…
Soroosh129 Oct 5, 2021
b8a790a
Updated the requirements
Soroosh129 Oct 5, 2021
7fc73fb
Typo
Soroosh129 Oct 5, 2021
70985c6
Typo again
Soroosh129 Oct 5, 2021
a4388bd
Override isOSCompatible in the PythonGenerator
Soroosh129 Oct 5, 2021
bb2794b
Updated example to use platform thread functions
Soroosh129 Oct 5, 2021
02109f3
Fixes #572
Soroosh129 Oct 5, 2021
cd2495a
Replaced more pthreads with lf_threads
Soroosh129 Oct 5, 2021
341d793
Don't need fbactions
Soroosh129 Oct 5, 2021
e7974e2
Updated comment only
Soroosh129 Oct 5, 2021
67ba4f7
Typo
Soroosh129 Oct 5, 2021
195478b
Curly bracket
Soroosh129 Oct 5, 2021
2990d7e
Apply suggestions from @edwardalee code review
Soroosh129 Oct 5, 2021
b98c109
Updated comments and error messages to match
Soroosh129 Oct 5, 2021
dcd1fe8
Updated runWithFourThreads to exclude SERIALIZATION and TARGET tests …
Soroosh129 Oct 5, 2021
4528203
Cleaned up a bit
Soroosh129 Oct 5, 2021
9ff23cf
Addressed @lhstrh code review comments about error messages
Soroosh129 Oct 5, 2021
eba5305
Apply suggestions from code review
Soroosh129 Oct 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
c-tests:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Java JDK
Expand Down Expand Up @@ -107,6 +107,7 @@ jobs:
cmake ../
make
sudo make install
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
- name: Run C tests;
run: |
./gradlew test --tests org.lflang.tests.runtime.CTest.*
Expand Down Expand Up @@ -182,7 +183,7 @@ jobs:
python-tests:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Java JDK
Expand All @@ -203,8 +204,10 @@ jobs:
- name: Install Dependencies Windows
uses: lukka/run-vcpkg@v4
with:
vcpkgArguments: 'protobuf'
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgArguments: protobuf
vcpkgGitCommitId: 6185aa76504a5025f36754324abf307cc776f3da
vcpkgDirectory: ${{ github.workspace }}/vcpkg/
vcpkgTriplet: x64-windows-static
if: runner.os == 'Windows'
- name: Install Google API Python Client
run: pip3 install --upgrade google-api-python-client
Expand Down
34 changes: 15 additions & 19 deletions REQUIREMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ This document includes information about supported operating systems and externa
## Core Development Requirements

### **Supported Operating Systems**
| | C | C++ | Python | TypeScript |
|------------------------------|----|-----|--------|------------|
| Ubuntu 20.04 | Y | Y | Y | Y |
| MacOS 10.15 Catalina | Y | Y | Y | Y |
| Windows 10 1909<sup>†</sup> | Y | Y | Y | Y |
| Windows 10 2004<sup>†</sup> | Y | Y | Y | Y |

<sup>†</sup> **Experimental:** Windows support is still considered experimental. You can track our Windows support progress [here](https://github.com/icyphy/lingua-franca/issues?q=is%3Aissue+is%3Aopen+label%3AWindows).

| | OS Version | C | C++ | Python | TypeScript |
|---------|-------------------|----|-----|--------|------------|
| Ubuntu | >= 20.04 | Y | Y | Y | Y |
| MacOS | >= 10.15 Catalina | Y | Y | Y | Y |
| Windows | >= 10 1903 | Y | Y | Y | Y |

### **Dependencies**
- Java >= 11
Expand All @@ -28,32 +24,32 @@ However, to compile the generated code and to create a binary (which is done by


### Supported Operating Systems
| | C | C++ | Python | TypeScript |
|----------------------|---------------|-----|--------|------------|
| Ubuntu 20.04 | Y | Y | Y | Y |
| MacOS 10.15 Catalina | Y | Y | Y | Y |
| Windows 10 1909 | Y<sup>‡</sup> | Y | N | N |
| Windows 10 2004 | Y<sup>‡</sup> | N | N | N |

<sup>‡</sup> Requires WSL version 1 or version 2
| | OS Version | C | C++ | Python | TypeScript |
|---------|-------------------|---------------|-----|--------|------------|
| Ubuntu | >= 20.04 | Y | Y | Y | Y |
| MacOS | >= 10.15 Catalina | Y | Y | Y | Y |
| Windows | >= 10 1903 | Y | Y | Y | N |


### Dependencies

**C:**
- gcc >= 7 or MSVC >= 14.20 - 1920 (Visual Studio 2019)
- A C compiler (e.g., gcc >= 7, clang, or MSVC >= 14.20)
- CMAKE >= 3.13 (follow https://cmake.org/install/ for installation instructions)
- **Windows Only:** Windows Subsystem for Linux (WSL) version 1 or 2 with gcc installed - see https://docs.microsoft.com/en-us/windows/wsl/install-win10.
- **Windows Only:** Visual Studio >= 2019 and Windows SDK >= 10.0.18362.0
- **Programs using Protocol Buffers:** protoc-c 1.3.3 - see https://github.com/icyphy/lingua-franca/wiki/Protobufs.

**C++:**
- g++ >= 7 or MSVC >= 14.20 - 1920 (Visual Studio 2019)
- CMAKE >= 3.16 (follow https://cmake.org/install/ for installation instructions)
- **Windows Only:** Visual Studio >= 2019 and Windows SDK >= 10.0.18362.0

**Python:**
- A C compiler (e.g., gcc >= 7, clang, or MSVC >= 14.20)
- Python >= 3.6
- pip >= 20.0.2
- setuptools >= 45.2.0-1
- **Windows Only:** Visual Studio >= 2019 and Windows SDK >= 10.0.18362.0
- **Programs using Protocol Buffers:** protoc >= 3.6.1

**TypeScript:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
* https://docs.ros.org/en/foxy/Tutorials/Configuring-ROS2-Environment.html.
*
*/
target C {
target CCpp {
coordination: decentralized,
timeout: 10 sec,
cmake-include: "include/CMakeListsExtension.txt",
compiler: "g++"
cmake-include: "include/CMakeListsExtension.txt"
};

preamble {=
Expand Down
7 changes: 7 additions & 0 deletions bin/run-multiple-times.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# A handy script that will run a command multiple times
# Usage: run-multiple-times.ps1 command number_of_times
$executable=$args[0]
$number_of_times=$args[1]
for (($k = 0); $k -lt $number_of_times; $k++) {
Invoke-Expression $executable
}
4 changes: 2 additions & 2 deletions example/C/TrainDoor/TrainDoor.lf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ reactor MotionDetector {
output ok:bool;
reaction(startup) -> movement {=
buttons.move = movement;
pthread_t thread_id;
pthread_create(&thread_id, NULL, &read_input, NULL);
lf_thread_t thread_id;
lf_thread_create(&thread_id, &read_input, NULL);
=}
reaction(movement) {=
printf("Motion detected!\n");
Expand Down
4 changes: 2 additions & 2 deletions example/C/src/Deadline.lf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ reactor Sensor {
output y:bool;

reaction(startup) -> response {=
pthread_t thread_id;
pthread_create(&thread_id, NULL, &read_input, response);
lf_thread_t thread_id;
lf_thread_create(&thread_id, &read_input, response);
printf("Press Enter to produce a sensor value.\n");
=}

Expand Down
3 changes: 1 addition & 2 deletions example/C/src/MQTT/MQTTPublisher.lf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Edward A. Lee
*/
target C {
threads: 1 // This makes sure pthreads is included and gives access to the mutex.
threads: 1 // This makes sure the threaded runtime is used, giving access to the mutex.
};

/**
Expand Down Expand Up @@ -44,7 +44,6 @@ reactor MQTTPublisher (
preamble {=
#include "MQTTClient.h"
#include "core/federated/net_util.h"
#include <pthread.h>

// Timeout for completion of message sending in milliseconds.
#define TIMEOUT 10000L
Expand Down
7 changes: 3 additions & 4 deletions example/C/src/MQTT/MQTTSubscriber.lf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @author Edward A. Lee
*/
target C {
threads: 1 // This makes sure pthreads is included and gives access to the mutex.
threads: 1 // This makes sure the threaded runtime is used, giving access to the mutex.
};

/**
Expand Down Expand Up @@ -66,7 +66,6 @@ reactor MQTTSubscriber (
preamble {=
#include "MQTTClient.h"
#include "core/federated/net_util.h"
#include <pthread.h>

#define QOS 2
#define TIMEOUT 10000L
Expand Down Expand Up @@ -103,7 +102,7 @@ reactor MQTTSubscriber (
// NOTE: Since schedule_copy also acquires this lock, we assume here that the
// pthreads library correctly implements recursive mutex locks to unlock all
// locks held by the current thread when waiting for signals.
pthread_mutex_lock(&mutex);
lf_mutex_lock(&mutex);

instant_t timestamp = extract_int64((unsigned char*)message->payload + message->payloadlen - sizeof(instant_t));
interval_t delay = timestamp - get_logical_time();
Expand All @@ -127,7 +126,7 @@ reactor MQTTSubscriber (
// can measure the latency.
schedule_copy(incoming_message, delay, (char*)message->payload, message->payloadlen);

pthread_mutex_unlock(&mutex);
lf_mutex_unlock(&mutex);

// MQTTClient_freeMessage() also frees the memory allocated to the payload,
// which is why we have to copy the message here.
Expand Down
4 changes: 2 additions & 2 deletions example/C/src/ReflexGame.lf
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ reactor GetUserInput {

reaction(startup) -> user_response {=
// Start the thread that listens for Enter or Return.
pthread_t thread_id;
pthread_create(&thread_id, NULL, &read_input, user_response);
lf_thread_t thread_id;
lf_thread_create(&thread_id, &read_input, user_response);
=}

reaction(prompt) {=
Expand Down
4 changes: 2 additions & 2 deletions example/ReflexGame/ReflexGameTest.lf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ main reactor {
}
=}

state thread_id:pthread_t(0);
state thread_id:lf_thread_t(0);
state request_time:time(0);
// NOTE: The following will get the default 1 nsec minimum
// interarrival time.
Expand All @@ -28,7 +28,7 @@ main reactor {
reaction(startup) -> a {=
// Start listening for key strokes.
// Note that these will not be received until Enter.
pthread_create(&self->thread_id, NULL, &read_char, a);
lf_thread_create(&self->thread_id, &read_char, a);
printf("Enter character(s) followed by return: ");
self->request_time = get_logical_time();
=}
Expand Down
2 changes: 1 addition & 1 deletion org.lflang.tests/src/org/lflang/tests/TestRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Set<LFTest> getTests(Target t, TestCategory c) {
* @author Marten Lohstroh <marten@berkeley.edu>
*/
public enum TestCategory {
CONCURRENT(true), GENERIC(true), MULTIPORT(true), TARGET(false),
CONCURRENT(true), GENERIC(true), MULTIPORT(true), SERIALIZATION(false), TARGET(false),
FEDERATED(true), EXAMPLE(false), EXAMPLE_TEST(false);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public void runWithFourThreads() {
super.runWithFourThreads();
}
}

@Test
@Override
public void runSerializationTests() {
for (var target : Target.values()) {
this.target = target;
super.runSerializationTests();
}
}

@Test
@Override
Expand Down
29 changes: 29 additions & 0 deletions org.lflang.tests/src/org/lflang/tests/runtime/CTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public void runGenericTests() {
@Test
@Override
public void runTargetSpecificTests() {
if(isWindows()) {
printTestHeader("Warning: Skipping C target-specific tests on Windows.");
return;
}
super.runTargetSpecificTests();
}

Expand All @@ -85,11 +89,27 @@ public void runMultiportTests() {
public void runWithFourThreads() {
super.runWithFourThreads();
}

@Test
@Override
public void runSerializationTests() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping serialization tests on Windows.");
return;
}
super.runSerializationTests();
}

@Test
@Disabled("TODO only 27/96 tests pass")
@Override
public void runAsFederated() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping federated tests on Windows.");
return;
}
super.runAsFederated();
}

Expand All @@ -102,6 +122,11 @@ public void runConcurrentTests() {
@Test
@Override
public void runFederatedTests() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping federated tests on Windows.");
return;
}
super.runFederatedTests();
}

Expand All @@ -113,6 +138,10 @@ public void runFederatedTests() {
*/
@Test
public void runAsCCpp() {
if(isWindows()) {
printTestHeader("Warning: Skipping CCpp tests on Windows.");
return;
}
printTestHeader(RUN_AS_CCPP_DESC);

EnumSet<TestCategory> categories = EnumSet.allOf(TestCategory.class);
Expand Down
6 changes: 6 additions & 0 deletions org.lflang.tests/src/org/lflang/tests/runtime/CppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public void runWithFourThreads() {
printTestHeader(RUN_WITH_FOUR_THREADS_DESC);
System.out.println("N/A");
}

@Test
@Override
public void runSerializationTests() {
super.runSerializationTests();
}

@Test
@Override
Expand Down
21 changes: 21 additions & 0 deletions org.lflang.tests/src/org/lflang/tests/runtime/PythonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,26 @@ public class PythonTest extends TestBase {
@Override public void runMultiportTests() {
super.runMultiportTests();
}

@Test
@Override
public void runSerializationTests() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping serialization tests on Windows.");
return;
}
super.runSerializationTests();
}

@Test
@Disabled("TODO")
@Override public void runAsFederated() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping federated tests on Windows.");
return;
}
super.runAsFederated();
}

Expand All @@ -74,6 +90,11 @@ public class PythonTest extends TestBase {

@Test
@Override public void runFederatedTests() {
// Skip the test if the OS is Windows
if(isWindows()) {
printTestHeader("Warning: Skipping federated tests on Windows.");
return;
}
super.runFederatedTests();
}
}
15 changes: 13 additions & 2 deletions org.lflang.tests/src/org/lflang/tests/runtime/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@ public void runMultiportTests() {
printTestHeader("Description: Run multiport tests (threads = 0).");
runUnthreaded(TestCategory.MULTIPORT);
}


@Test
public void runSerializationTests() {
printTestHeader("Description: Run serialization tests.");
runTestsAndPrintResults(target, TestCategory.SERIALIZATION::equals, null, false);
}

@Test
public void runAsFederated() {
printTestHeader(RUN_AS_FEDERATED_DESC);

EnumSet<TestCategory> categories = EnumSet.allOf(TestCategory.class);
categories.removeAll(EnumSet.of(TestCategory.CONCURRENT,
TestCategory.FEDERATED,
Expand Down Expand Up @@ -202,6 +206,13 @@ public void runFederatedTests() {
}


/** Returns true if the operating system is Windows. */
protected boolean isWindows() {
String OS = System.getProperty("os.name").toLowerCase();
if (OS.indexOf("win") >= 0) { return true; }
return false;
}

//
private static void restoreOutputs() {
System.out.flush();
Expand Down
Loading