[svn-commits] mnicholson: testsuite/asterisk/trunk r442 - in /asterisk/trunk/asttest/self-t...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 24 15:30:59 CDT 2010


Author: mnicholson
Date: Thu Jun 24 15:30:56 2010
New Revision: 442

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=442
Log:
Added an asttest self test for proc:wait() and improved the proclib_io test

Added:
    asterisk/trunk/asttest/self-tests/proclib_wait/
    asterisk/trunk/asttest/self-tests/proclib_wait/test.lua   (with props)
Modified:
    asterisk/trunk/asttest/self-tests/proclib_io/test.lua

Modified: asterisk/trunk/asttest/self-tests/proclib_io/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/self-tests/proclib_io/test.lua?view=diff&rev=442&r1=441&r2=442
==============================================================================
--- asterisk/trunk/asttest/self-tests/proclib_io/test.lua (original)
+++ asterisk/trunk/asttest/self-tests/proclib_io/test.lua Thu Jun 24 15:30:56 2010
@@ -1,5 +1,6 @@
 -- test proclib's ablity to read from stdout and stderr and write to stdin
 
+print("reading from stdout")
 test_string = "this is a test"
 p = proc.exec_io("echo", "-n", test_string)
 res = p.stdout:read("*a")
@@ -7,6 +8,7 @@
 fail_if(test_string ~= res, "echo test failed: read '" .. res .. "' expected '" .. test_string .. "'") 
 
 
+print("writing to stdin and reading from stdout")
 p = proc.exec_io("cat")
 p.stdin:write(test_string)
 p.stdin:close()
@@ -15,3 +17,12 @@
 
 fail_if(test_string ~= res, "cat test failed: read '" .. res .. "' expected '" .. test_string .. "'") 
 
+print("reading from stderr")
+p = proc.exec_io("cat", "this path should not exist")
+res = p.stderr:read("*a")
+
+print("read: " .. tostring(res))
+
+fail_if(not res, "error reading from stderr")
+fail_if(#res == 0, "result was a zero length string")
+

Added: asterisk/trunk/asttest/self-tests/proclib_wait/test.lua
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/asttest/self-tests/proclib_wait/test.lua?view=auto&rev=442
==============================================================================
--- asterisk/trunk/asttest/self-tests/proclib_wait/test.lua (added)
+++ asterisk/trunk/asttest/self-tests/proclib_wait/test.lua Thu Jun 24 15:30:56 2010
@@ -1,0 +1,17 @@
+-- test proc:wait
+
+print("executing 'sleep 1' then wait()")
+p = proc.exec("sleep", 1)
+res, err = proc.perror(p:wait())
+fail_if(res ~= 0, "error waiting for sleep, res == " .. tostring(res) .. " (expected 0)")
+
+print("executing 'sleep 1', then wait(10)")
+p = proc.exec("sleep", 1)
+res, err = proc.perror(p:wait(10))
+fail_if(res ~= nil and err ~= "timeout", "expected timeout")
+
+print("executing 'sleep 1', then wait(1500)")
+p = proc.exec("sleep", 1)
+res, err = proc.perror(p:wait(1500))
+fail_if(res ~= 0, "error waiting for sleep, res == " .. tostring(res) .. " (expected 0)")
+

Propchange: asterisk/trunk/asttest/self-tests/proclib_wait/test.lua
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/asttest/self-tests/proclib_wait/test.lua
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/asttest/self-tests/proclib_wait/test.lua
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list