[asterisk-commits] tilghman: trunk r289588 - in /trunk: ./ funcs/ include/asterisk/ main/stdtime...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 30 15:40:11 CDT 2010
Author: tilghman
Date: Thu Sep 30 15:40:08 2010
New Revision: 289588
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=289588
Log:
Merged revisions 289543,289581 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r289543 | tilghman | 2010-09-30 12:50:52 -0500 (Thu, 30 Sep 2010) | 2 lines
More Solaris compatibility fixes
........
r289581 | tilghman | 2010-09-30 15:23:10 -0500 (Thu, 30 Sep 2010) | 2 lines
Solaris fixes.
........
Modified:
trunk/ (props changed)
trunk/funcs/func_env.c
trunk/include/asterisk/localtime.h
trunk/main/stdtime/localtime.c
trunk/res/res_agi.c
trunk/tests/test_time.c
trunk/tests/test_utils.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/funcs/func_env.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_env.c?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/funcs/func_env.c (original)
+++ trunk/funcs/func_env.c Thu Sep 30 15:40:08 2010
@@ -788,7 +788,7 @@
fseeko(ff, offset, SEEK_SET);
ast_debug(3, "offset=%s/%" PRId64 ", length=%s/%" PRId64 ", vlength=%" PRId64 ", flength=%" PRId64 "\n",
- args.offset, offset, args.length, length, vlength, flength);
+ S_OR(args.offset, "(null)"), offset, S_OR(args.length, "(null)"), length, vlength, flength);
if (length == vlength) {
/* Simplest case, a straight replace */
@@ -820,6 +820,11 @@
fseeko(ff, cur + vlength - length, SEEK_SET);
if (fwrite(fbuf, 1, sizeof(fbuf), ff) < sizeof(fbuf)) {
ast_log(LOG_ERROR, "Short write?!!\n");
+ }
+ /* Seek to where we stopped reading */
+ if (fseeko(ff, cur + sizeof(fbuf), SEEK_SET) < 0) {
+ /* Only reason for seek to fail is EOF */
+ break;
}
}
fclose(ff);
Modified: trunk/include/asterisk/localtime.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/localtime.h?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/include/asterisk/localtime.h (original)
+++ trunk/include/asterisk/localtime.h Thu Sep 30 15:40:08 2010
@@ -98,6 +98,7 @@
* between checks to verify whether a timezone file has changed. This routine
* forces the monitor thread to wakeup immediately and check the timezone files.
*/
-void ast_localtime_wakeup_monitor(void);
+struct ast_test;
+void ast_localtime_wakeup_monitor(struct ast_test *info);
#endif /* _ASTERISK_LOCALTIME_H */
Modified: trunk/main/stdtime/localtime.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stdtime/localtime.c?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/main/stdtime/localtime.c (original)
+++ trunk/main/stdtime/localtime.c Thu Sep 30 15:40:08 2010
@@ -52,6 +52,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <float.h>
+#include <stdlib.h>
#ifdef HAVE_INOTIFY
#include <sys/inotify.h>
#elif defined(HAVE_KQUEUE)
@@ -71,6 +72,7 @@
#include "asterisk/strings.h"
#include "asterisk/linkedlists.h"
#include "asterisk/utils.h"
+#include "asterisk/test.h"
#ifndef lint
#ifndef NOID
@@ -104,6 +106,13 @@
static const char gmt[] = "GMT";
static const struct timeval WRONG = { 0, 0 };
+
+#ifdef TEST_FRAMEWORK
+/* Protected from multiple threads by the zonelist lock */
+static struct ast_test *test = NULL;
+#else
+struct ast_test;
+#endif
/*! \note
* The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
@@ -545,7 +554,11 @@
stat(name, &st);
lstat(name, &lst);
if (st.st_mtime > cur->mtime[0] || lst.st_mtime > cur->mtime[1]) {
- ast_log(LOG_NOTICE, "Removing cached TZ entry '%s' because underlying file changed.\n", name);
+ if (test) {
+ ast_test_status_update(test, "Removing cached TZ entry '%s' because underlying file changed. (%ld != %ld) or (%ld != %ld)\n", name, st.st_mtime, cur->mtime[0], lst.st_mtime, cur->mtime[1]);
+ } else {
+ ast_log(LOG_NOTICE, "Removing cached TZ entry '%s' because underlying file changed.\n", name);
+ }
AST_LIST_REMOVE_CURRENT(list);
ast_free(cur);
continue;
@@ -581,12 +594,18 @@
}
#endif
-void ast_localtime_wakeup_monitor(void)
+void ast_localtime_wakeup_monitor(struct ast_test *info)
{
if (inotify_thread != AST_PTHREADT_NULL) {
AST_LIST_LOCK(&zonelist);
+#ifdef TEST_FRAMEWORK
+ test = info;
+#endif
pthread_kill(inotify_thread, SIGURG);
ast_cond_wait(&initialization, &(&zonelist)->lock);
+#ifdef TEST_FRAMEWORK
+ test = NULL;
+#endif
AST_LIST_UNLOCK(&zonelist);
}
}
@@ -1386,8 +1405,16 @@
{
struct state *sp;
- if (ast_strlen_zero(zone))
+ if (ast_strlen_zero(zone)) {
+#ifdef SOLARIS
+ zone = getenv("TZ");
+ if (ast_strlen_zero(zone)) {
+ zone = "GMT";
+ }
+#else
zone = "/etc/localtime";
+#endif
+ }
AST_LIST_LOCK(&zonelist);
AST_LIST_TRAVERSE(&zonelist, sp, list) {
Modified: trunk/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_agi.c?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Thu Sep 30 15:40:08 2010
@@ -3029,11 +3029,20 @@
*((char **) &cmd->syntax) = ast_xmldoc_build_syntax("agi", fullcmd);
*((char **) &cmd->seealso) = ast_xmldoc_build_seealso("agi", fullcmd);
*((enum ast_doc_src *) &cmd->docsrc) = AST_XML_DOC;
-#elif (!defined(HAVE_NULLSAFE_PRINTF))
- *((char **) &cmd->summary) = ast_strdup("");
- *((char **) &cmd->usage) = ast_strdup("");
- *((char **) &cmd->syntax) = ast_strdup("");
- *((char **) &cmd->seealso) = ast_strdup("");
+#endif
+#ifndef HAVE_NULLSAFE_PRINTF
+ if (!cmd->summary) {
+ *((char **) &cmd->summary) = ast_strdup("");
+ }
+ if (!cmd->usage) {
+ *((char **) &cmd->usage) = ast_strdup("");
+ }
+ if (!cmd->syntax) {
+ *((char **) &cmd->syntax) = ast_strdup("");
+ }
+ if (!cmd->seealso) {
+ *((char **) &cmd->seealso) = ast_strdup("");
+ }
#endif
}
@@ -3802,15 +3811,18 @@
}
if (ast_agi_register(ast_module_info->self, &noop_command) == 0) {
+ ast_test_status_update(test, "Unable to register testnoop command, because res_agi is not loaded.\n");
return AST_TEST_NOT_RUN;
}
#ifndef HAVE_NULLSAFE_PRINTF
/* Test for condition without actually crashing Asterisk */
if (noop_command.usage == NULL) {
+ ast_test_status_update(test, "AGI testnoop usage was not updated properly.\n");
res = AST_TEST_FAIL;
}
if (noop_command.syntax == NULL) {
+ ast_test_status_update(test, "AGI testnoop syntax was not updated properly.\n");
res = AST_TEST_FAIL;
}
#endif
Modified: trunk/tests/test_time.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_time.c?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/tests/test_time.c (original)
+++ trunk/tests/test_time.c Thu Sep 30 15:40:08 2010
@@ -73,7 +73,13 @@
}
snprintf(tzfile, sizeof(tzfile), "%s/test", tmpdir);
- for (type = 0; type < 2; type++) {
+ for (type = 0; type <
+#ifdef SOLARIS
+ 1 /* Solaris doesn't use symlinks for timezones */
+#else
+ 2
+#endif
+ ; type++) {
ast_test_status_update(test, "Executing %s test...\n", type == 0 ? "deletion" : "symlink");
for (i = 0; i < ARRAY_LEN(zones); i++) {
int system_res;
@@ -81,8 +87,8 @@
if ((system_res = ast_safe_system(syscmd))) {
ast_log(LOG_WARNING, "system(%s) returned non-zero: %d\n", syscmd, system_res);
}
- ast_localtime_wakeup_monitor();
- sched_yield();
+ ast_localtime_wakeup_monitor(test);
+ ast_test_status_update(test, "Querying timezone %s\n", tzfile);
ast_localtime(&tv, &atm[i], tzfile);
if (i != 0) {
if (atm[i].tm_hour == atm[i - 1].tm_hour) {
Modified: trunk/tests/test_utils.c
URL: http://svnview.digium.com/svn/asterisk/trunk/tests/test_utils.c?view=diff&rev=289588&r1=289587&r2=289588
==============================================================================
--- trunk/tests/test_utils.c (original)
+++ trunk/tests/test_utils.c Thu Sep 30 15:40:08 2010
@@ -325,15 +325,18 @@
#endif
if (ast_agi_register(ast_module_info->self, &noop_command) == AST_OPTIONAL_API_UNAVAILABLE) {
+ ast_test_status_update(test, "Unable to register testnoop command, because res_agi is not loaded.\n");
return AST_TEST_FAIL;
}
#ifndef HAVE_NULLSAFE_PRINTF
/* Test for condition without actually crashing Asterisk */
if (noop_command.usage == NULL) {
+ ast_test_status_update(test, "AGI testnoop usage was not updated properly.\n");
res = AST_TEST_FAIL;
}
if (noop_command.syntax == NULL) {
+ ast_test_status_update(test, "AGI testnoop syntax was not updated properly.\n");
res = AST_TEST_FAIL;
}
#endif
More information about the asterisk-commits
mailing list