lua-users home
lua-l archive

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


> Hi Lua experts,
> <re-post in plain text>
> I’d appreciate any hints that might not be obvious to the new user.
> I’m working on a port of Lua 5.3.5 to the current VxWorks 7, (patch below).  I’m an employee of Wind River that specializes in porting 3rd party software to VxWorks. But I don’t know Lua.
> I’m running the 5.3.4 test suite and getting failures in few places, I’ll be slowly be debugging them over the coming weeks as side project.
> I’m not using the testC library yet. I’ll get there ☺

Did you read the instructions in https://www.lua.org/tests/? You should
really start with the basic tests (that will avoid your problems
with 'main.lua', 'files.lua', and 'attrib.lua'). Once you have that
working, go to the next step. As warned there, beware that the complete
tests are not portable.

> strings.lua 
> ========
> Looks like tonumber() is not my friend for some reason. I’m on possibly related internal thread on similar issues with the VxWorks C library.  
> What’s different between the C calls that string.format() uses vs. what tonumber()  uses??
>    
> failed assert strings.lua:226
> do    -- longest number that can be formatted
>   local i = 1
>   local j = 10000
>   while i + 1 < j do   -- binary search for maximum finite float
>     local m = (i + j) // 2
>     if 10^m < math.huge then i = m else j = m end
>   end
>   local s = string.format('%.99f', -(10^i))
>   assert(tonumber(s) == -(10^i))
> end

It would help if you could tell what is happening here. Did you print
the various values produced?

  print(i, 10^i, s, tonumber(s))


> files.lua
> ======
> This I have to call this with _ports == true, to avoid the tests using popen(), which VxWorks doesn’t have.
> 
> I still get a failure in this assert:
> do
>   local D = os.date("*t")
>   local t = os.time(D)
>   assert(type(D.isdst) == 'boolean')
> end

Sorry, this test should be coded as not portable. The manual is clear
about this:

    This last field [isdst] may be absent
    if the information is not available.

(Did the previous test work?)

-- Roberto