[asterisk-commits] mnicholson: testsuite/asterisk/trunk r309 - /asterisk/trunk/asttest/lib/lua/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 25 14:01:04 CDT 2010
Author: mnicholson
Date: Tue May 25 14:01:02 2010
New Revision: 309
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=309
Log:
Put staging dir in /tmp/asterisk-testsuite instead of in the test dir.
Modified:
asterisk/trunk/asttest/lib/lua/astlib.c
Modified: asterisk/trunk/asttest/lib/lua/astlib.c
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/lib/lua/astlib.c?view=diff&rev=309&r1=308&r2=309
==============================================================================
--- asterisk/trunk/asttest/lib/lua/astlib.c (original)
+++ asterisk/trunk/asttest/lib/lua/astlib.c Tue May 25 14:01:02 2010
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <libgen.h>
/*!
* \brief Make the parent directories of a given path.
@@ -260,6 +261,7 @@
static int new_asterisk(lua_State *L) {
int asterisk_count;
char path[PATH_MAX];
+ char *bname;
/* get the index for this instance */
lua_getfield(L, LUA_REGISTRYINDEX, "astlib_count");
@@ -280,11 +282,23 @@
return lua_error(L);
}
- lua_pushstring(L, path);
- lua_pushliteral(L, "/tmp/ast");
- lua_pushinteger(L, asterisk_count);
- lua_concat(L, 3);
- lua_setfield(L, -2, "work_area");
+ bname = basename(path);
+ /* handle some special basename paths by putting the tmp dir in the
+ * current directory, otherwise put it in /tmp */
+ if (!strcmp(bname, ".") || !strcmp(bname, "..") || !strcmp(bname, "/")) {
+ lua_pushstring(L, getcwd(path, sizeof(path)));
+ lua_pushliteral(L, "/tmp/ast");
+ lua_pushinteger(L, asterisk_count);
+ lua_concat(L, 3);
+ lua_setfield(L, -2, "work_area");
+ } else {
+ lua_pushliteral(L, "/tmp/asterisk-testsuite/");
+ lua_pushstring(L, bname);
+ lua_pushliteral(L, "/ast");
+ lua_pushinteger(L, asterisk_count);
+ lua_concat(L, 4);
+ lua_setfield(L, -2, "work_area");
+ }
lua_pushinteger(L, asterisk_count);
lua_setfield(L, -2, "index");
More information about the asterisk-commits
mailing list