From e16832fb73a231ced2647d8ac24b8753773fc16e Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Thu, 20 Aug 2020 11:36:09 -0700 Subject: [PATCH 1/6] Run all tests with debug symbols. --- src/CMakeLists.txt | 5 +++++ tests/run | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5de3e534..e3e0b310 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 $ -mg ${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/run b/tests/run index 58e5c194..7d6640d3 100755 --- a/tests/run +++ b/tests/run @@ -32,10 +32,15 @@ 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 - local result = os.execute(execstring) - if type(result) == "number" and result == 0 or result == true then + local pass = true + for test_debug = 0, 0 do + debug_flag = test_debug == 1 and "-mg" or "" + print(debug_flag .. file .. ":") + local execstring = getcommand(file) .. " " .. file + local result = os.execute(execstring) + pass = pass and (type(result) == "number" and result == 0 or result == true) + end + if pass then table.insert(passed,file) else --error("fail") From 69fca75161c793b0ea310f761be7f8923d91ee3f Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 21 Aug 2020 10:05:29 -0700 Subject: [PATCH 2/6] Revert test/run. --- tests/run | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/run b/tests/run index 7d6640d3..58e5c194 100755 --- a/tests/run +++ b/tests/run @@ -32,15 +32,10 @@ for line in io.popen(lscmd):lines() do end local file = line:match("^([^/]*%.t)$") or line:match("^(fails/[^/]*%.t)$") if file then - local pass = true - for test_debug = 0, 0 do - debug_flag = test_debug == 1 and "-mg" or "" - print(debug_flag .. file .. ":") - local execstring = getcommand(file) .. " " .. file - local result = os.execute(execstring) - pass = pass and (type(result) == "number" and result == 0 or result == true) - end - if pass then + print(file .. ":") + local execstring = getcommand(file) .. " " .. file + local result = os.execute(execstring) + if type(result) == "number" and result == 0 or result == true then table.insert(passed,file) else --error("fail") From 6a893188d658deb3d6e31a9a78f8f082acdb9c53 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 21 Aug 2020 10:35:24 -0700 Subject: [PATCH 3/6] Run debug tests on all platforms. --- Makefile | 2 +- appveyor.yml | 2 ++ src/CMakeLists.txt | 2 +- tests/run | 13 +++++++++---- travis.sh | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) 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 e3e0b310..dcb00721 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -388,7 +388,7 @@ foreach(TERRA_TEST ${TERRA_TESTS}) ) # again, with debug symbols add_test(NAME "${TERRA_TEST}-debug" - COMMAND $ -mg ${TERRA_TEST} + COMMAND $ -g ${TERRA_TEST} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests ) endforeach() 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/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 From 3a2b8d45c4881db53e63658c124fd6886e5e6de5 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 21 Aug 2020 10:41:06 -0700 Subject: [PATCH 4/6] Update .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 51ae6a3a..dd886a1d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ *.so *~ +\#*# From 03246974fc06c7b5f51c07f840fccb28c94bccf3 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Fri, 21 Aug 2020 14:12:28 -0700 Subject: [PATCH 5/6] Avoid clobbering concurrent test. --- tests/dynlib.t | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 From 32632252b61d802e5b3a42254285d5dcd1e67df8 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Mon, 24 Aug 2020 11:41:03 -0700 Subject: [PATCH 6/6] Avoid clobbering sharedlib.t in concurrent execution. --- tests/sharedlib.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 = {}