From 7de992e4bdf9535b19c65866c84b20144b313832 Mon Sep 17 00:00:00 2001 From: jhugues Date: Thu, 14 Jun 2012 11:35:24 +0000 Subject: [PATCH] * Correct connection direction tests git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@4758 129961e7-ef38-4bb5-a8f7-c9a525a55882 --- .../model/ocarina-analyzer-aadl-semantics.adb | 26 ++++++-------- .../ParameterConnections.aadl | 10 +++--- .../ParameterConnections.aadl.out | 35 +++++++++++++++++++ 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/core/model/ocarina-analyzer-aadl-semantics.adb b/src/core/model/ocarina-analyzer-aadl-semantics.adb index 04c10f7a..3091e392 100644 --- a/src/core/model/ocarina-analyzer-aadl-semantics.adb +++ b/src/core/model/ocarina-analyzer-aadl-semantics.adb @@ -928,29 +928,25 @@ package body Ocarina.Analyzer.AADL.Semantics is case Kind (Connection_Destination) is when K_Port_Spec | K_Parameter => - - -- We do not check strict correspondence between port - -- directions: an in port can be connected to an in/out - -- port. This seems strange, but the examples provided - -- with Osate accept this situation. After all, it can - -- make sense: an in/out port could have two different - -- connections. - - if Present (Inversed_Entity (Connection_Source)) - or else Present (Inversed_Entity (Connection_Destination)) + if (Present (Inversed_Entity (Connection_Source)) + and then Connection_Source + /= Inversed_Entity (Connection_Source)) + or else (Present (Inversed_Entity (Connection_Destination)) + and then Connection_Destination + /= Inversed_Entity (Connection_Destination)) then - -- + -- XXX to be refined Directions := True; else - Directions := (not Source_Is_Local - and then not Destination_Is_Local + Directions := ((not Source_Is_Local) + and then (not Destination_Is_Local) and then Is_Out (Connection_Source) and then Is_In (Connection_Destination)) or else (Source_Is_Local - and then not Destination_Is_Local + and then (not Destination_Is_Local) and then Is_In (Connection_Source) and then Is_In (Connection_Destination)) - or else (not Source_Is_Local + or else ((not Source_Is_Local) and then Destination_Is_Local and then Is_Out (Connection_Source) and then Is_Out (Connection_Destination)) diff --git a/tests/osate-parameter-connections/ParameterConnections.aadl b/tests/osate-parameter-connections/ParameterConnections.aadl index 600925da..01c6a5e3 100644 --- a/tests/osate-parameter-connections/ParameterConnections.aadl +++ b/tests/osate-parameter-connections/ParameterConnections.aadl @@ -84,11 +84,11 @@ thread implementation t.i -- bad: event to param parameter in_event -> call7.in_out_param ; - -- bad: event to param + -- bad: event to param XXX parameter out_event -> call8.in_param ; - -- bad: event to param + -- bad: event to param XXX parameter out_event -> call8.out_param ; - -- bad: event to param + -- bad: event to param XXX parameter out_event -> call8.in_out_param ; -- bad: event to param @@ -198,7 +198,7 @@ thread implementation t.p connections -- bad: in cannot be dest, event cannot be dest parameter call.out_param -> in_event ; - -- bad: event cannot be dest + -- bad: event cannot be dest XXX parameter call.in_out_param -> out_event ; -- bad: in cannot be src, event cannot be dest parameter call.in_param -> in_out_event ; @@ -249,7 +249,7 @@ subprogram implementation sub.a parameter in_param -> call1.in_param ; -- bad: call.out_param cannot be a dest parameter in_param -> call1.out_param ; - -- bood: in to in/out + -- good: in to in/out parameter in_param -> call1.in_out_param ; -- bad: out_param cannot be source diff --git a/tests/osate-parameter-connections/ParameterConnections.aadl.out b/tests/osate-parameter-connections/ParameterConnections.aadl.out index 548ee9b7..dd5696f3 100644 --- a/tests/osate-parameter-connections/ParameterConnections.aadl.out +++ b/tests/osate-parameter-connections/ParameterConnections.aadl.out @@ -1,3 +1,13 @@ +ParameterConnections.aadl:41:05: in_data (port spec) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:46:05: out_data (port spec) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:48:05: out_data (port spec) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:50:05: out_data (port spec) and in_out_param (parameter) do not have compatible directions +ParameterConnections.aadl:55:05: in_out_data (port spec) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:62:05: in_event_data (port spec) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:67:05: out_event_data (port spec) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:69:05: out_event_data (port spec) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:71:05: out_event_data (port spec) and in_out_param (parameter) do not have compatible directions +ParameterConnections.aadl:76:05: in_out_event_data (port spec) and out_param (parameter) do not have compatible directions ParameterConnections.aadl:81:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:83:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:85:15: in_event (entity reference) points to in_event (port spec) , which is not of a proper type @@ -7,6 +17,13 @@ ParameterConnections.aadl:92:15: out_event (entity reference) points to out_eve ParameterConnections.aadl:95:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:97:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:99:15: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type +ParameterConnections.aadl:110:05: out_param (parameter) and in_data (port spec) do not have compatible directions +ParameterConnections.aadl:114:05: in_param (parameter) and in_out_data (port spec) do not have compatible directions +ParameterConnections.aadl:129:05: in_param (parameter) and in_event_data (port spec) do not have compatible directions +ParameterConnections.aadl:142:05: in_out_param (parameter) and in_event_data (port spec) do not have compatible directions +ParameterConnections.aadl:144:05: in_param (parameter) and out_event_data (port spec) do not have compatible directions +ParameterConnections.aadl:155:05: out_param (parameter) and in_event_data (port spec) do not have compatible directions +ParameterConnections.aadl:159:05: in_param (parameter) and in_out_event_data (port spec) do not have compatible directions ParameterConnections.aadl:174:32: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:187:36: in_event (entity reference) points to in_event (port spec) , which is not of a proper type ParameterConnections.aadl:189:32: out_event (entity reference) points to out_event (port spec) , which is not of a proper type @@ -15,5 +32,23 @@ ParameterConnections.aadl:202:36: out_event (entity reference) points to out_ev ParameterConnections.aadl:204:32: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type ParameterConnections.aadl:215:33: out_event (entity reference) points to out_event (port spec) , which is not of a proper type ParameterConnections.aadl:217:36: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type +ParameterConnections.aadl:219:05: in_param (parameter) and in_data (port spec) do not have compatible directions ParameterConnections.aadl:230:33: in_out_event (entity reference) points to in_out_event (port spec) , which is not of a proper type +ParameterConnections.aadl:232:05: in_out_param (parameter) and in_data (port spec) do not have compatible directions +ParameterConnections.aadl:234:05: in_param (parameter) and out_data (port spec) do not have compatible directions +ParameterConnections.aadl:251:05: in_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:256:05: out_param (parameter) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:258:05: out_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:260:05: out_param (parameter) and in_out_param (parameter) do not have compatible directions +ParameterConnections.aadl:265:05: in_out_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:278:05: in_param (parameter) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:293:05: in_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:297:05: in_out_param (parameter) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:308:05: in_param (parameter) and in_out_param (parameter) do not have compatible directions +ParameterConnections.aadl:310:05: out_param (parameter) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:327:05: in_param (parameter) and in_param (parameter) do not have compatible directions +ParameterConnections.aadl:329:05: out_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:344:05: in_out_param (parameter) and out_param (parameter) do not have compatible directions +ParameterConnections.aadl:346:05: in_param (parameter) and in_out_param (parameter) do not have compatible directions +ParameterConnections.aadl:359:05: in_param (parameter) and out_param (parameter) do not have compatible directions Cannot analyze AADL specifications -- GitLab