diff --git a/include/reactor-uc/macros.h b/include/reactor-uc/macros.h index f2697079..5163632e 100644 --- a/include/reactor-uc/macros.h +++ b/include/reactor-uc/macros.h @@ -597,8 +597,8 @@ typedef struct FederatedOutputConnection FederatedOutputConnection; #define LF_INITIALIZE_FEDERATED_OUTPUT_CONNECTION(ReactorName, OutputName, SerializeFunc) \ ReactorName##_##OutputName##_conn_ctor(&self->OutputName, self->super.parent, &self->super); \ - self->outputs[_outputs_idx] = &self->OutputName.super; \ - self->serialize_hooks[_outputs_idx] = SerializeFunc; \ + self->outputs[_outputs_idx] = &self->OutputName.super; \ + self->serialize_hooks[_outputs_idx] = SerializeFunc; \ _outputs_idx++; typedef struct FederatedInputConnection FederatedInputConnection; diff --git a/include/reactor-uc/platform/posix/tcp_ip_channel.h b/include/reactor-uc/platform/posix/tcp_ip_channel.h index d9ecb3a8..b744d8d5 100644 --- a/include/reactor-uc/platform/posix/tcp_ip_channel.h +++ b/include/reactor-uc/platform/posix/tcp_ip_channel.h @@ -25,8 +25,8 @@ struct TcpIpChannel { int fd; int client; - int send_failed_event_fds; // These file descriptors are used to signal the recv select to stop blocking - int terminate_event_fds[2]; + int send_failed_event_fds[2]; // These file descriptors are used to signal the recv select to stop blocking + int terminate_event_fds; NetworkChannelState state; pthread_mutex_t mutex; diff --git a/src/logging.c b/src/logging.c index ab6e6d46..bc41fb5d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -61,7 +61,7 @@ void log_message(int level, const char *module, const char *fmt, ...) { break; } #endif - log_printf("%"PRId64 " [%s] [%s] ",_lf_environment->get_elapsed_physical_time(_lf_environment), level_str, module); + log_printf("%" PRId64 " [%s] [%s] ", _lf_environment->get_elapsed_physical_time(_lf_environment), level_str, module); Platform_vprintf(fmt, args); #ifdef LF_COLORIZE_LOGS log_printf(ANSI_COLOR_RESET); diff --git a/src/platform/posix/posix.c b/src/platform/posix/posix.c index 4973c842..05a3c932 100644 --- a/src/platform/posix/posix.c +++ b/src/platform/posix/posix.c @@ -8,7 +8,6 @@ static PlatformPosix platform; - static instant_t convert_timespec_to_ns(struct timespec tp) { return ((instant_t)tp.tv_sec) * BILLION + tp.tv_nsec; } void Platform_vprintf(const char *fmt, va_list args) { vprintf(fmt, args); } diff --git a/src/platform/posix/tcp_ip_channel.c b/src/platform/posix/tcp_ip_channel.c index 2a3cb338..5b1b24a9 100644 --- a/src/platform/posix/tcp_ip_channel.c +++ b/src/platform/posix/tcp_ip_channel.c @@ -84,8 +84,8 @@ static lf_ret_t _TcpIpChannel_reset_socket(TcpIpChannel *self) { } } - if (self->send_failed_event_fds > 0) { - if (close(self->send_failed_event_fds) < 0) { + if (self->send_failed_event_fds[0] > 0) { + if (close(self->send_failed_event_fds[0]) < 0) { TCP_IP_CHANNEL_ERR("Error closing sending failed fds=%d", errno); return LF_ERR; } diff --git a/test/lf/Makefile b/test/lf/Makefile index 7250352a..54f98004 100644 --- a/test/lf/Makefile +++ b/test/lf/Makefile @@ -1,6 +1,10 @@ # Very simple Makefile script to build and compile all the LF tests. SRCS = $(wildcard src/*.lf) BINS = $(patsubst src/%.lf, bin/%, $(SRCS)) + +SRCS_ONLY_BUILD = $(wildcard src/only_build/*.lf) +BINS_ONLY_BUILD = $(patsubst src/only_build/%.lf, bin/%, $(SRCS)) + LFC_PATH=../../lfc LFC = ${LFC_PATH}/build/install/lf-cli/bin/lfc @@ -14,5 +18,8 @@ bin/%: src/%.lf ${LFC} $^ -c ./$@ +bin/%: src/only_build/%.lf + ${LFC} $^ -c + clean: rm -rf build bin src-gen \ No newline at end of file diff --git a/test/lf/src/FederatedBank.lf b/test/lf/src/FederatedBank.lf index 54bd279a..8cacfcd8 100644 --- a/test/lf/src/FederatedBank.lf +++ b/test/lf/src/FederatedBank.lf @@ -17,21 +17,27 @@ reactor Fed(bank_idx: int = 0) { output out: int input in: int input in2: int - state check: bool = false + state check1: bool = false + state check2: bool = false reaction(in) -> out {= printf("Received %d from src \n", in->value); lf_set(out, self->bank_idx); validate(in->value == 42); + validate(!self->check2); + self->check1 = true; =} reaction(in2) {= printf("Received %d from myself\n", in2->value); validate(in2->value == self->bank_idx); + validate(self->check1); + self->check2 = true; =} reaction(shutdown) {= - validate(self->check); + validate(self->check2); + validate(self->check1); =} } diff --git a/test/lf/src/FederatedBankMultiport.lf b/test/lf/src/FederatedBankMultiport.lf index 2cfd86f6..0e428d3c 100644 --- a/test/lf/src/FederatedBankMultiport.lf +++ b/test/lf/src/FederatedBankMultiport.lf @@ -19,6 +19,7 @@ reactor Fed(bank_idx: int = 0) { reaction(in) {= for (int i = 0; ivalue == i); if (self->bank_idx == 0) { printf("%"PRId64" Fed %u Received %d from %d \n", env->get_elapsed_logical_time(env), self->bank_idx, in[i]->value, i); } diff --git a/test/lf/src/FederatedAttrCustom.lf b/test/lf/src/only_build/FederatedAttrCustom.lf similarity index 100% rename from test/lf/src/FederatedAttrCustom.lf rename to test/lf/src/only_build/FederatedAttrCustom.lf diff --git a/test/lf/src/FederatedCoap.lf b/test/lf/src/only_build/FederatedCoap.lf similarity index 100% rename from test/lf/src/FederatedCoap.lf rename to test/lf/src/only_build/FederatedCoap.lf