lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I'm trying to get all the lua tests working on Solaris.

I'm using the 5.2.3 lua source tarball and as I didn't see a
matching 5.2.3 test tarball, I'm using the 5.2.2 one.

I run:

$ cd lua-5.2.2-tests; /tank/ws/UL/new-lua/lua-5.2.3/src/lua -e"_U=true" all.lua;

The tests work fine until files.lua, where I get:

...
***** FILE 'files.lua'*****
testing i/o
+
+
+
/tank/ws/UL/new-lua/lua-5.2.3/src/lua: files.lua:199: assertion failed!
stack traceback:
        [C]: in function 'assert'
        files.lua:199: in main chunk
        (...tail calls...)
        all.lua:192: in main chunk
        [C]: in ?
>>> closing state <<<
...

The failing code is:

...
189 -- test errors in read/write
190 do
191   local function ismsg (m)
192     -- error message is not a code number
193     return (type(m) == "string" and tonumber(m) == nil)
194   end
195
196   -- read
197   local f = io.open(file, "w")
198   local r, m, c = f:read()
199   assert(r == nil and ismsg(m) and type(c) == "number")
200   assert(f:close())
201   -- write
202   f = io.open(file, "r")
203   r, m, c = f:write("whatever")
204   assert(r == nil and ismsg(m) and type(c) == "number")
205   assert(f:close())
206   -- lines
207   f = io.open(file, "w")
208   r, m = pcall(f:lines())
209   assert(r == false and ismsg(m))
210   assert(f:close())
211 end
...

If I comment out lines 199 and 209, i.e.:

--- files.lua.orig      2014-09-18 05:23:57.244606653 -0700
+++ files.lua   2014-09-18 05:25:52.259736495 -0700
@@ -196,7 +196,7 @@
   -- read
   local f = io.open(file, "w")
   local r, m, c = f:read()
-  assert(r == nil and ismsg(m) and type(c) == "number")
+--  assert(r == nil and ismsg(m) and type(c) == "number")
   assert(f:close())
   -- write
   f = io.open(file, "r")
@@ -206,7 +206,7 @@
   -- lines
   f = io.open(file, "w")
   r, m = pcall(f:lines())
-  assert(r == false and ismsg(m))
+--  assert(r == false and ismsg(m))
   assert(f:close())
 end

all the tests pass.

Looking at:

http://www.lua.org/tests/5.2/

I see:

  Do not worry if it does not work the first time you try. (That is why
  there is the _U option after all.) You may need to adjust small details
for your system. Among others, here is a list of things that may go wrong:

      small bugs in your system's C library;
file names returned by tmpnam cannot be opened or cannot be opened in write mode; names in C libraries need a "_" prefix (only for function package.loadlib; see test attrib.lua);
      unconventional syntax for the command processor in os.execute.

I'm guessing I might be hitting the second one there. Could anybody provide more details why:

file names returned by tmpnam cannot be opened or cannot be opened in write mode;

might occur and how I should work-around/fix it?

Thanks.