Test case logtest 2 49 creates some cfg app to test the limitation, then deleting these stream at the end. But the deleting fails due to timeout for waiting the implementer. After that test case logtest 6 42 need to create some cfg app and take the same stream name. That causes the creattion fail with SA_AIS_ERR_EXIST error.
The patch updates stream name of 2 test case and update the retry of renaming file is 5s due to imm wait for implemeter 6s. --- src/log/apitest/tet_LogOiOps.c | 20 ++++++++++---------- src/log/apitest/tet_saLogStreamOpen_2.c | 10 +++++----- src/log/logd/lgs_stream.cc | 23 ++++++++++------------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/log/apitest/tet_LogOiOps.c b/src/log/apitest/tet_LogOiOps.c index 02dd20996..417d31de2 100644 --- a/src/log/apitest/tet_LogOiOps.c +++ b/src/log/apitest/tet_LogOiOps.c @@ -5324,7 +5324,7 @@ void verNetworkName_01(void) /* * Add test case for ticket #1446 - * Verify that invalid Object if number of app streams has reached the + * Verify that invalid Object if number of cfg app streams has reached the * limitation * */ @@ -5356,9 +5356,9 @@ void verStrLimit(void) for (num = curAppCount; num < v_logMaxApplicationStreams; num++) { /* Create configurable app stream */ sprintf(command, - "immcfg -c SaLogStreamConfig safLgStrCfg=test%d" - " -a saLogStreamPathName=." - " -a saLogStreamFileName=test%d", + "immcfg -c SaLogStreamConfig " + "safLgStrCfg=cfg_app_limit%d -a saLogStreamPathName=." + " -a saLogStreamFileName=cfg_app_limit%d", num, num); rc = system(command); if (WEXITSTATUS(rc)) { @@ -5378,24 +5378,24 @@ void verStrLimit(void) /* Create configurable app stream while number of app stream limitation */ sprintf(command, - "immcfg -c SaLogStreamConfig safLgStrCfg=test%d" + "immcfg -c SaLogStreamConfig safLgStrCfg=cfg_app_limit%d" " -a saLogStreamPathName=." - " -a saLogStreamFileName=test%d 2> /dev/null", + " -a saLogStreamFileName=cfg_app_limit%d 2> /dev/null", num, num); rc = system(command); rc_validate(WEXITSTATUS(rc), 1); if (WEXITSTATUS(rc) == 0) { - sprintf(command, "immcfg -d safLgStrCfg=test%d 2> /dev/null", - num); + sprintf(command, "immcfg -d safLgStrCfg=cfg_app_limit%d " + "2> /dev/null", num); rc = system(command); } done: /* Delete app stream */ for (num = curAppCount; num < v_logMaxApplicationStreams; num++) { - sprintf(command, "immcfg -d safLgStrCfg=test%d 2> /dev/null", - num); + sprintf(command, "immcfg -d safLgStrCfg=cfg_app_limit%d " + "2> /dev/null", num); rc = system(command); } } diff --git a/src/log/apitest/tet_saLogStreamOpen_2.c b/src/log/apitest/tet_saLogStreamOpen_2.c index 699239225..79ea385f7 100644 --- a/src/log/apitest/tet_saLogStreamOpen_2.c +++ b/src/log/apitest/tet_saLogStreamOpen_2.c @@ -780,7 +780,7 @@ done: /* * Add test case for ticket #1446 - * Verify that logsv failed to create app stream if number of app + * Verify that logsv failed to create runtime app stream if number of app * streams has reached the limitation * */ @@ -816,9 +816,9 @@ void saLogStreamOpen_2_50(void) for (num = curAppCount; num < maxAppStream; num++) { /* Create configurable app stream */ sprintf(command, - "immcfg -c SaLogStreamConfig safLgStrCfg=test%d" + "immcfg -c SaLogStreamConfig safLgStrCfg=app_limit%d" " -a saLogStreamPathName=." - " -a saLogStreamFileName=test%d", + " -a saLogStreamFileName=app_limit%d", num, num); rc = system(command); if (WEXITSTATUS(rc)) { @@ -847,8 +847,8 @@ void saLogStreamOpen_2_50(void) done: /* Delete app stream */ for (num = curAppCount; num < maxAppStream; num++) { - sprintf(command, "immcfg -d safLgStrCfg=test%d 2> /dev/null", - num); + sprintf(command, "immcfg -d safLgStrCfg=app_limit%d " + "2> /dev/null", num); rc = system(command); } } diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc index 4f50f5a98..7b7be4dd2 100644 --- a/src/log/logd/lgs_stream.cc +++ b/src/log/logd/lgs_stream.cc @@ -833,13 +833,12 @@ void log_stream_close(log_stream_t **s, time_t *close_time_ptr) { std::string file_to_rename; char *timeString = NULL; std::string emptyStr = ""; - uint32_t msecs_waited = 0; - const unsigned int max_waiting_time = 8 * 1000; /* 8 secs */ - const unsigned int sleep_delay_ms = 500; SaUint32T trace_num_openers; struct timespec closetime_tspec; const std::string root_path = static_cast<const char *>(lgs_cfg_get(LGS_IMM_LOG_ROOT_DIRECTORY)); + struct timespec timeout_time; + const uint64_t kWaitTime = 5 * 1000; // Wait for timeout is 5 seconds osafassert(stream != NULL); TRACE_ENTER2("%s", stream->name.c_str()); @@ -885,13 +884,12 @@ void log_stream_close(log_stream_t **s, time_t *close_time_ptr) { } /* Rename stream log file */ - rc = lgs_file_rename_h(root_path, stream->pathName, file_to_rename, - timeString, LGS_LOG_FILE_EXT, &emptyStr); - while ((rc == -1) && (msecs_waited < max_waiting_time)) { - usleep(sleep_delay_ms * 1000); - msecs_waited += sleep_delay_ms; + osaf_set_millis_timeout(kWaitTime, &timeout_time); + while (!osaf_is_timeout(&timeout_time)) { rc = lgs_file_rename_h(root_path, stream->pathName, file_to_rename, timeString, LGS_LOG_FILE_EXT, &emptyStr); + if (rc != -1) break; + osaf_nanosleep(&kHundredMilliseconds); } if (rc == -1) { @@ -900,14 +898,13 @@ void log_stream_close(log_stream_t **s, time_t *close_time_ptr) { } /* Rename stream config file */ - rc = lgs_file_rename_h(root_path, stream->pathName, stream->fileName, - timeString, LGS_LOG_FILE_CONFIG_EXT, &emptyStr); - while ((rc == -1) && (msecs_waited < max_waiting_time)) { - usleep(sleep_delay_ms * 1000); - msecs_waited += sleep_delay_ms; + while (!osaf_is_timeout(&timeout_time)) { rc = lgs_file_rename_h(root_path, stream->pathName, stream->fileName, timeString, LGS_LOG_FILE_CONFIG_EXT, &emptyStr); + if (rc != -1) break; + osaf_nanosleep(&kHundredMilliseconds); } + if (rc == -1) { LOG_WA("Could not rename config file: %s", strerror(errno)); goto done_files; -- 2.15.1 ------------------------------------------------------------------------------ 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