diff --git a/.gitignore b/.gitignore index 51ae6a3a..dd886a1d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ *.so *~ +\#*# diff --git a/Makefile b/Makefile index f7f2fb83..00a6a417 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ BIN2C = build/bin2c all: $(EXECUTABLE) $(DYNLIBRARY) test: all - (cd tests; ./run) + (cd tests; ./run && ./run -g) variants: $(LIBRARY_VARIANTS) diff --git a/appveyor.yml b/appveyor.yml index 8719e466..4422efe6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5de3e534..dcb00721 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -386,6 +386,11 @@ foreach(TERRA_TEST ${TERRA_TESTS}) COMMAND $ ${TERRA_TEST} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests ) + # again, with debug symbols + add_test(NAME "${TERRA_TEST}-debug" + COMMAND $ -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) diff --git a/tests/dynlib.t b/tests/dynlib.t index 3b106ebf..ae8b078b 100644 --- a/tests/dynlib.t +++ b/tests/dynlib.t @@ -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" @@ -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 diff --git a/tests/run b/tests/run index 58e5c194..82747183 100755 --- a/tests/run +++ b/tests/run @@ -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" @@ -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 diff --git a/tests/sharedlib.t b/tests/sharedlib.t index 64a7afe9..9878f4ce 100644 --- a/tests/sharedlib.t +++ b/tests/sharedlib.t @@ -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 = {} diff --git a/travis.sh b/travis.sh index 79655175..5690e19a 100755 --- a/travis.sh +++ b/travis.sh @@ -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