Hi Mahesh,

This test suite should be run with option "-e" only -  the place of manual
test suites. 

Logtest can use system() to perform node lock/unlock instead of asking users
to input.
Attached file is my proposal for this. 

Regards, Vu

> -----Original Message-----
> From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com]
> Sent: Friday, August 5, 2016 7:58 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au;
> anders.wid...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 3 of 4] logtest: change related to Cluster Membership
(CLM)
> integration [#1638] V4
> 
>  tests/logsv/Makefile.am   |    3 +-
>  tests/logsv/logtest.c     |    2 +-
>  tests/logsv/logtestfr.c   |    2 +-
>  tests/logsv/saflogtest.c  |    2 +-
>  tests/logsv/tet_Log_clm.c |  134
> ++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 139 insertions(+), 4 deletions(-)
> 
> 
>       Test suite 13 added.
> Test :
> 
>   #amf-adm lock safNode=PL-4,safCluster=myClmCluster
> 
>     <saLogStreamOpen_2> failed with code SA_AIS_ERR_UNAVAILABLE (31).
> 
> #amf-adm unlock safNode=PL-4,safCluster=myClmCluster
> 
>     <saLogStreamOpen_2> failed with code SA_AIS_ERR_UNAVAILABLE (31).
> 
>  #amf-adm lock safNode=PL-4,safCluster=myClmCluster  + (SC-1 & Sc-2
> /etc/init.d/opensafd stop)
> 
>     <saLogStreamOpen_2> failed with code SA_AIS_ERR_UNAVAILABLE (31)
> 
> # amf-adm lock safNode=PL-4,safCluster=myClmCluster  + ((SC-1 & Sc-2
> /etc/init.d/opensafd stop)) +
>       ((SC-1 & Sc-2 /etc/init.d/opensafd start) + amf-adm unlock
safNode=PL-
> 4,safCluster=myClmCluster
> 
>   <saLogStreamOpen_2> failed with code SA_AIS_ERR_UNAVAILABLE (31)
> 
>   Expected  but currently The Imm APIs are NOT working
>     error - saImmOmInitialize FAILED: SA_AIS_ERR_LIBRARY (2)
> 
> diff --git a/tests/logsv/Makefile.am b/tests/logsv/Makefile.am
> --- a/tests/logsv/Makefile.am
> +++ b/tests/logsv/Makefile.am
> @@ -48,7 +48,8 @@ logtest_SOURCES = \
>       tet_Log_misc.c \
>       tet_Log_recov.c \
>       tet_log_runtime_cfgobj.c \
> -     tet_log_longDN.c
> +     tet_log_longDN.c \
> +     tet_Log_clm.c
> 
>  logtest_LDADD = \
>       $(top_builddir)/tests/unit_test_fw/src/libutest.la \
> diff --git a/tests/logsv/logtest.c b/tests/logsv/logtest.c
> --- a/tests/logsv/logtest.c
> +++ b/tests/logsv/logtest.c
> @@ -93,7 +93,7 @@ SaLogRecordT genLogRecord =
>       .logBuffer = &genLogBuffer
>  };
> 
> -SaVersionT logVersion = {'A', 0x02, 0x01};
> +SaVersionT logVersion = {'A', 0x02, 0x02};
>  SaVersionT immVersion = {'A', 2, 11};
>  SaAisErrorT rc;
>  SaLogHandleT logHandle;
> diff --git a/tests/logsv/logtestfr.c b/tests/logsv/logtestfr.c
> --- a/tests/logsv/logtestfr.c
> +++ b/tests/logsv/logtestfr.c
> @@ -40,7 +40,7 @@
> 
> /*************************************************************
> ******************
>   * Global variables and defines
>   */
> -static SaVersionT logVersion = {'A', 0x02, 0x01};
> +static SaVersionT logVersion = {'A', 0x02, 0x02};
>  static SaVersionT immVersion = {'A', 2, 11};
> 
>  static SaLogHandleT logHandle;
> diff --git a/tests/logsv/saflogtest.c b/tests/logsv/saflogtest.c
> --- a/tests/logsv/saflogtest.c
> +++ b/tests/logsv/saflogtest.c
> @@ -86,7 +86,7 @@ static inline void time_meas_log(time_me
>  static void logWriteLogCallbackT(SaInvocationT invocation, SaAisErrorT
> error);
> 
>  static SaLogCallbacksT logCallbacks = { 0, 0, logWriteLogCallbackT };
> -static SaVersionT logVersion = { 'A', 2, 1 };
> +static SaVersionT logVersion = { 'A', 0x02, 0x02 };
> 
>  static char *progname = "saflogtest";
>  static SaInvocationT cb_invocation;
> diff --git a/tests/logsv/tet_Log_clm.c b/tests/logsv/tet_Log_clm.c
> new file mode 100644
> --- /dev/null
> +++ b/tests/logsv/tet_Log_clm.c
> @@ -0,0 +1,134 @@
> +/*      -*- OpenSAF  -*-
> + *
> + * (C) Copyright 2016 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): Oracle
> + *
> + */
> +
> +#include "logtest.h"
> +#include <sys/types.h>
> +#include <sys/wait.h>
> +#include <limits.h>
> +#include <unistd.h>
> +#include <stdarg.h>
> +
> +
> +/* Test cases for CLM Member Node.
> + * NOTE1: For the moment these test cases need interaction with the
tester
> and
> + * cannot be run fully automatic.
> + * NOTE2: Must run on PL node!
> + */
> +
> +/**
> + * Pause testing and wait for tester to press Enter.
> + * Can be used e.g. at a point where examining the log files is a good
idea
> + */
> +void saLogClmLock_pause_s(void)
> +{
> +     printf_s("\n Test paused For CLM Lock. ");
> +     printf_s("\n Issue `amf-adm lock safNode=<PL-
> 3>,safCluster=myClmCluster` to Lock any Payload..");
> +     printf_s("\n Press Enter to continue...");
> +     getchar();
> +}
> +
> +/**
> + * Pause testing and wait for tester to press Enter.
> + * Can be used e.g. at a point where examining the log files is a good
idea
> + */
> +void saLogClmUnLock_pause_s(void)
> +{
> +     printf_s("\n Test paused For CLM UNLock. ");
> +     printf_s("\n Issue `amf-adm unlock safNode=<PL-
> 3>,safCluster=myClmCluster` to UnLock any Payload..");
> +     printf_s("\n Press Enter to continue...");
> +     getchar();
> +}
> +
> +void saLogInitializ_14_01(void)
> +{
> +     saLogClmLock_pause_s();
> +     printf_s(" to saLogInitialize(). ");
> +     rc = saLogInitialize(&logHandle, &logCallbacks, &logVersion);
> +     saLogFinalize(logHandle);
> +     test_validate(rc, SA_AIS_ERR_UNAVAILABLE);
> +}
> +
> +void saLogInitializ_14_02(void)
> +{
> +     SaVersionT logPreviousVersion = { 'A', 0x02, 0x01 };
> +     saLogClmLock_pause_s();
> +     saLogClmUnLock_pause_s();
> +     printf_s(" to saLogInitialize(). ");
> +     rc = saLogInitialize(&logHandle, &logCallbacks,
> &logPreviousVersion);
> +     saLogFinalize(logHandle);
> +     test_validate(rc, SA_AIS_OK);
> +}
> +
> +void saLogInitializ_14_03(void)
> +{
> +     saLogClmLock_pause_s();
> +     saLogClmUnLock_pause_s();
> +     printf_s(" to saLogInitialize(). ");
> +     rc = saLogInitialize(&logHandle, &logCallbacks, &logVersion);
> +     saLogFinalize(logHandle);
> +     test_validate(rc, SA_AIS_OK);
> +}
> +
> +void saLogInitializ_14_04(void)
> +{
> +     SaVersionT logPreviousVersion = { 'A', 0x02, 0x01 };
> +     saLogClmLock_pause_s();
> +     saLogClmUnLock_pause_s();
> +     printf_s(" to saLogInitialize(). ");
> +     rc = saLogInitialize(&logHandle, &logCallbacks,
> &logPreviousVersion);
> +     saLogFinalize(logHandle);
> +     test_validate(rc, SA_AIS_OK);
> +}
> +
> +
> +void saLogStreamOpen_14_05(void)
> +{
> +     safassert(saLogInitialize(&logHandle, &logCallbacks, &logVersion),
> SA_AIS_OK);
> +     saLogClmLock_pause_s();
> +     printf_s(" to saLogStreamOpen_2(). ");
> +     rc = saLogStreamOpen_2(logHandle, &systemStreamName, NULL, 0,
> +                     SA_TIME_ONE_SECOND, &logStreamHandle);
> +     saLogStreamClose(logStreamHandle);
> +     safassert(saLogFinalize(logHandle), SA_AIS_OK);
> +     test_validate(rc, SA_AIS_ERR_UNAVAILABLE);
> +}
> +
> +void saLogStreamOpen_14_06(void)
> +{
> +     safassert(saLogInitialize(&logHandle, &logCallbacks, &logVersion),
> SA_AIS_OK);
> +     saLogClmLock_pause_s();
> +     saLogClmUnLock_pause_s();
> +     printf_s(" to saLogStreamOpen_2(). ");
> +     rc = saLogStreamOpen_2(logHandle, &systemStreamName, NULL, 0,
> +                     SA_TIME_ONE_SECOND, &logStreamHandle);
> +     saLogStreamClose(logStreamHandle);
> +     safassert(saLogFinalize(logHandle), SA_AIS_OK);
> +     test_validate(rc, SA_AIS_ERR_UNAVAILABLE);
> +
> +}
> +
> +__attribute__ ((constructor)) static void
> saLibraryLifeCycle_constructor(void)
> +{
> +     test_suite_add(14, "Log Service CLM Operations");
> +     test_case_add(14, saLogInitializ_14_01, "saLogInitializ() Expected
> SA_AIS_ERR_UNAVAILABLE");
> +     test_case_add(14, saLogInitializ_14_02, "saLogInitializ(previous
> versions) Expected SA_AIS_OK");
> +     test_case_add(14, saLogInitializ_14_03, "saLogInitializ() Expected
> SA_AIS_OK");
> +     test_case_add(14, saLogInitializ_14_04, "saLogInitializ(previous
> versions) Expected SA_AIS_OK");
> +     test_case_add(14, saLogStreamOpen_14_05, "saLogStreamOpen_2()
> Expected SA_AIS_ERR_UNAVAILABLE");
> +     test_case_add(14, saLogStreamOpen_14_06, "saLogStreamOpen_2()
> Expected SA_AIS_ERR_UNAVAILABLE");
> +}
> +

Attachment: clm_test.c
Description: Binary data

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to