From 32cf0a281f9133bc02437a5800fc0e02f19ff7a6 Mon Sep 17 00:00:00 2001 From: Botond Baranyi <botond.baranyi@ericsson.com> Date: Mon, 17 Oct 2016 13:16:53 +0200 Subject: [PATCH] changed invalid module parameter references to cause module parameter errors instead of dynamic test case errors (bug 506066) Change-Id: I28ce74fd2710e355fb2a4f655f071d1b79a73609 Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> --- core/Module_list.cc | 11 +-- core/Module_list.hh | 3 +- core/Param_Types.cc | 2 +- .../Config_Parser/Logging_1_TD.script | 86 ++++++++----------- .../PreprocessingCfgFiles_TD.script | 16 ++-- 5 files changed, 54 insertions(+), 64 deletions(-) diff --git a/core/Module_list.cc b/core/Module_list.cc index 4bf63730e..f5b5647c0 100644 --- a/core/Module_list.cc +++ b/core/Module_list.cc @@ -204,7 +204,8 @@ void Module_List::set_param(Module_Param& param) } #ifdef TITAN_RUNTIME_2 -Module_Param* Module_List::get_param(Module_Param_Name& param_name) +Module_Param* Module_List::get_param(Module_Param_Name& param_name, + const Module_Param* caller) { // The first segment in the parameter name can either be the module name, // or the module parameter name - both must be checked @@ -239,22 +240,22 @@ Module_Param* Module_List::get_param(Module_Param_Name& param_name) // Still not found -> error if (param == NULL) { if (module_ptr == NULL) { - TTCN_error("Referenced module parameter cannot be found. Module `%s' does not exist, " + caller->error("Referenced module parameter cannot be found. Module `%s' does not exist, " "and no parameter with name `%s' exists in any module.", first_name, first_name); } else if (module_ptr->get_param_func == NULL) { - TTCN_error("Referenced module parameter cannot be found. Module `%s' does not have " + caller->error("Referenced module parameter cannot be found. Module `%s' does not have " "parameters, and no parameter with name `%s' exists in other modules.", first_name, first_name); } else { - TTCN_error("Referenced module parameter cannot be found. No parameter with name `%s' " + caller->error("Referenced module parameter cannot be found. No parameter with name `%s' " "exists in module `%s', and no parameter with name `%s' exists in any module.", second_name, first_name, first_name); } } else if (param->get_type() == Module_Param::MP_Unbound) { delete param; - TTCN_error("Referenced module parameter '%s' is unbound.", param_name.get_str()); + caller->error("Referenced module parameter '%s' is unbound.", param_name.get_str()); } return param; diff --git a/core/Module_list.hh b/core/Module_list.hh index 75351602d..93fee1c19 100644 --- a/core/Module_list.hh +++ b/core/Module_list.hh @@ -53,7 +53,8 @@ public: static void set_param(Module_Param& param); #ifdef TITAN_RUNTIME_2 - static Module_Param* get_param(Module_Param_Name& param_name); + static Module_Param* get_param(Module_Param_Name& param_name, + const Module_Param* caller); #endif static void log_param(); diff --git a/core/Param_Types.cc b/core/Param_Types.cc index 53d982303..f2b8d41b1 100644 --- a/core/Param_Types.cc +++ b/core/Param_Types.cc @@ -331,7 +331,7 @@ Module_Param_Ptr Module_Param_Reference::get_referenced_param() const { error("References to other variables are not allowed."); } mp_ref->reset(); - Module_Param_Ptr ptr = Module_List::get_param(*mp_ref); + Module_Param_Ptr ptr = Module_List::get_param(*mp_ref, this); ptr.set_temporary(); return ptr; } diff --git a/function_test/Config_Parser/Logging_1_TD.script b/function_test/Config_Parser/Logging_1_TD.script index 7ef671bc1..8bb705962 100644 --- a/function_test/Config_Parser/Logging_1_TD.script +++ b/function_test/Config_Parser/Logging_1_TD.script @@ -1585,74 +1585,71 @@ tsp_union := ENUM_1 Temp.control <END_MODULE> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_integer' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_float' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_boolean' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_objid' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_verdict' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_bitstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_hexstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_octetstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_charstring' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_universal_charstring' <END_RESULT> <RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_enumerated' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_record' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_record.nonexistent1' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_record_of' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_set' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_set.nonexistent1' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_set_of' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_anytype' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_anytype.field3' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_union' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_union.field3' <END_RESULT> <RESULT COUNT 1> -(?im)Test execution summary: 0 test case was executed. Overall verdict: error -<END_RESULT> -<RESULT COUNT 16> -Dynamic test case error: Referenced module parameter cannot be found. +(?im)Test execution summary: 0 test case was executed. Overall verdict: none <END_RESULT> <RESULT COUNT 1> @@ -1810,7 +1807,7 @@ tsp_anytype &= {integer := 3} [EXECUTE] Temp.control <END_MODULE> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while concatenating parameter field 'tsp_ROI' <END_RESULT> <RESULT COUNT 4> @@ -1822,7 +1819,7 @@ Temp.control <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_ROROI\[0\]' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while concatenating parameter field 'tsp_SOI' <END_RESULT> <RESULT COUNT 4> @@ -1876,9 +1873,6 @@ Temp.control <RESULT COUNT 4> (?im)Error while concatenating parameter field 'tsp_anytype' <END_RESULT> -<RESULT COUNT 2> -Dynamic test case error: Referenced module parameter cannot be found. -<END_RESULT> <END_TC> @@ -2224,70 +2218,67 @@ tsp_union := ENUM_1 Temp.control <END_MODULE> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_integer' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_float' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_boolean' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_objid' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_verdict' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_bitstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_hexstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_octetstring' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_charstring' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_universal_charstring' <END_RESULT> <RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_enumerated' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_record' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_record.nonexistent1' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_record_of' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while setting parameter field 'tsp_set' <END_RESULT> <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_set.nonexistent1' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_set_of' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_anytype' <END_RESULT> -<RESULT COUNT 24> +<RESULT COUNT 26> (?im)Error while setting parameter field 'tsp_union' <END_RESULT> <RESULT COUNT 1> (?im)There were errors during configuring HCs. <END_RESULT> -<RESULT COUNT 16> -Dynamic test case error: Referenced module parameter cannot be found. -<END_RESULT> <RESULT COUNT 1> <END_RESULT> @@ -2444,7 +2435,7 @@ tsp_anytype &= {integer := 3} [EXECUTE] Temp.control <END_MODULE> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while concatenating parameter field 'tsp_ROI' <END_RESULT> <RESULT COUNT 4> @@ -2456,7 +2447,7 @@ Temp.control <RESULT COUNT 2> (?im)Error while setting parameter field 'tsp_ROROI\[0\]' <END_RESULT> -<RESULT COUNT 26> +<RESULT COUNT 28> (?im)Error while concatenating parameter field 'tsp_SOI' <END_RESULT> <RESULT COUNT 4> @@ -2510,9 +2501,6 @@ Temp.control <RESULT COUNT 4> (?im)Error while concatenating parameter field 'tsp_anytype' <END_RESULT> -<RESULT COUNT 2> -Dynamic test case error: Referenced module parameter cannot be found. -<END_RESULT> <END_TC> diff --git a/function_test/Config_Parser/PreprocessingCfgFiles_TD.script b/function_test/Config_Parser/PreprocessingCfgFiles_TD.script index 328862eeb..7bd19a925 100644 --- a/function_test/Config_Parser/PreprocessingCfgFiles_TD.script +++ b/function_test/Config_Parser/PreprocessingCfgFiles_TD.script @@ -1302,8 +1302,8 @@ control{} [EXECUTE] Temp.control <END_MODULE> -<RESULT IF_PASS COUNT 1> -Dynamic test case error: Referenced module parameter cannot be found. +<RESULT IF_PASS COUNT 2> +Error while setting parameter field <END_RESULT> <END_TC> @@ -1333,8 +1333,8 @@ DEF_1:={ f3:=${DEF_1_f} } [MODULE_PARAMETERS] tsp_1 := ${DEF_1} <END_MODULE> -<RESULT IF_PASS COUNT 1> -Dynamic test case error: Referenced module parameter cannot be found. +<RESULT IF_PASS COUNT 2> +Error while setting parameter field <END_RESULT> <END_TC> @@ -1680,8 +1680,8 @@ control{} [EXECUTE] Temp.control <END_MODULE> -<RESULT IF_PASS COUNT 1> -Dynamic test case error: Referenced module parameter cannot be found. +<RESULT IF_PASS COUNT 2> +Error while setting parameter field <END_RESULT> <END_TC> @@ -1711,8 +1711,8 @@ DEF_1:={ f3:=${DEF_1_f} } [MODULE_PARAMETERS] tsp_1 := ${DEF_1} <END_MODULE> -<RESULT IF_PASS COUNT 1> -Dynamic test case error: Referenced module parameter cannot be found. +<RESULT IF_PASS COUNT 2> +Error while setting parameter field <END_RESULT> <END_TC> -- GitLab