tests/logsv/tet_LogOiOps.c |  798 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 795 insertions(+), 3 deletions(-)


Add new test suite for testing validation of attributes when creating or 
modifying
stream configuration object

diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c
--- a/tests/logsv/tet_LogOiOps.c
+++ b/tests/logsv/tet_LogOiOps.c
@@ -20,6 +20,7 @@
 #include <saImm.h>
 #include <saImmOm.h>
 #include <limits.h>
+#include <unistd.h>
 #include "logtest.h"
 
 static SaLogFileCreateAttributesT_2 appStreamLogFileCreateAttributes =
@@ -826,7 +827,7 @@ void saLogOi_51(void)
 }
 
 /* 
=============================================================================
- * Test log service configuration object
+ * Test log service configuration object, suite 5
  * 
=============================================================================
  */
 
@@ -1038,9 +1039,766 @@ void saLogOi_64(void)
     sprintf(command, "immcfg -a logFileSysConfig=%d"
                        " logConfig=1,safApp=safLogService 2> /dev/null",2);
     rc = system(command);
-    rc_validate(WEXITSTATUS(rc), 1);   
+    rc_validate(WEXITSTATUS(rc), 1);
 }
 
+/* 
=============================================================================
+ * Test stream configuration object attribute validation, suite 6
+ * Note:
+ * saLogStreamLogFileFormat see saLogOi_12 in suite 4
+ * saLogStreamLogFullAction see saLogOi_05 - saLogOi_08 in suite 4
+ * saLogStreamLogFullHaltThreshold see saLogOi_09
+ * 
=============================================================================
+ */
+
+/* Note:
+ * When testing 'object modify' immcfg will return with a timeout error from 
IMM if
+ * the tests are done in full speed.
+ * TST_DLY is a delay in seconds between tests for 'object Modify'
+ */
+#define TST_DLY 3
+
+/* Note:
+ * Tests using logMaxLogrecsize requires that logMaxLogrecsize
+ * is default set to 1024 in the OpenSafLogConfig class definition
+ */
+#define MAX_LOGRECSIZE 1024
+
+/* ***************************
+ * Validate when object Create
+ * ***************************/
+
+/**
+ * Create: saLogStreamSeverityFilter < 0x7f, Ok
+ */
+void saLogOi_65(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig "
+               "safLgStrCfg=str6,safApp=safLogService -a 
saLogStreamSeverityFilter=%d"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.",
+                       0x7e);
+       rc = system(command);
+       
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamSeverityFilter >= 0x7f, ERR
+ */
+void saLogOi_66(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig "
+               "safLgStrCfg=str6,safApp=safLogService -a 
saLogStreamSeverityFilter=%d"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=. 2> 
/dev/null",
+                       0x7f);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamPathName "../Test/" (Outside root path), ERR
+ */
+void saLogOi_67(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig "
+               "safLgStrCfg=str6,safApp=safLogService "
+               "-a saLogStreamFileName=str6file -a saLogStreamPathName=../Test 
2> /dev/null");
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamFileName, Name and path already used by an existing 
stream, ERR
+ */
+void saLogOi_68(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig "
+               "safLgStrCfg=str6,safApp=safLogService "
+               "-a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig "
+               "safLgStrCfg=str6,safApp=safLogService "
+               "-a saLogStreamFileName=str6file -a saLogStreamPathName=. 2> 
/dev/null");
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamMaxLogFileSize > logMaxLogrecsize, Ok
+ */
+void saLogOi_69(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxLogFileSize=%d",
+                       MAX_LOGRECSIZE + 1);
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamMaxLogFileSize == logMaxLogrecsize, ERR
+ */
+void saLogOi_70(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxLogFileSize=%d 2> /dev/null",
+                       MAX_LOGRECSIZE);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamMaxLogFileSize < logMaxLogrecsize, ERR
+ */
+void saLogOi_71(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxLogFileSize=%d 2> /dev/null",
+                       MAX_LOGRECSIZE - 1);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamFixedLogRecordSize < logMaxLogrecsize, Ok
+ */
+void saLogOi_72(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamFixedLogRecordSize=%d",
+                       MAX_LOGRECSIZE - 1);
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamFixedLogRecordSize == logMaxLogrecsize, Ok
+ */
+void saLogOi_73(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamFixedLogRecordSize=%d",
+                       MAX_LOGRECSIZE);
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamFixedLogRecordSize == 0, Ok
+ */
+void saLogOi_74(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamFixedLogRecordSize=%d",
+                       0);
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamFixedLogRecordSize > logMaxLogrecsize, ERR
+ */
+void saLogOi_75(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamFixedLogRecordSize=%d 2> /dev/null",
+                       MAX_LOGRECSIZE + 1);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamMaxFilesRotated < 128, Ok
+ */
+void saLogOi_76(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxFilesRotated=%d",
+                       127);
+       rc = system(command);
+       /* Delete the test object */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Create: saLogStreamMaxFilesRotated > 128, ERR
+ */
+void saLogOi_77(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxFilesRotated=%d 2> /dev/null",
+                       129);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Create: saLogStreamMaxFilesRotated == 128, ERR
+ */
+void saLogOi_78(void)
+{
+       int rc;
+       char command[512];
+       
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=."
+               " -a saLogStreamMaxFilesRotated=%d 2> /dev/null",
+                       128);
+       rc = system(command);
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/* ***************************
+ * Validate when object Modify
+ * 
+ * Note1:
+ * saLogStreamLogFileFormat see saLogOi_12 in suite 4
+ * saLogStreamLogFullAction see saLogOi_05 - saLogOi_08 in suite 4
+ * saLogStreamLogFullHaltThreshold see saLogOi_09
+ * 
+ * Note2:
+ * Run PREPARE before running any individual test case in suite 6.
+ * This will create a test object. Is done automatically if running whole 
suite.
+ * 
+ * Note3:
+ * CLEAN6 can be used to delete the test object for clean up.
+ * Is done automatically if running whole suite.
+ * ***************************/
+
+/**
+ * Modify: saLogStreamSeverityFilter < 0x7f, Ok
+ */
+void saLogOi_100(void)
+{
+       int rc;
+       char command[512];
+
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamSeverityFilter=%d "
+               "safLgStrCfg=str6,safApp=safLogService",
+                       0x7e);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamSeverityFilter >= 0x7f, ERR
+ */
+void saLogOi_101(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamSeverityFilter=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       0x7f);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamPathName "Test/" (Not possible to modify)
+ */
+void saLogOi_102(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamPathName=%s"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       "Test/");
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamFileName, Name and path already used by an existing 
stream, ERR
+ */
+void saLogOi_103(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFileName=%s"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       "str6file");
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamFileName, Name exist but in other path, Ok
+ */
+void saLogOi_104(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6a,safApp=safLogService"
+               " -a saLogStreamFileName=str6afile -a 
saLogStreamPathName=str6adir/");
+       safassert(system(command),0);
+
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=%s -a saLogStreamPathName=.",
+                       "str6file");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFileName=%s"
+               " safLgStrCfg=str6a,safApp=safLogService",
+                       "str6file");
+       rc = system(command);
+       
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+       sprintf(command,"immcfg -d safLgStrCfg=str6a,safApp=safLogService");
+       safassert(system(command),0);
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamFileName, New name, Ok
+ */
+void saLogOi_105(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6a,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFileName=%s"
+               " safLgStrCfg=str6a,safApp=safLogService",
+                       "str6new");
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6a,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamMaxLogFileSize > logMaxLogrecsize, Ok
+ */
+void saLogOi_106(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxLogFileSize=%d "
+               "safLgStrCfg=str6,safApp=safLogService",
+                       MAX_LOGRECSIZE + 1);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamMaxLogFileSize == logMaxLogrecsize, ERR
+ */
+void saLogOi_107(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxLogFileSize=%d "
+               "safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       MAX_LOGRECSIZE);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamMaxLogFileSize < logMaxLogrecsize, ERR
+ */
+void saLogOi_108(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxLogFileSize=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       MAX_LOGRECSIZE - 1);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamFixedLogRecordSize < logMaxLogrecsize, Ok
+ */
+void saLogOi_109(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFixedLogRecordSize=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       MAX_LOGRECSIZE - 1);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamFixedLogRecordSize == 0, Ok
+ */
+void saLogOi_110(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFixedLogRecordSize=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       0);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamFixedLogRecordSize == logMaxLogrecsize, Ok
+ */
+void saLogOi_111(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFixedLogRecordSize=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       MAX_LOGRECSIZE);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamFixedLogRecordSize > logMaxLogrecsize, ERR
+ */
+void saLogOi_112(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamFixedLogRecordSize=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       MAX_LOGRECSIZE + 1);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamMaxFilesRotated < 128, Ok
+ */
+void saLogOi_113(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxFilesRotated=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       127);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 0);
+}
+
+/**
+ * Modify: saLogStreamMaxFilesRotated > 128, ERR
+ */
+void saLogOi_114(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxFilesRotated=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       129);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+/**
+ * Modify: saLogStreamMaxFilesRotated == 128, ERR
+ */
+void saLogOi_115(void)
+{
+       int rc;
+       char command[512];
+       
+       sleep(TST_DLY);
+       /* Create */
+       sprintf(command, "immcfg -c SaLogStreamConfig"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " -a saLogStreamFileName=str6file -a saLogStreamPathName=.");
+       safassert(system(command),0);
+
+       /* Test modify */
+       sprintf(command, "immcfg -a saLogStreamMaxFilesRotated=%d"
+               " safLgStrCfg=str6,safApp=safLogService"
+               " 2> /dev/null",
+                       128);
+       rc = system(command);
+       /* Delete */
+       sprintf(command,"immcfg -d safLgStrCfg=str6,safApp=safLogService");
+       safassert(system(command),0);
+
+       rc_validate(WEXITSTATUS(rc), 1);
+}
+
+#undef MAX_LOGRECSIZE
+
 __attribute__ ((constructor)) static void saOiOperations_constructor(void)
 {
        /* Stream objects */
@@ -1118,5 +1876,39 @@ void saLogOi_64(void)
     test_case_add(5, saLogOi_62, "CCB Object Modify, logMaxApplicationStreams. 
Not allowed");
     test_case_add(5, saLogOi_63, "CCB Object Modify, logFileIoTimeout. Not 
allowed");
     test_case_add(5, saLogOi_64, "CCB Object Modify, logFileSysConfig. Not 
allowed");
+       
+       /* Stream configuration object */
+       /* Tests for create */
+       test_suite_add(6, "LOG OI tests, Stream configuration object attribute 
validation");
+       test_case_add(6, saLogOi_65, "Create: saLogStreamSeverityFilter < 0x7f, 
Ok");
+       test_case_add(6, saLogOi_66, "Create: saLogStreamSeverityFilter >= 
0x7f, ERR");
+       test_case_add(6, saLogOi_67, "Create: saLogStreamPathName \"../Test/\" 
(Outside root path), ERR");
+       test_case_add(6, saLogOi_68, "Create: saLogStreamFileName, Name and 
path already used by an existing stream, ERR");
+       test_case_add(6, saLogOi_69, "Create: saLogStreamMaxLogFileSize > 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_70, "Create: saLogStreamMaxLogFileSize == 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_71, "Create: saLogStreamMaxLogFileSize < 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_72, "Create: saLogStreamFixedLogRecordSize < 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_73, "Create: saLogStreamFixedLogRecordSize == 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_74, "Create: saLogStreamFixedLogRecordSize == 
0, Ok");
+       test_case_add(6, saLogOi_75, "Create: saLogStreamFixedLogRecordSize > 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_76, "Create: saLogStreamMaxFilesRotated < 128, 
Ok");
+       test_case_add(6, saLogOi_77, "Create: saLogStreamMaxFilesRotated > 128, 
ERR");
+       test_case_add(6, saLogOi_78, "Create: saLogStreamMaxFilesRotated == 
128, ERR");
+       /* Tests for modify */
+       test_case_add(6, saLogOi_100, "Modify: saLogStreamSeverityFilter < 
0x7f, Ok");
+       test_case_add(6, saLogOi_101, "Modify: saLogStreamSeverityFilter >= 
0x7f, ERR");
+       test_case_add(6, saLogOi_102, "Modify: saLogStreamPathName \"Test/\" 
(Not possible to modify)");
+       test_case_add(6, saLogOi_103, "Modify: saLogStreamFileName, Name and 
path already used by an existing stream, ERR");
+       test_case_add(6, saLogOi_104, "Modify: saLogStreamFileName, Name exist 
but in other path, Ok");
+       test_case_add(6, saLogOi_105, "Modify: saLogStreamFileName, New name, 
Ok");
+       test_case_add(6, saLogOi_106, "Modify: saLogStreamMaxLogFileSize > 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_107, "Modify: saLogStreamMaxLogFileSize == 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_108, "Modify: saLogStreamMaxLogFileSize < 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_109, "Modify: saLogStreamFixedLogRecordSize < 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_110, "Modify: saLogStreamFixedLogRecordSize == 
0, Ok");
+       test_case_add(6, saLogOi_111, "Modify: saLogStreamFixedLogRecordSize == 
logMaxLogrecsize, Ok");
+       test_case_add(6, saLogOi_112, "Modify: saLogStreamFixedLogRecordSize > 
logMaxLogrecsize, ERR");
+       test_case_add(6, saLogOi_113, "Modify: saLogStreamMaxFilesRotated < 
128, Ok");
+       test_case_add(6, saLogOi_114, "Modify: saLogStreamMaxFilesRotated > 
128, ERR");
+       test_case_add(6, saLogOi_115, "Modify: saLogStreamMaxFilesRotated == 
128, ERR");
 }
-

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

Reply via email to