diff --git a/compiler2/ttcn3/Ttcnstuff.cc b/compiler2/ttcn3/Ttcnstuff.cc index 2d714f8dc15704b65d5a68929a6eeb9487e4a012..7887633ef5a3a986b9bc61603db68686e196a636 100644 --- a/compiler2/ttcn3/Ttcnstuff.cc +++ b/compiler2/ttcn3/Ttcnstuff.cc @@ -2493,16 +2493,6 @@ namespace Ttcn { pdef.provider_msg_in.elements = NULL; } - if (port_type == PT_PROVIDER) { - pdef.mapper_name = (const char**)Malloc(mapper_types.size() * sizeof(const char*)); - pdef.mapper_realtime = (boolean*)Malloc(mapper_types.size() * sizeof(boolean)); - pdef.n_mapper_name = mapper_types.size(); - for (size_t i = 0; i < mapper_types.size(); i++) { - pdef.mapper_name[i] = pool.add(mapper_types[i]->get_genname_value(my_scope)); - pdef.mapper_realtime[i] = mapper_types[i]->get_PortBody()->is_realtime(); - } - } - defPortClass(&pdef, target); if (generate_skeleton && testport_type != TP_INTERNAL && (port_type != PT_USER || !legacy)) generateTestPortSkeleton(&pdef); @@ -2537,8 +2527,6 @@ namespace Ttcn { for (size_t i = 0; i < pdef.provider_msg_outlist.nElements; i++) Free(pdef.provider_msg_outlist.elements[i].out_msg_type_names); Free(pdef.provider_msg_outlist.elements); - Free(pdef.mapper_name); - Free(pdef.mapper_realtime); Free(pdef.var_decls); Free(pdef.var_defs); Free(pdef.mapping_func_decls); diff --git a/compiler2/ttcn3/port.c b/compiler2/ttcn3/port.c index c1545afb767adc4185b3e385699bb10911765937..b70ed1dd680defed42eb499fbb79ad0d5b05c3c1 100644 --- a/compiler2/ttcn3/port.c +++ b/compiler2/ttcn3/port.c @@ -1752,13 +1752,11 @@ void defPortClass(const port_def* pdef, output_struct* output) } // Port type variables in the provider types. - if (pdef->n_mapper_name > 0) { - def = mputstr(def, "private:\n"); - for (i = 0; i < pdef->n_mapper_name; i++) { - def = mputprintf(def, - "%s** p_%i;\n" - "size_t n_%i;\n", pdef->mapper_name[i], (int)i, (int)i); - } + if (pdef->port_type == PROVIDER) { + def = mputstr(def, + "private:\n" + "PORT** mapped_ports;\n" + "size_t n_mapped_ports;\n"); } def = mputstr(def, "public:\n"); @@ -1789,10 +1787,10 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, "port_state = UNSET;\n"); } // Port type variables in the provider types. - for (i = 0; i < pdef->n_mapper_name; i++) { - src = mputprintf(src, - "p_%i = NULL;\n" - "n_%i = 0;\n", (int)i, (int)i); + if (pdef->port_type == PROVIDER) { + src = mputstr(src, + "mapped_ports = NULL;\n" + "n_mapped_ports = 0;\n"); } src = mputstr(src, "}\n\n"); @@ -2311,76 +2309,54 @@ void defPortClass(const port_def* pdef, output_struct* output) } // Port type variables in the provider types. - if (pdef->n_mapper_name > 0) { + if (pdef->port_type == PROVIDER) { def = mputstr(def, "public:\n"); // add_port and remove_port is called after the map and unmap statements. def = mputstr(def, "void add_port(PORT* p);\n"); - src = mputprintf(src, "void %s::add_port(PORT* p)\n{\n", class_name); - for (i = 0; i < pdef->n_mapper_name; i++) { - src = mputprintf(src, - "%s* x_%i = dynamic_cast<%s*>(p);\n" - "if (x_%i != NULL) {\n" - "n_%i++;\n" - "p_%i = static_cast<%s**>(Realloc(p_%i, n_%i * sizeof(%s*)));\n" - "p_%i[n_%i-1] = x_%i;\n" - "return;\n" - "}\n", - pdef->mapper_name[i], (int)i, - pdef->mapper_name[i], (int)i, (int)i, - (int)i, pdef->mapper_name[i], (int)i, (int)i, - pdef->mapper_name[i], (int)i, (int)i, (int)i); - } - src = mputstr(src, - "TTCN_error(\"Internal error: Adding invalid port type.\");\n" - "}\n\n"); + src = mputprintf(src, + "void %s::add_port(PORT* p)\n" + "{\n" + "++n_mapped_ports;\n" + "mapped_ports = static_cast<PORT**>(Realloc(mapped_ports, " + "n_mapped_ports * sizeof(PORT*)));\n" + "mapped_ports[n_mapped_ports - 1] = p;\n" + "}\n\n", class_name); def = mputstr(def, "void remove_port(PORT* p);\n"); - src = mputprintf(src, "void %s::remove_port(PORT* p)\n{\n", class_name); - - for (i = 0; i < pdef->n_mapper_name; i++) { - src = mputprintf(src, - "%s* x_%i = dynamic_cast<%s*>(p);\n" - "if (x_%i != NULL) {\n" - "for (size_t i = 0; i < n_%i; i++) {\n" - "if (p_%i[i] == x_%i) {\n" - "p_%i[i] = NULL;\n" - "}\n" - "}\n" - "size_t size = 0;\n" - "%s** port_list = NULL;\n" - "for (size_t i = 0; i < n_%i; i++) {\n" - "if (p_%i[i] != NULL) {\n" - "size++;\n" - "port_list = static_cast<%s**>(Realloc(port_list, size * sizeof(%s*)));\n" - "port_list[size-1] = p_%i[i];\n" - "}\n" - "}\n" - "Free(p_%i);\n" - "p_%i = port_list;\n" - "n_%i = size;\n" - "return;\n" - "}\n", - pdef->mapper_name[i], (int)i, pdef->mapper_name[i], (int)i, - (int)i, (int)i, (int)i, (int)i, pdef->mapper_name[i], (int)i, (int)i, - pdef->mapper_name[i], pdef->mapper_name[i], - (int)i, (int)i, (int)i, (int)i); - } - - src = mputstr(src, - "TTCN_error(\"Internal error: Removing invalid port type.\");\n" - "}\n\n"); + src = mputprintf(src, + "void %s::remove_port(PORT* p)\n" + "{\n" + "size_t new_size = n_mapped_ports;\n" + "for (size_t i = 0; i < n_mapped_ports; ++i) {\n" + "if (mapped_ports[i] == p) {\n" + "mapped_ports[i] = NULL;\n" + "--new_size;\n" + "}\n" + "}\n" + "if (new_size != n_mapped_ports) {\n" + "PORT** new_list = static_cast<PORT**>(Malloc(new_size * sizeof(PORT*)));\n" + "for (size_t i = 0, j = 0; i < n_mapped_ports; ++i) {\n" + "if (mapped_ports[i] != NULL) {\n" + "new_list[j] = mapped_ports[i];\n" + "++j;\n" + "}\n" + "}\n" + "Free(mapped_ports);\n" + "mapped_ports = new_list;\n" + "n_mapped_ports = new_size;\n" + "}\n" + "}\n\n", class_name); def = mputstr(def, "private:\n"); // Resets all port type variables to NULL def = mputstr(def, "void reset_port_variables();\n"); - src = mputprintf(src, "void %s::reset_port_variables() {\n", class_name); - for (i = 0; i < pdef->n_mapper_name; i++) { - src = mputprintf(src, - "Free(p_%i);\n" - "p_%i = NULL;\n" - "n_%i = 0;\n", (int)i, (int)i, (int)i); - } - src = mputstr(src, "}\n\n"); + src = mputprintf(src, + "void %s::reset_port_variables()\n" + "{\n" + "Free(mapped_ports);\n" + "mapped_ports = NULL;\n" + "n_mapped_ports = 0;\n" + "}\n\n", class_name); } if ((pdef->testport_type != INTERNAL || !pdef->legacy) && @@ -2608,7 +2584,7 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputstr(def, "public:\n"); // Generate new functions for provider types to avoid changing the visibility of outgoing_send - if (pdef->n_mapper_name > 0) { + if (pdef->port_type == PROVIDER) { for (i = 0; i < pdef->msg_out.nElements; i++) { def = mputprintf(def, "void outgoing_public_send(" "const %s& send_par%s);\n", pdef->msg_out.elements[i].name, @@ -2767,9 +2743,6 @@ void defPortClass(const port_def* pdef, output_struct* output) if (pdef->port_type == USER) { /* incoming_message() functions for the incoming types of the provider * port type */ - if (!pdef->legacy) { - def = mputstr(def, "public:\n"); - } for (i = 0; i < pdef->provider_msg_in.nElements; i++) { const port_msg_mapped_type *mapped_type = pdef->provider_msg_in.elements + i; @@ -2866,11 +2839,43 @@ void defPortClass(const port_def* pdef, output_struct* output) } src = mputstr(src, "}\n\n"); } + + if (!pdef->legacy && pdef->provider_msg_in.nElements) { + /* virtual incoming_message_handler function */ + def = mputprintf(def, + "boolean incoming_message_handler(const void* message_ptr, " + "const char* message_type, component sender_component, " + "const FLOAT& timestamp);\n"); /* TODO: address? */ + + src = mputprintf(src, + "boolean %s::incoming_message_handler(const void* message_ptr, " + "const char* message_type, component sender_component, " + "const FLOAT&%s)\n" + "{\n", class_name, pdef->realtime ? " timestamp" : ""); + for (i = 0; i < pdef->provider_msg_in.nElements; i++) { + const port_msg_mapped_type* mapped_type = + pdef->provider_msg_in.elements + i; + if (i > 0) { + src = mputstr(src, "else "); + } + src = mputprintf(src, + "if (strcmp(message_type, \"%s\") == 0) {\n" + "const %s* typed_ptr = reinterpret_cast<const %s*>(message_ptr);\n" + "if (typed_ptr == NULL) {\n" + "TTCN_error(\"Internal error: Type of message in incoming message " + "handler function is not the indicated `%s'\");\n" + "}\n" + "incoming_message(*typed_ptr, sender_component%s);\n" + "return TRUE;\n" + "}\n", mapped_type->dispname, mapped_type->name, mapped_type->name, + mapped_type->dispname, pdef->realtime ? ", timestamp" : ""); + } + src = mputstr(src, + "return FALSE;\n" + "}\n\n"); + } } else { /* not user */ /* incoming_message functions */ - if (pdef->port_type == PROVIDER && pdef->n_mapper_name > 0) { - def = mputstr(def, "public:\n"); - } for (i = 0; i < pdef->msg_in.nElements; i++) { def = mputprintf(def, "void incoming_message(const %s& " "incoming_par, component sender_component", @@ -2895,18 +2900,17 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputstr(src, ", const FLOAT& timestamp"); } src = mputstr(src, ")\n{\n"); - if (pdef->port_type == PROVIDER && pdef->n_mapper_name > 0) { + if (pdef->port_type == PROVIDER) { // We forward the incoming_message to the mapped port - for (size_t j = 0; j < pdef->n_mapper_name; j++) { - src = mputprintf(src, - "for (size_t i = 0; i < n_%i; i++) {\n" - "if (p_%i[i] != NULL) {\n" - "p_%i[i]->incoming_message(incoming_par, sender_component%s);\n" - "return;\n}" - "}\n", - (int)j, (int)j, (int)j, - (pdef->realtime && pdef->mapper_realtime[j]) ? ", timestamp" : ""); - } + src = mputprintf(src, + "for (size_t i = 0; i < n_mapped_ports; i++) {\n" + "if (mapped_ports[i] != NULL && mapped_ports[i]->" + "incoming_message_handler(&incoming_par, \"%s\", sender_component, %s)) {\n" + "return;\n" + "}\n" + "}\n", + pdef->msg_in.elements[i].dispname, + pdef->realtime ? "timestamp" : "FLOAT()"); } src = mputstr(src, "if (!is_started) TTCN_error(\"Port %s is not started but a " @@ -2956,8 +2960,7 @@ void defPortClass(const port_def* pdef, output_struct* output) } } - if ((pdef->port_type == PROVIDER && pdef->n_mapper_name > 0) || - (pdef->port_type == USER && !pdef->legacy)) { + if (pdef->port_type == PROVIDER || (pdef->port_type == USER && !pdef->legacy)) { def = mputstr(def, "private:\n"); } diff --git a/compiler2/ttcn3/port.h b/compiler2/ttcn3/port.h index 39b055f3a8a26b5818f8aadff90339317db64808..33c8b1ac9b2fce3362691a207747dcfb82bf7732 100644 --- a/compiler2/ttcn3/port.h +++ b/compiler2/ttcn3/port.h @@ -116,9 +116,6 @@ typedef struct port_def_tag { testport_type_t testport_type; port_type_t port_type; port_msg_prov_list provider_msg_outlist; - const char **mapper_name; - boolean* mapper_realtime; - size_t n_mapper_name; port_msg_mapped_type_list provider_msg_in; boolean has_sliding; boolean legacy; // true if the old user port is used false if translation ports used diff --git a/core/Port.cc b/core/Port.cc index cd626e0c60b98fd86fb1b180594cb0f5f8dc2195..a50ee166e895fcee9e920e4cca1b14259be7e7cd 100644 --- a/core/Port.cc +++ b/core/Port.cc @@ -525,6 +525,12 @@ PORT* PORT::get_provider_port() { return NULL; } +boolean PORT::incoming_message_handler(const void* message_ptr, const char* message_type, + component sender_component, const FLOAT& timestamp) +{ + return FALSE; +} + alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { TTCN_Logger::log_matching_problem( diff --git a/core/Port.hh b/core/Port.hh index b46e608f2bcf59287e72cc838a4163fe6e6dab37..405fb66474105ec8e915c58307f968e46adaf2d4 100644 --- a/core/Port.hh +++ b/core/Port.hh @@ -157,6 +157,9 @@ public: // capability and dual faced ports. virtual PORT* get_provider_port(); + virtual boolean incoming_message_handler(const void* message_ptr, const char* message_type, + component sender_component, const FLOAT& timestamp); + boolean check_port_state(const CHARSTRING& type) const; static boolean any_check_port_state(const CHARSTRING& type); static boolean all_check_port_state(const CHARSTRING& type); diff --git a/regression_test/Makefile b/regression_test/Makefile index c3db18b1274f9d1ded4b01d7ede8a0cd00fbeceb..45d2990086e4b59bf29e1ef9dcbdcb785ae103ca 100644 --- a/regression_test/Makefile +++ b/regression_test/Makefile @@ -49,7 +49,7 @@ all_from lazyEval tryCatch text2ttcn json ttcn2json profiler templateOmit \ customEncoding makefilegen uidChars checkstate hostid templateIstemplatekind \ selectUnion templateExclusiveRange any_from templatePatternRef indexWithRecofArray \ connectMapOperTest fuzzy portTranslation ischosen OER functionSubref done \ -nondeterministicDefaultParam predefFunction2 realtime +nondeterministicDefaultParam predefFunction2 realtime portTranslationCentralStorage ifdef DYN DIRS += loggerplugin junitlogger diff --git a/regression_test/portTranslationCentralStorage/Makefile b/regression_test/portTranslationCentralStorage/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..a1fccc8ee767572741c5c70c86632b167fc4b69d --- /dev/null +++ b/regression_test/portTranslationCentralStorage/Makefile @@ -0,0 +1,20 @@ +############################################################################## +# Copyright (c) 2000-2018 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Baranyi, Botond +# +############################################################################## +TOPDIR := .. +include ../Makefile.regression + +.PHONY: all run clean distclean dep + +all clean distclean dep run: + $(MAKE) -C ProjA/bin $@ + $(MAKE) -C ProjB/bin $@ + diff --git a/regression_test/portTranslationCentralStorage/ProjA/bin/.gitignore b/regression_test/portTranslationCentralStorage/ProjA/bin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f0451b8b03200dc7f63c276adaef43c3f7209b88 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/bin/.gitignore @@ -0,0 +1,8 @@ +ProjA +ProjA.exe +A*.cc +A*.hh +*.o +*.d +compile +*.log diff --git a/regression_test/portTranslationCentralStorage/ProjA/bin/Makefile b/regression_test/portTranslationCentralStorage/ProjA/bin/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0ee1443d2f93c41b9b606621c1d0e0ea6a2dd384 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/bin/Makefile @@ -0,0 +1,155 @@ +############################################################################## +# Copyright (c) 2000-2018 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Baranyi, Botond +# +############################################################################## +TOPDIR := ../../.. +include ../../../Makefile.regression + +# +# Do NOT touch this line... +# +.PHONY: all run archive check clean dep objects + +.SUFFIXES: .d + +# +# Set these variables... +# + +# Flags for the C++ preprocessor (and makedepend as well): +CPPFLAGS += -I. -I../src + +#CXXFLAGS += -save-temps +CXXFLAGS += -g + +# Flags for dependency generation +CXXDEPFLAGS = -MM + +# Flags for the linker: +LDFLAGS += -g + +ifeq ($(PLATFORM), WIN32) +# Silence linker warnings. +LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc +endif + +# Flags for the TTCN-3 and ASN.1 compiler: +COMPILER_FLAGS += -I + +# Execution mode: (either ttcn3 or ttcn3-parallel) +TTCN3_LIB = ttcn3$(RT2_SUFFIX)-parallel$(DYNAMIC_SUFFIX) + + +# TTCN-3 modules of this project: +TTCN3_MODULES = ../src/A.ttcn + +# ASN.1 modules of this project: +ASN1_MODULES = + +# C++ source & header files generated from the TTCN-3 & ASN.1 modules of +# this project: +GENERATED_SOURCES = A.cc +GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) +ifdef SPLIT_TO_SLICES +POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) +POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) +GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) +GENERATED_SOURCES += $(GENERATED_SOURCES2) +endif +# C/C++ Source & header files of Test Ports, external functions and +# other modules: +USER_SOURCES = ../src/PortA.cc ../src/PortA_RT.cc +USER_HEADERS = $(USER_SOURCES:.cc=.hh) + +# Object files of this project that are needed for the executable test suite: +OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) + +GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o) + +USER_OBJECTS = PortA.o PortA_RT.o + +DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d) + +# Other files of the project (Makefile, configuration files, etc.) +# that will be added to the archived source files: +OTHER_FILES = Makefile + +# The name of the executable test suite: +TARGET = ProjA$(EXESUFFIX) + +# +# Rules for building the executable... +# + +all: $(TARGET) ; + +objects: $(OBJECTS) ; + +$(TARGET): $(OBJECTS) + $(TTCN3_DIR)/bin/titanver $(OBJECTS) + $(CXX) $(LDFLAGS) -o $@ $^ \ + -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ + -L$(OPENSSL_DIR)/lib -lcrypto \ + -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) + +PortA.o : ../src/PortA.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +PortA_RT.o : ../src/PortA_RT.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +.cc.o .c.o: + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +PortA.d : ../src/PortA.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +PortA_RT.d : ../src/PortA_RT.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +.cc.d .c.d: + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile + @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi + +compile: $(TTCN3_MODULES) $(ASN1_MODULES) + $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) $^ - $? + touch $@ + +clean distclean: + -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) compile $(DEPFILES) \ + *.log + +dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; + +ifeq ($(findstring n,$(MAKEFLAGS)),) +ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) +-include $(DEPFILES) +endif +endif + + +# +# Add your rules here if necessary... +# + +run: $(TARGET) + diff --git a/regression_test/portTranslationCentralStorage/ProjA/src/A.ttcn b/regression_test/portTranslationCentralStorage/ProjA/src/A.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..755830e526b4ed3b762d20f51cddabe3d504171f --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/src/A.ttcn @@ -0,0 +1,34 @@ +/****************************************************************************** + * Copyright (c) 2000-2018 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Baranyi, Botond + * + ******************************************************************************/ + +// This module tests translation ports when using central storage (or project +// references in the Eclipse Designer plug-in) + +// The provider port types declared here must work in translation mode with +// user ports from another project +module A { + +type port PortA message { + inout integer +} +with { + extension "provider" +} + +type port PortA_RT message realtime { + inout integer +} +with { + extension "provider" +} + +} diff --git a/regression_test/portTranslationCentralStorage/ProjA/src/PortA.cc b/regression_test/portTranslationCentralStorage/ProjA/src/PortA.cc new file mode 100644 index 0000000000000000000000000000000000000000..7b6acf3c5ca43369fd9604996b033503b370f230 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/src/PortA.cc @@ -0,0 +1,78 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 15:58:49 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortA.hh" +#include "A.hh" + +namespace A { + +PortA_PROVIDER::PortA_PROVIDER(const char *par_port_name) + : PORT(par_port_name) +{ + +} + +PortA_PROVIDER::~PortA_PROVIDER() +{ + +} + +void PortA_PROVIDER::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortA_PROVIDER::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortA_PROVIDER::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortA_PROVIDER::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortA_PROVIDER::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortA_PROVIDER::Handle_Timeout(double time_since_last_call) {}*/ + +void PortA_PROVIDER::user_map(const char * /*system_port*/) +{ + +} + +void PortA_PROVIDER::user_unmap(const char * /*system_port*/) +{ + +} + +void PortA_PROVIDER::user_start() +{ + +} + +void PortA_PROVIDER::user_stop() +{ + +} + +void PortA_PROVIDER::outgoing_send(const INTEGER& send_par) +{ + incoming_message(send_par * 10 + 6); +} + +} /* end of namespace */ + diff --git a/regression_test/portTranslationCentralStorage/ProjA/src/PortA.hh b/regression_test/portTranslationCentralStorage/ProjA/src/PortA.hh new file mode 100644 index 0000000000000000000000000000000000000000..bbdb67a8e68939eaccfb133125d36584083b352b --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/src/PortA.hh @@ -0,0 +1,49 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 15:58:49 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortA_HH +#define PortA_HH + +#include <TTCN3.hh> + +// Note: Header file A.hh must not be included into this file! +// (because it includes this file) +// Please add the declarations of message types manually. + +namespace A { + +class PortA_PROVIDER : public PORT { +public: + PortA_PROVIDER(const char *par_port_name); + ~PortA_PROVIDER(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const INTEGER& send_par); + virtual void incoming_message(const INTEGER& incoming_par) = 0; +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.cc b/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.cc new file mode 100644 index 0000000000000000000000000000000000000000..f1d6dcef7ae9ac29ac74ef813da02adb52f2a7f3 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.cc @@ -0,0 +1,81 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Jan 10 15:59:28 2019 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortA_RT.hh" +#include "A.hh" + +namespace A { + +PortA__RT_PROVIDER::PortA__RT_PROVIDER(const char *par_port_name) + : PORT(par_port_name) +{ + +} + +PortA__RT_PROVIDER::~PortA__RT_PROVIDER() +{ + +} + +void PortA__RT_PROVIDER::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortA__RT_PROVIDER::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortA__RT_PROVIDER::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortA__RT_PROVIDER::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortA__RT_PROVIDER::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortA__RT_PROVIDER::Handle_Timeout(double time_since_last_call) {}*/ + +void PortA__RT_PROVIDER::user_map(const char * /*system_port*/) +{ + +} + +void PortA__RT_PROVIDER::user_unmap(const char * /*system_port*/) +{ + +} + +void PortA__RT_PROVIDER::user_start() +{ + +} + +void PortA__RT_PROVIDER::user_stop() +{ + +} + +void PortA__RT_PROVIDER::outgoing_send(const INTEGER& send_par, FLOAT* timestamp_redirect) +{ + if (timestamp_redirect != NULL) { + *timestamp_redirect = TTCN_Runtime::now(); + } + incoming_message(send_par * 10 + 9, TTCN_Runtime::now()); +} + +} /* end of namespace */ + diff --git a/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.hh b/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.hh new file mode 100644 index 0000000000000000000000000000000000000000..ccf5fa66e6206c4d42cdcb8cd326a190b7952fda --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjA/src/PortA_RT.hh @@ -0,0 +1,49 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Jan 10 15:59:28 2019 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortA__RT_HH +#define PortA__RT_HH + +#include <TTCN3.hh> + +// Note: Header file A.hh must not be included into this file! +// (because it includes this file) +// Please add the declarations of message types manually. + +namespace A { + +class PortA__RT_PROVIDER : public PORT { +public: + PortA__RT_PROVIDER(const char *par_port_name); + ~PortA__RT_PROVIDER(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const INTEGER& send_par, FLOAT* timestamp_redirect); + virtual void incoming_message(const INTEGER& incoming_par, const FLOAT& timestamp = FLOAT()) = 0; +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/portTranslationCentralStorage/ProjB/ProjB.cfg b/regression_test/portTranslationCentralStorage/ProjB/ProjB.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3babb67b3ef098281379b5774515e1cb57027b97 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/ProjB.cfg @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2000-2018 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Baranyi, Botond +# +############################################################################### + +[EXECUTE] +B diff --git a/regression_test/portTranslationCentralStorage/ProjB/bin/.gitignore b/regression_test/portTranslationCentralStorage/ProjB/bin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..9c6ed96029c3096e2594a322dcbe9e5b155b3fd9 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/bin/.gitignore @@ -0,0 +1,9 @@ +ProjB +ProjB.exe +B*.cc +B*.hh +*.o +*.d +compile +compile-all +*.log diff --git a/regression_test/portTranslationCentralStorage/ProjB/bin/Makefile b/regression_test/portTranslationCentralStorage/ProjB/bin/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d9615cb4ee1a3b19c99760c2673357beeecfe270 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/bin/Makefile @@ -0,0 +1,216 @@ +############################################################################## +# Copyright (c) 2000-2018 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Baranyi, Botond +# +############################################################################## +TOPDIR := ../../.. +include ../../../Makefile.regression + +# +# Do NOT touch this line... +# +.PHONY: all run archive check clean dep objects + +.SUFFIXES: .d + +# +# Set these variables... +# + +# Flags for the C++ preprocessor (and makedepend as well): +CPPFLAGS += -I. -I../../ProjA/bin -I../../ProjA/src -I../src + +#CXXFLAGS += -save-temps +CXXFLAGS += -g + +# Flags for dependency generation +CXXDEPFLAGS = -MM + +# Flags for the linker: +LDFLAGS += -g + +ifeq ($(PLATFORM), WIN32) +# Silence linker warnings. +LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc +endif + +# Flags for the TTCN-3 and ASN.1 compiler: +COMPILER_FLAGS += -I + +# Execution mode: (either ttcn3 or ttcn3-parallel) +TTCN3_LIB = ttcn3$(RT2_SUFFIX)-parallel$(DYNAMIC_SUFFIX) + + +# TTCN-3 modules of this project: +TTCN3_MODULES = ../src/B.ttcn + +# TTCN-3 modules used from central project(s): +BASE_TTCN3_MODULES = ../../ProjA/src/A.ttcn + +# ASN.1 modules of this project: +ASN1_MODULES = + +# ASN.1 modules used from central project(s): +BASE_ASN1_MODULES = + +# C++ source & header files generated from the TTCN-3 & ASN.1 modules of +# this project: +GENERATED_SOURCES = B.cc +GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) +ifdef SPLIT_TO_SLICES +POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) +POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) +GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) +GENERATED_SOURCES += $(GENERATED_SOURCES2) +endif + +# C++ source & header files generated from the TTCN-3 & ASN.1 modules of +# central project(s): +BASE_GENERATED_SOURCES = ../../ProjA/bin/A.cc +BASE_GENERATED_HEADERS = $(BASE_GENERATED_SOURCES:.cc=.hh) +ifdef SPLIT_TO_SLICES +BASE_GENERATED_SOURCES2 := $(foreach file, $(BASE_GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) +BASE_GENERATED_SOURCES += $(GENERATED_SOURCES2) +endif + +# C/C++ Source & header files of Test Ports, external functions and +# other modules: +USER_SOURCES = ../src/PortA2.cc ../src/PortB.cc ../src/PortB_RT.cc +USER_HEADERS = $(USER_SOURCES:.cc=.hh) + +# C/C++ Source & header files of Test Ports, external functions and +# other modules used from central project(s): +BASE_USER_SOURCES = ../../ProjA/src/PortA.cc ../../ProjA/src/PortA_RT.cc +BASE_USER_HEADERS = $(BASE_USER_SOURCES:.cc=.hh) + +# Object files of this project that are needed for the executable test suite: +OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS) + +GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o) + +USER_OBJECTS = PortA2.o PortB.o PortB_RT.o + +# Object files of central project(s) that are needed for the executable test suite: +BASE_OBJECTS = $(BASE_GENERATED_SOURCES:.cc=.o) ../../ProjA/bin/PortA.o ../../ProjA/bin/PortA_RT.o + +DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d) + +# Other files of the project (Makefile, configuration files, etc.) +# that will be added to the archived source files: +OTHER_FILES = Makefile ../ProjB.cfg + +# The name of the executable test suite: +TARGET = ProjB$(EXESUFFIX) + +# +# Rules for building the executable... +# + +all: $(TARGET) ; + +objects: $(OBJECTS) ; + +$(TARGET): $(OBJECTS) $(BASE_OBJECTS) + $(TTCN3_DIR)/bin/titanver $(OBJECTS) + $(CXX) $(LDFLAGS) -o $@ $^ \ + -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ + -L$(OPENSSL_DIR)/lib -lcrypto \ + -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) + +../../ProjA/bin/PortA.o: ../../ProjA/src/PortA.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +PortA2.o: ../src/PortA2.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +../../ProjA/bin/PortA_RT.o: ../../ProjA/src/PortA_RT.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +PortB.o: ../src/PortB.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +PortB_RT.o: ../src/PortB_RT.cc + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +.cc.o .c.o: + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< + +../../ProjA/bin/PortA.d : ../../ProjA/src/PortA.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +PortA2.d : ../src/PortA2.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +../../ProjA/bin/PortA_RT.d : ../../ProjA/src/PortA_RT.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +PortB.d : ../src/PortB.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +PortB_RT.d : ../src/PortB_RT.cc + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +.cc.d .c.d: + @echo Creating dependency file for '$<'; set -e; \ + $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ + | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ + [ -s $@ ] || rm -f $@ + +$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile-all compile ./compile ../../ProjA/bin/compile + @if [ ! -f $@ ]; then $(RM) compile-all; $(MAKE) compile-all; fi + +compile: $(TTCN3_MODULES) $(ASN1_MODULES) + $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) \ + $(TTCN3_MODULES) $(BASE_TTCN3_MODULES) \ + $(ASN1_MODULES) $(BASE_ASN1_MODULES) \ + - $? + touch $@ + +compile-all: $(BASE_TTCN3_MODULES) $(BASE_ASN1_MODULES) + $(TTCN3_DIR)/bin/compiler $(COMPILER_FLAGS) \ + $(TTCN3_MODULES) $(BASE_TTCN3_MODULES) \ + $(ASN1_MODULES) $(BASE_ASN1_MODULES) \ + - $(TTCN3_MODULES) $(ASN1_MODULES) + touch $@ compile + +clean distclean: + -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) compile compile-all $(DEPFILES) \ + *.log + +dep: $(GENERATED_SOURCES) $(USER_SOURCES) ; + +ifeq ($(findstring n,$(MAKEFLAGS)),) +ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),) +-include $(DEPFILES) +endif +endif + + +# +# Add your rules here if necessary... +# +run: $(TARGET) ../ProjB.cfg + $(TTCN3_DIR)/bin/ttcn3_start $^ + diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/B.ttcn b/regression_test/portTranslationCentralStorage/ProjB/src/B.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..1b2f6d226d274c92a8b4e4bed78a39cae67a79c2 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/B.ttcn @@ -0,0 +1,187 @@ +/****************************************************************************** + * Copyright (c) 2000-2018 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Baranyi, Botond + * + ******************************************************************************/ + +// This module tests translation ports when using central storage (or project +// references in the Eclipse Designer plug-in) + +// The user ports declared here must work in translation mode with the provider +// ports declared in another project +module B { + +import from A all; + +type port PortA2 message { + inout integer +} +with { + extension "provider" +} + +type port PortB message map to PortA, PortA2, PortA_RT { + in charstring from integer with int_to_char() + out octetstring to integer with oct_to_int() +} + +type port PortB_RT message realtime map to PortA, PortA2, PortA_RT { + in charstring from integer with int_to_char2() + out octetstring to integer with oct_to_int2() +} + +function int_to_char(in integer x, out charstring y) port PortB { + y := int2str(x); + port.setstate(0); +} +with { + extension "prototype(fast)" +} + +function oct_to_int(in octetstring x, out integer y) port PortB { + y := oct2int(x); + port.setstate(0); +} +with { + extension "prototype(fast)" +} + +function int_to_char2(in integer x, out charstring y) port PortB_RT { + y := int2str(x); + port.setstate(0); +} +with { + extension "prototype(fast)" +} + +function oct_to_int2(in octetstring x, out integer y) port PortB_RT { + y := oct2int(x); + port.setstate(0); +} +with { + extension "prototype(fast)" +} + +type component CT { + port PortB pb; + port PortB_RT pb_rt; +} + +type component Sys { + port PortA pa; + port PortA2 pa2; + port PortA_RT pa_rt; +} + +testcase tc_cross_project() runs on CT system Sys { + map(mtc:pb, system:pa); + pb.send('AB'O); // 171 in decimal + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb.receive("1716") /* PortA adds a 6 to the end */ { setverdict(pass); } + [] pb.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +testcase tc_same_project() runs on CT system Sys { + map(mtc:pb, system:pa2); + pb.send('AB'O); + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb.receive("1713") /* PortA2 adds a 3 to the end */ { setverdict(pass); } + [] pb.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +testcase tc_self() runs on CT { + map(mtc:pb, system:pb); // not in translation mode + pb.send('AB'O); + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb.receive("AB") { setverdict(pass); } + [] pb.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +testcase tc_cross_project_realtime_provider() runs on CT system Sys { + map(mtc:pb, system:pa_rt); + pb.send('AB'O); + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb.receive("1719") /* PortA_RT adds a 9 to the end */ { setverdict(pass); } + [] pb.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +testcase tc_cross_project_realtime_user() runs on CT system Sys { + map(mtc:pb_rt, system:pa); + var float y1, y2; + pb_rt.send('AB'O) -> timestamp y1; + if (isbound(y1)) { + setverdict(fail, "Send timestamp set."); + } + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb_rt.receive("1716") -> timestamp y2 /* PortA adds a 6 to the end */ { + if (isbound(y2)) { + setverdict(fail, "Receive timestamp set."); + } + setverdict(pass); + } + [] pb_rt.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +testcase tc_cross_project_realtime_both() runs on CT system Sys { + map(mtc:pb_rt, system:pa_rt); + var float y1, y2; + pb_rt.send('AB'O) -> timestamp y1; + if (not isbound(y1)) { + setverdict(fail, "Send timestamp not set."); + } + var charstring x; + timer t; + t.start(0.5); + alt { + [] pb_rt.receive("1719") -> timestamp y2 /* PortA_RT adds a 9 to the end */ { + if (not isbound(y2)) { + setverdict(fail, "Receive timestamp not set."); + } + setverdict(pass); + } + [] pb_rt.receive(charstring: ?) -> value x { setverdict(fail, "Received: ", x); } + [] t.timeout { setverdict(fail, "Timed out."); } + } +} + +control { + execute(tc_cross_project()); + execute(tc_same_project()); + execute(tc_self()); + execute(tc_cross_project_realtime_provider()); + execute(tc_cross_project_realtime_user()); + execute(tc_cross_project_realtime_both()); +} + +} diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.cc b/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.cc new file mode 100644 index 0000000000000000000000000000000000000000..3a3da856a851160001db32425c7bb8e58dba8e92 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.cc @@ -0,0 +1,78 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 16:47:16 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortA2.hh" +#include "B.hh" + +namespace B { + +PortA2_PROVIDER::PortA2_PROVIDER(const char *par_port_name) + : PORT(par_port_name) +{ + +} + +PortA2_PROVIDER::~PortA2_PROVIDER() +{ + +} + +void PortA2_PROVIDER::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortA2_PROVIDER::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortA2_PROVIDER::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortA2_PROVIDER::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortA2_PROVIDER::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortA2_PROVIDER::Handle_Timeout(double time_since_last_call) {}*/ + +void PortA2_PROVIDER::user_map(const char * /*system_port*/) +{ + +} + +void PortA2_PROVIDER::user_unmap(const char * /*system_port*/) +{ + +} + +void PortA2_PROVIDER::user_start() +{ + +} + +void PortA2_PROVIDER::user_stop() +{ + +} + +void PortA2_PROVIDER::outgoing_send(const INTEGER& send_par) +{ + incoming_message(send_par * 10 + 3); +} + +} /* end of namespace */ + diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.hh b/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.hh new file mode 100644 index 0000000000000000000000000000000000000000..65137419f175ef9c1451f1b4053235ca8ee19466 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortA2.hh @@ -0,0 +1,49 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 16:47:16 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortA2_HH +#define PortA2_HH + +#include <TTCN3.hh> + +// Note: Header file B.hh must not be included into this file! +// (because it includes this file) +// Please add the declarations of message types manually. + +namespace B { + +class PortA2_PROVIDER : public PORT { +public: + PortA2_PROVIDER(const char *par_port_name); + ~PortA2_PROVIDER(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const INTEGER& send_par); + virtual void incoming_message(const INTEGER& incoming_par) = 0; +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortB.cc b/regression_test/portTranslationCentralStorage/ProjB/src/PortB.cc new file mode 100644 index 0000000000000000000000000000000000000000..1b37ebb4a6665e2765470e325c4a78f0d7872152 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortB.cc @@ -0,0 +1,77 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 16:01:48 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortB.hh" + +namespace B { + +PortB::PortB(const char *par_port_name) + : PortB_BASE(par_port_name) +{ + +} + +PortB::~PortB() +{ + +} + +void PortB::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortB::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortB::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortB::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortB::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortB::Handle_Timeout(double time_since_last_call) {}*/ + +void PortB::user_map(const char * /*system_port*/) +{ + +} + +void PortB::user_unmap(const char * /*system_port*/) +{ + +} + +void PortB::user_start() +{ + +} + +void PortB::user_stop() +{ + +} + +void PortB::outgoing_send(const OCTETSTRING& send_par) +{ + incoming_message(oct2str(send_par)); +} + +} /* end of namespace */ + diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortB.hh b/regression_test/portTranslationCentralStorage/ProjB/src/PortB.hh new file mode 100644 index 0000000000000000000000000000000000000000..e07c31117c03f7f428787a63ffef07c3bbee26f3 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortB.hh @@ -0,0 +1,44 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Dec 6 16:01:48 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortB_HH +#define PortB_HH + +#include "B.hh" + +namespace B { + +class PortB : public PortB_BASE { +public: + PortB(const char *par_port_name = NULL); + ~PortB(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const OCTETSTRING& send_par); +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.cc b/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.cc new file mode 100644 index 0000000000000000000000000000000000000000..e917dec603b980e1bd556c47cfcb4c51602c4372 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.cc @@ -0,0 +1,80 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Jan 10 16:00:13 2019 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortB_RT.hh" + +namespace B { + +PortB__RT::PortB__RT(const char *par_port_name) + : PortB__RT_BASE(par_port_name) +{ + +} + +PortB__RT::~PortB__RT() +{ + +} + +void PortB__RT::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortB__RT::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortB__RT::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortB__RT::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortB__RT::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortB__RT::Handle_Timeout(double time_since_last_call) {}*/ + +void PortB__RT::user_map(const char * /*system_port*/) +{ + +} + +void PortB__RT::user_unmap(const char * /*system_port*/) +{ + +} + +void PortB__RT::user_start() +{ + +} + +void PortB__RT::user_stop() +{ + +} + +void PortB__RT::outgoing_send(const OCTETSTRING& send_par, FLOAT* timestamp_redirect) +{ + if (timestamp_redirect != NULL) { + *timestamp_redirect = TTCN_Runtime::now(); + } + incoming_message(oct2str(send_par), TTCN_Runtime::now()); +} + +} /* end of namespace */ + diff --git a/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.hh b/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.hh new file mode 100644 index 0000000000000000000000000000000000000000..30f0f3031eadab0f1bed1152ba380a6386a86125 --- /dev/null +++ b/regression_test/portTranslationCentralStorage/ProjB/src/PortB_RT.hh @@ -0,0 +1,44 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Thu Jan 10 16:00:13 2019 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortB__RT_HH +#define PortB__RT_HH + +#include "B.hh" + +namespace B { + +class PortB__RT : public PortB__RT_BASE { +public: + PortB__RT(const char *par_port_name = NULL); + ~PortB__RT(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const OCTETSTRING& send_par, FLOAT* timestamp_redirect); +}; + +} /* end of namespace */ + +#endif