[devel] [PATCH 2 of 3] log: add UML test case to verify alternative destination [#2258]
src/log/Makefile.am |4 +- src/log/apitest/tet_LogOiOps.c| 10 +- src/log/apitest/tet_cfg_destination.c | 509 ++ 3 files changed, 517 insertions(+), 6 deletions(-) Major changes: 1) Modify Lennart's test cases because enhancing destination configuration validation rules. 2) Add test suite #18 to verify alternative destination diff --git a/src/log/Makefile.am b/src/log/Makefile.am --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -189,7 +189,9 @@ bin_logtest_SOURCES = \ src/log/apitest/tet_Log_recov.c \ src/log/apitest/tet_log_runtime_cfgobj.c \ src/log/apitest/tet_log_longDN.c \ - src/log/apitest/tet_Log_clm.c + src/log/apitest/tet_Log_clm.c \ + src/log/apitest/tet_cfg_destination.c + bin_logtest_LDADD = \ lib/libapitest.la \ diff --git a/src/log/apitest/tet_LogOiOps.c b/src/log/apitest/tet_LogOiOps.c --- a/src/log/apitest/tet_LogOiOps.c +++ b/src/log/apitest/tet_LogOiOps.c @@ -1993,7 +1993,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;UNIX_SOCKET;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2049,7 +2049,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;UNIX_SOCKET;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2137,7 +2137,7 @@ void check_logRecordDestinationConfigura do { // Add values that will be replaced for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;UNIX_SOCKET;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2164,7 +2164,7 @@ void check_logRecordDestinationConfigura int num_new_values = 3; for (int i = 0; i < num_new_values; i++) { sprintf(set_values[i], - "NewName%d;NewType%d;NewSetting%d", i, i, i); + "NewName%d;UNIX_SOCKET;NewSetting%d", i, i); } sprintf(command, "immcfg " "-a logRecordDestinationConfiguration='%s' " @@ -2231,7 +2231,7 @@ void check_logRecordDestinationConfigura do { // Add values that will be replaced for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;UNIX_SOCKET;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " diff --git a/src/log/apitest/tet_cfg_destination.c b/src/log/apitest/tet_cfg_destination.c new file mode 100644 --- /dev/null +++ b/src/log/apitest/tet_cfg_destination.c @@ -0,0 +1,509 @@ +/* -*- OpenSAF -*- + * + * (C) Copyright 2017 The OpenSAF Foundation + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + * Author(s): Ericsson AB + * + */ + +#include "log/apitest/logtest.h" + +// These test cases are for testing #2258 - alternative destinations + +//== +// Validate `logRecordDestinationConfiguration` +//== +const char validDest[] = "desta;UNIX_SOCKET;/var/lib/opensaf/mds_log.sock"; +// Multi destinations +const char multiDest1[] = "desta;UNIX_SOCKET;/var/lib/opensaf/mds_log.sock"; +const char multiDest2[] = "destb;UNIX_SOCKET;/var/lib/opensaf/local.sock"; +// Delete destination +const char delDest[] = "";
[devel] [PATCH 2 of 3] log: add UML test case to verify alternative destination [#2258]
src/log/Makefile.am |4 +- src/log/apitest/tet_LogOiOps.c|8 +- src/log/apitest/tet_cfg_destination.c | 483 ++ 3 files changed, 490 insertions(+), 5 deletions(-) Major changes: 1) Modify Lennart's test cases because enhancing destination configuration validation rules. 2) Add test suite #17 to verify alternative destination diff --git a/src/log/Makefile.am b/src/log/Makefile.am --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -183,7 +183,9 @@ bin_logtest_SOURCES = \ src/log/apitest/tet_Log_recov.c \ src/log/apitest/tet_log_runtime_cfgobj.c \ src/log/apitest/tet_log_longDN.c \ - src/log/apitest/tet_Log_clm.c + src/log/apitest/tet_Log_clm.c \ + src/log/apitest/tet_cfg_destination.c + bin_logtest_LDADD = \ lib/libapitest.la \ diff --git a/src/log/apitest/tet_LogOiOps.c b/src/log/apitest/tet_LogOiOps.c --- a/src/log/apitest/tet_LogOiOps.c +++ b/src/log/apitest/tet_LogOiOps.c @@ -1923,7 +1923,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -1979,7 +1979,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2067,7 +2067,7 @@ void check_logRecordDestinationConfigura do { // Add values that will be replaced for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2094,7 +2094,7 @@ void check_logRecordDestinationConfigura int num_new_values = 3; for (int i = 0; i < num_new_values; i++) { sprintf(set_values[i], - "NewName%d;NewType%d;NewSetting%d", i, i, i); + "NewName%d;localsocket;NewSetting%d", i, i); } sprintf(command, "immcfg " "-a logRecordDestinationConfiguration='%s' " diff --git a/src/log/apitest/tet_cfg_destination.c b/src/log/apitest/tet_cfg_destination.c new file mode 100644 --- /dev/null +++ b/src/log/apitest/tet_cfg_destination.c @@ -0,0 +1,483 @@ +/* -*- OpenSAF -*- + * + * (C) Copyright 2017 The OpenSAF Foundation + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed + * under the GNU Lesser General Public License Version 2.1, February 1999. + * The complete license can be accessed from the following location: + * http://opensource.org/licenses/lgpl-license.php + * See the Copying file included with the OpenSAF distribution for full + * licensing terms. + * + * Author(s): Ericsson AB + * + */ + +#include "log/apitest/logtest.h" + +// These test cases are for testing #2258 - alternative destinations + +//== +// Validate `logRecordDestinationConfiguration` +//== +const char validDest[] = "desta;localsocket;/var/lib/opensaf/mds_log.sock"; +// Multi destinations +const char multiDest1[] = "desta;localsocket;/var/lib/opensaf/mds_log.sock"; +const char multiDest2[] = "destb;localsocket;/var/lib/opensaf/local.sock"; +// Delete destination +const char delDest[] = ""; +// NIL destination configution. +const char nildest[] = "destc;localsocket;"; + +//> +// Abnormal cases +//< +// Only destination type = "unix" is supported. +const char invalidTypeDest[] = "test;invalid;/var/lib/opensaf/mds_log.sock"; +// "name" & "type" must have at least. +const char invalidFmtDest[] = "test"; +// "name" must not contain special characters +const char invalidNameDest[] = "destA?abc;localsocket;"; +// Same "name" must go with same "dest" and vice versa. +const char invalidDuplicatedDest[] = +
[devel] [PATCH 2 of 3] log: add UML test case to verify alternative destination [#2258]
src/log/Makefile.am| 4 +++- src/log/apitest/tet_LogOiOps.c | 8 2 files changed, 7 insertions(+), 5 deletions(-) Major changes: 1) Modify Lennart's test cases because enhancing destination configuration validation rules. 2) Add test suite #17 to verify alternative destination diff --git a/src/log/Makefile.am b/src/log/Makefile.am --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -182,7 +182,9 @@ bin_logtest_SOURCES = \ src/log/apitest/tet_Log_recov.c \ src/log/apitest/tet_log_runtime_cfgobj.c \ src/log/apitest/tet_log_longDN.c \ - src/log/apitest/tet_Log_clm.c + src/log/apitest/tet_Log_clm.c \ + src/log/apitest/tet_cfg_destination.c + bin_logtest_LDADD = \ lib/libapitest.la \ diff --git a/src/log/apitest/tet_LogOiOps.c b/src/log/apitest/tet_LogOiOps.c --- a/src/log/apitest/tet_LogOiOps.c +++ b/src/log/apitest/tet_LogOiOps.c @@ -1913,7 +1913,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -1969,7 +1969,7 @@ void check_logRecordDestinationConfigura do { // Add values for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2057,7 +2057,7 @@ void check_logRecordDestinationConfigura do { // Add values that will be replaced for (int i = 0; i < num_values; i++) { - sprintf(set_values[i], "Name%d;Type%d;Setting%d", i, i, i); + sprintf(set_values[i], "Name%d;localsocket;Setting%d", i, i); sprintf(command, "immcfg " "-a logRecordDestinationConfiguration+=" "'%s' " @@ -2084,7 +2084,7 @@ void check_logRecordDestinationConfigura int num_new_values = 3; for (int i = 0; i < num_new_values; i++) { sprintf(set_values[i], - "NewName%d;NewType%d;NewSetting%d", i, i, i); + "NewName%d;localsocket;NewSetting%d", i, i); } sprintf(command, "immcfg " "-a logRecordDestinationConfiguration='%s' " -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel