From 12b062b2c862fd436cff0df4ebb2e5ca22e75e19 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 5 Mar 2017 04:02:45 +0300 Subject: unittests: Run all unit tests in their own processes Used sed -r -i -e '/ helpers =/ s/$/\nlocal itp = helpers.gen_itp(it)/; s/^(\s*)it\(/\1itp(/' test/unit/**/*_spec.lua to alter all tests. Locally they all run fine now. Reasoning: 1. General: state from one test should not affect other tests. 2. Local: travis build is failing with something which may be an output of garbage collector. This should prevent state of the garbage collector from interferring as well. --- test/unit/mbyte_spec.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/unit/mbyte_spec.lua') diff --git a/test/unit/mbyte_spec.lua b/test/unit/mbyte_spec.lua index 9b2415a93f..a772a5d5e5 100644 --- a/test/unit/mbyte_spec.lua +++ b/test/unit/mbyte_spec.lua @@ -1,4 +1,5 @@ local helpers = require("test.unit.helpers") +local itp = helpers.gen_itp(it) local ffi = helpers.ffi local eq = helpers.eq @@ -26,7 +27,7 @@ describe('mbyte', function() before_each(function() end) - it('utf_ptr2char', function() + itp('utf_ptr2char', function() -- For strings with length 1 the first byte is returned. for c = 0, 255 do eq(c, mbyte.utf_ptr2char(to_string({c, 0}))) @@ -44,7 +45,7 @@ describe('mbyte', function() describe('utfc_ptr2char_len', function() - it('1-byte sequences', function() + itp('1-byte sequences', function() local pcc = to_intp() for c = 0, 255 do eq(c, mbyte.utfc_ptr2char_len(to_string({c}), pcc, 1)) @@ -52,7 +53,7 @@ describe('mbyte', function() end end) - it('2-byte sequences', function() + itp('2-byte sequences', function() local pcc = to_intp() -- No combining characters eq(0x007f, mbyte.utfc_ptr2char_len(to_string({0x7f, 0x7f}), pcc, 2)) @@ -76,7 +77,7 @@ describe('mbyte', function() eq(0, pcc[0]) end) - it('3-byte sequences', function() + itp('3-byte sequences', function() local pcc = to_intp() -- No second UTF-8 character @@ -108,7 +109,7 @@ describe('mbyte', function() eq(0, pcc[0]) end) - it('4-byte sequences', function() + itp('4-byte sequences', function() local pcc = to_intp() -- No following combining character @@ -145,7 +146,7 @@ describe('mbyte', function() eq(0, pcc[0]) end) - it('5+-byte sequences', function() + itp('5+-byte sequences', function() local pcc = to_intp() -- No following combining character -- cgit From 9400466282918396c814ef456d0f65dca51b8889 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 11 Mar 2017 13:28:18 +0300 Subject: unittests: Check core dumps in after_each, like in functests --- test/unit/mbyte_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/mbyte_spec.lua') diff --git a/test/unit/mbyte_spec.lua b/test/unit/mbyte_spec.lua index a772a5d5e5..6feef4e601 100644 --- a/test/unit/mbyte_spec.lua +++ b/test/unit/mbyte_spec.lua @@ -1,4 +1,4 @@ -local helpers = require("test.unit.helpers") +local helpers = require("test.unit.helpers")(after_each) local itp = helpers.gen_itp(it) local ffi = helpers.ffi -- cgit