libtest.lua problems - General Discussion and Assistance - CHDK Forum supplierdeeply

libtest.lua problems

  • 5 Replies
  • 3398 Views
libtest.lua problems
« on: 14 / January / 2011, 13:57:46 »
Advertisements
I do the libtest.lua script and it crash camera.

there are 2 file create on Card

iotest.txt contain this text

""
the quick brown fox jumps over the lazy dog
1
2a   3 1234567890       b""



llibtst.log is of filesize 0 and contain no text.

So i think first the log command do not work

but because log is a mathematical function in wrappers.c , so i do not know, what camera function log call
Can somebody please tell what Camera functions the lua log command call ?

I search the whole trunk for lua_log but i find nothing.


« Last Edit: 14 / January / 2011, 14:00:35 by Bernd R »
Ixus 1000 HS

*

Offline reyalp

  • ******
  • 14082
Re: libtest.lua problems
« Reply #1 on: 14 / January / 2011, 15:48:18 »
Try looking in the script itself
Code: [Select]
function log(...)
io.write(...)
-- most crashes leave no log even if we flush, and it's really slow :(
-- io.output():flush()
end
Mathematical log would be in the lua math library, if it were implemented. Only functions that are specifically registered into lua (mostly in core/luascript.c) are available to lua. Other C function names are completely irrelevant to lua.
Don't forget what the H stands for.

Re: libtest.lua problems
« Reply #2 on: 15 / January / 2011, 04:15:49 »
thanks, i change now this line

--   io.output():flush()

to

io.output():flush()

so the flush is always do.

then the test do not crash.it take 5 sec now but run complete

Edit:
seem only remove a dir not work on this Port.because when i remove this dir from PC, i get this error not. 

os.mkdir("A/MDTST0"): ERR A/MDTST0: error FAIL

But strange wy the remove function work on files, but not on dir

I read in other thread about too few stack.I add on IX1000 too more stack code, but this does not solve the crash.

maybe there is a buffer overflow that cause crash, when too much text is write to log buffer and it is not flush.

the logfile show this

test log opened
platform: ixus1000_sd4500 100d
version: CHDK 0.9.9-1023 built on Jan 14 2011 18:44:15
os: dryos platformid: 12792
***test io***
file info for io.input: closed file!
file info for io.output: valid file
 ptr: 3422264 fd: 3 len: 230 pos: 230
 raw vals: 0:3 4:230 8:1 12:230 16:1 20:0 24:1077231392 28:0 32:1819029313
io.open("A/iotest0.txt","w+b"): OK PASS
A/iotest0.txt:write(...): OK PASS
A/iotest0.txt:seek("set",4): OK 4 PASS
A/iotest0.txt:read(5): string [slick]
A/iotest0.txt:seek("nil",nil): OK 9 PASS
A/iotest0.txt:seek("cur",-5): OK 4 PASS
A/iotest0.txt:write(...): OK PASS
A/iotest0.txt:seek("end",nil): OK 44 PASS
A/iotest0.txt:write(...): OK PASS
A/iotest0.txt:flush(): OK PASS
A/iotest0.txt:seek("set",nil): OK 0 PASS
test file:lines()
0: [the quick brown fox jumps over the lazy dog]
1: [1]
2: [2a   3 1234567890       b]
A/iotest0.txt:seek("set",nil): OK 0 PASS
A/iotest0.txt:write(...): OK PASS
A/iotest0.txt:seek("set",nil): OK 0 PASS
test file:read("*a")
A/iotest0.txt:read(*a): string [                                          
1
2a   3 1234567890       b]
A/iotest0.txt:seek("set",nil): OK 0 PASS
testing file:read("*n")
A/iotest0.txt:read(*n): number [1]
A/iotest0.txt:seek("nil",nil): OK 45 NA
A/iotest0.txt:read(*n): number [2]
A/iotest0.txt:seek("nil",nil): OK 47 NA
A/iotest0.txt:read(*n): <no results>
A/iotest0.txt:seek("nil",nil): OK 47 NA
A/iotest0.txt:read(1): string [a]
A/iotest0.txt:seek("nil",nil): OK 48 NA
A/iotest0.txt:read(*n): number [3]
A/iotest0.txt:seek("nil",nil): OK 52 NA
A/iotest0.txt:read(*n): number [1234567890]
A/iotest0.txt:seek("nil",nil): OK 63 NA
A/iotest0.txt:read(*n): <no results>
A/iotest0.txt:seek("nil",nil): OK 70 NA
A/iotest0.txt:read(1): string
A/iotest0.txt:seek("nil",nil): OK 71 NA
A/iotest0.txt:read(*n): <no results>
A/iotest0.txt:seek("nil",nil): OK 71 NA
A/iotest0.txt:read(1): <no results>
A/iotest0.txt:seek("nil",nil): OK 71 NA
A/iotest0.txt:close(): OK PASS
test open missing file
io.open("A/bogus","r"): ERR msg=A/bogus: error PASS
test open dir
io.open("A/CHDK","r"): ERR msg=A/CHDK: error PASS
io.open("A/iotest0.txt","r"): OK PASS
test invalid seeks
A/iotest0.txt:seek("set",-1): ERR nil PASS
A/iotest0.txt:seek("end",100): ERR nil PASS
A/iotest0.txt:close(): OK PASS
***end io OK***

***test os***
current date Sat Jan 15 09:59:41 2011
os.time(): OK 1295085581 PASS
os.time({day=1,year=1980,month=1,}): OK 315576000 PASS
os.time({day=1,year=1066,month=1,}): ERR PASS
%a [Sat]
%A [Saturday]
%b [Jan]
%B [January]
%c [Sat Jan 15 09:59:42 2011]
%d [15]
%H [09]
%I [09]
%j [015]
%m [01]
%M [59]
%p [AM]
%S [42]
%U [02]
%w [6]
%W [02]
%x [01/15/11]
%X [09:59:42]
%y [11]
%Y [2011]
%Z [%Z]
%% [%]
os.mkdir("A/MDTST0"): ERR A/MDTST0: error FAIL
io.open("A/MDTST0/TEST0.DAT","wb"): OK PASS
A/MDTST0/TEST0.DAT:write(...): OK PASS
A/MDTST0/TEST0.DAT:close(): OK PASS
os.stat("A/MDTST0/TEST0.DAT"): OK PASS
{
 dev=nil
 mode=nil
 size=4
 atime=nil
 mtime=1295085582
 ctime=1295085582
 blksize=nil
 blocks=nil
 attrib=32
 is_dir=false
 is_file=true
}
os.utime("A/MDTST0/TEST0.DAT",nil,nil): OK PASS
os.stat("A/MDTST0/TEST0.DAT"): OK PASS
{
 dev=nil
 mode=nil
 size=4
 atime=nil
 mtime=1295085582
 ctime=1295085582
 blksize=nil
 blocks=nil
 attrib=32
 is_dir=false
 is_file=true
}
os.utime("A/MDTST0/TEST0.DAT",441806400,472824000): OK PASS
os.stat("A/MDTST0/TEST0.DAT"): OK PASS
{
 dev=nil
 mode=nil
 size=4
 atime=nil
 mtime=472824000
 ctime=1295085582
 blksize=nil
 blocks=nil
 attrib=32
 is_dir=false
 is_file=true
}
os.stat("A/MDTST0"): OK PASS
{
 dev=nil
 mode=nil
 size=0
 atime=nil
 mtime=1295085422
 ctime=1295085422
 blksize=nil
 blocks=nil
 attrib=16
 is_dir=true
 is_file=false
}
os.rename("A/MDTST0/TEST0.DAT","A/MDTST0/TEST1.DAT): OK PASS
os.listdir("A/MDTST0",nil): OK PASS
{
 1="TEST1.DAT"
}
os.listdir("A/MDTST0",true): OK PASS
{
 1="."
 2=".."
 3="TEST1.DAT"
}
os.remove("A/MDTST0): ERR A/MDTST0: error PASS
os.remove("A/bogus): ERR A/bogus: error PASS
os.listdir("A/bogus",nil): ERR A/bogus: error PASS
os.listdir("A/llibtst.log",nil): OK NA
{
 1="test"
 2="00_sd450.0"
 3="44:15
os.:"
 4=".input:.clo"
 5="or.tpu"
 6="422264.d:"
 7="write(....):"
 8="t:seek(".set"
 9="est0.txt.:re"
 10=".SS
"
 11="ur",-5):"
 12="xt:seek(."en"
 13="/iotest0..tx"
 14="
A/iotes.t0."
 15="K.
te"
 16="34567890"
 17="otest0.t.xt:"
 18=".st"
 19="est0.txt.:re"
}
os.stat("A/bogus"): ERR A/bogus: error PASS
os.utime("A/bogus",nil,nil): ERR A/bogus: error PASS
os.rename("A/bogus","A/blah): ERR A/bogus: error PASS
os.mkdir("A/CHDK"): ERR A/CHDK: error PASS
os.remove("A/MDTST0/TEST1.DAT): OK PASS
os.remove("A/MDTST0): ERR A/MDTST0: error FAIL
os.remove("A/iotest0.txt): OK NA
***end os FAIL 2***

***test string***
string.byte("test",2): OK 101 PASS
string.char(116,101,115,116): OK test PASS
dump/load: OK test123 PASS
string.find("test 1 2 3F!?","t%s(%d) 2 (%x%x%p%p)$"): OK 4 13 1 3F!? PASS
string.format("%c %d %x %s",100,100,100,"test"): OK d 100 64 test PASS
string.len("\000test"): OK 5 PASS
string.lower("TESTtest"): OK testtest PASS
string.upper("TESTtest"): OK TESTTEST PASS
string.rep("test",2): OK testtest PASS
string.reverse("123"): OK 321 PASS
string.sub("test",-3): OK est PASS
***end string OK***

close test log
« Last Edit: 15 / January / 2011, 04:35:27 by Bernd R »
Ixus 1000 HS

*

Offline reyalp

  • ******
  • 14082
Re: libtest.lua problems
« Reply #3 on: 15 / January / 2011, 15:08:03 »
Is the MDTST0 directory actually empty after the test ?

edit:
It's also very odd that adding the flush would fix any problem, all it does is call  the camera function Fflush_Fut, it's not CHDK code doing any buffering. Maybe slowing things down avoids some other problem...
« Last Edit: 15 / January / 2011, 15:10:46 by reyalp »
Don't forget what the H stands for.


Re: libtest.lua problems
« Reply #4 on: 16 / January / 2011, 06:53:09 »
Yes, MDTST0 is always empty.

I test several times(delete dir in PC), i try also when lens is out in shooting mode.result is same.
random crash of the lua script when i do flush, i not see.

maybe other with new CAM S95/sx30/G12 can test this script too.
Ixus 1000 HS

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: libtest.lua problems
« Reply #5 on: 21 / February / 2011, 05:02:41 »
Yes, MDTST0 is always empty.

I test several times(delete dir in PC), i try also when lens is out in shooting mode.result is same.
random crash of the lua script when i do flush, i not see.

maybe other with new CAM S95/sx30/G12 can test this script too.

G12 has the same problem in that the MDTST0 directory is not removed; but the script does not crash.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics