Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoray kavukcuoglu <koray@kavukcuoglu.org>2013-01-03 14:31:00 +0400
committerkoray kavukcuoglu <koray@kavukcuoglu.org>2013-01-03 14:31:00 +0400
commit756083d08ad1bd133f478cf82dfc6ed38801ec55 (patch)
tree9b0591ee04162bae54790e19dc0513d61e5ac7c9 /Tester.lua
parent65f0ea78703778c39dc06e77dfdb3da261cd8aba (diff)
protect tester calls with pcall.
Diffstat (limited to 'Tester.lua')
-rw-r--r--Tester.lua21
1 files changed, 11 insertions, 10 deletions
diff --git a/Tester.lua b/Tester.lua
index 29cc0e2..03b94cc 100644
--- a/Tester.lua
+++ b/Tester.lua
@@ -87,13 +87,14 @@ end
function Tester:pcall(f)
local nerr = #self.errors
- local res = f()
--- local stat, result = pcall(f)
--- if not stat then
--- result = result .. debug.traceback()
--- end
--- return stat, result, stat and (nerr == #self.errors)
- return true, res, nerr == #self.errors
+ -- local res = f()
+ local stat, result = pcall(f)
+ if not stat then
+ result = result .. debug.traceback()
+ self.errors[#self.errors+1] = self.curtestname .. '\n Function call failed \n' .. result .. '\n'
+ end
+ return stat, result, stat and (nerr == #self.errors)
+ -- return true, res, nerr == #self.errors
end
function Tester:report(tests)
@@ -156,9 +157,9 @@ function Tester:run(run_tests)
end
if not stat then
- print()
- print('Function call failed: Test No ' .. i .. ' ' .. testnames[i])
- print(message)
+ -- print()
+ -- print('Function call failed: Test No ' .. i .. ' ' .. testnames[i])
+ -- print(message)
end
collectgarbage()
end