---
 src/log/apitest/tet_saLogStreamClose.c  | 28 ++++++++++++++++++++++++++++
 src/log/apitest/tet_saLogStreamOpen_2.c |  2 ++
 2 files changed, 30 insertions(+)

diff --git a/src/log/apitest/tet_saLogStreamClose.c 
b/src/log/apitest/tet_saLogStreamClose.c
index 4046194..6812873 100644
--- a/src/log/apitest/tet_saLogStreamClose.c
+++ b/src/log/apitest/tet_saLogStreamClose.c
@@ -35,3 +35,31 @@ void saLogStreamClose_01(void)
 done:
        logFinalize();
 }
+
+/* Object to test: logStreamClose() API:
+ * Test: Test the logStreamClose() with finalized handle
+ * step1:Call logInitialize()
+ * step2:Call logStreamOpen()
+ * step3:Call logFinalize()
+ * step4:Now call the saLogStreamClose() with logStreamHandle
+ * Result: Shall fail with return code SA_AIS_ERR_BAD_HANDLE
+ */
+void saLogStreamClose_02(void)
+{
+       rc = logInitialize();
+       if (rc != SA_AIS_OK) {
+               test_validate(rc, SA_AIS_OK);
+               return;
+       }
+       rc = logStreamOpen(&systemStreamName);
+       if (rc != SA_AIS_OK) {
+               test_validate(rc, SA_AIS_OK);
+               goto done;
+       }
+       logFinalize();
+       rc = saLogStreamClose(logStreamHandle);
+       test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
+
+done:
+       logFinalize();
+}
diff --git a/src/log/apitest/tet_saLogStreamOpen_2.c 
b/src/log/apitest/tet_saLogStreamOpen_2.c
index 93c795c..1c35260 100644
--- a/src/log/apitest/tet_saLogStreamOpen_2.c
+++ b/src/log/apitest/tet_saLogStreamOpen_2.c
@@ -1162,6 +1162,7 @@ extern void saLogWriteLogAsync_20(void);
 extern void saLogWriteLogCallbackT_01(void);
 extern void saLogWriteLogCallbackT_02(void);
 extern void saLogStreamClose_01(void);
+extern void saLogStreamClose_02(void);
 
 __attribute__((constructor)) static void saLibraryLifeCycle_constructor(void)
 {
@@ -1269,6 +1270,7 @@ __attribute__((constructor)) static void 
saLibraryLifeCycle_constructor(void)
        test_case_add(2, saLogWriteLogCallbackT_02,
                      "saLogWriteLogCallbackT() SA_DISPATCH_ALL");
        test_case_add(2, saLogStreamClose_01, "saLogStreamClose OK");
+       test_case_add(2, saLogStreamClose_02, "saLogStreamClose BAD_HANDLE");
        test_case_add(2, saLogStreamOpen_2_46,
                      "saLogStreamOpen_2 with maxFilesRotated = 0, ERR");
        test_case_add(2, saLogStreamOpen_2_47,
-- 
2.7.4



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

Reply via email to