Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test debug symbols #457

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
*.so

*~
\#*#
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ BIN2C = build/bin2c
all: $(EXECUTABLE) $(DYNLIBRARY)

test: all
(cd tests; ./run)
(cd tests; ./run && ./run -g)

variants: $(LIBRARY_VARIANTS)

Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ build_script:
test_script:
- cd tests
- if /I "%USE_CMAKE%" EQU "1" (..\install\bin\terra run)
- if /I "%USE_CMAKE%" EQU "1" (..\install\bin\terra run -g)
- if /I "%USE_CMAKE%" NEQ "1" (..\release\bin\terra run)
- if /I "%USE_CMAKE%" NEQ "1" (..\release\bin\terra run -g)
- cd ..

artifacts:
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ foreach(TERRA_TEST ${TERRA_TESTS})
COMMAND $<TARGET_FILE:TerraExecutable> ${TERRA_TEST}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
)
# again, with debug symbols
add_test(NAME "${TERRA_TEST}-debug"
COMMAND $<TARGET_FILE:TerraExecutable> -g ${TERRA_TEST}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
)
endforeach()
foreach(TERRA_TEST ${TERRA_TESTS_INSTALL})
get_filename_component(TERRA_TEST_DIR ${TERRA_TEST} DIRECTORY)
Expand Down
14 changes: 10 additions & 4 deletions tests/dynlib.t
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ local function exists(path)
return result
end

-- We can run this test concurrently, make sure we don't clobber the other test.
local suffix = ""
if 0 ~= terralib.isdebug then
suffix = "-debug"
end

if ffi.os ~= "Windows" then
print(libpath)
local libext = ".so"
Expand All @@ -53,14 +59,14 @@ if ffi.os ~= "Windows" then
flags:insertall {"-pagezero_size","10000", "-image_base", "100000000"}
end

terralib.saveobj("dynlib",{main = main},flags)
terralib.saveobj("dynlib" .. suffix,{main = main},flags)

assert(0 == os.execute("./dynlib"))
assert(0 == os.execute("./dynlib" .. suffix))

else
local putenv = terralib.externfunction("_putenv", rawstring -> int)
local flags = {libpath.."\\terra.lib",libpath.."\\lua51.lib"}
terralib.saveobj("dynlib.exe",{main = main},flags)
terralib.saveobj("dynlib" .. suffix .. ".exe",{main = main},flags)
putenv("Path="..os.getenv("Path")..";"..terralib.terrahome.."\\bin") --make dll search happy
assert(0 == os.execute(".\\dynlib.exe"))
assert(0 == os.execute(".\\dynlib" .. suffix .. ".exe"))
end
13 changes: 9 additions & 4 deletions tests/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!../terra
local ffi = require("ffi")

local test_args = ""
for _, a in ipairs(arg) do
test_args = test_args .. a .. " "
end

local lscmd
if ffi.os == "Windows" then
lscmd = "cmd /c dir /b /s"
Expand Down Expand Up @@ -32,14 +37,14 @@ for line in io.popen(lscmd):lines() do
end
local file = line:match("^([^/]*%.t)$") or line:match("^(fails/[^/]*%.t)$")
if file then
print(file .. ":")
local execstring = getcommand(file) .. " " .. file
print(test_args .. file .. ":")
local execstring = getcommand(file) .. " " .. test_args .. file
local result = os.execute(execstring)
if type(result) == "number" and result == 0 or result == true then
table.insert(passed,file)
table.insert(passed,test_args .. file)
else
--error("fail")
table.insert(failed,file)
table.insert(failed,test_args .. file)
end
end
end
Expand Down
8 changes: 7 additions & 1 deletion tests/sharedlib.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ end

local ffi = require 'ffi'

local name = (ffi.os == "Windows" and "foo.dll" or "foo.so")
-- We can run this test concurrently, make sure we don't clobber the other test.
local suffix = ""
if 0 ~= terralib.isdebug then
suffix = "-debug"
end

local name = (ffi.os == "Windows" and "foo" .. suffix .. ".dll" or "foo" .. suffix .. ".so")

local args = {}

Expand Down
1 change: 1 addition & 0 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ if [[ $USE_CMAKE -eq 1 ]]; then
if [[ $(uname) != Darwin ]]; then
pushd tests
../install/bin/terra ./run
../install/bin/terra ./run -g
popd
fi

Expand Down