Skip to content

Commit 63e9f00

Browse files
committed
test: fix errno check in the breakconnect test
The errno value was hardcoded into the test, but it is different for Linux and Mac OS. Linux: ``` $ cc --std=c89 -Wall -Wextra -x c <(echo -e '#include <stdio.h>\n#include<errno.h>\n#include <string.h>\n\nint main() { int x = EINPROGRESS; printf("errno: %d; msg: %s\\n", x, strerror(x)); return 0; }') && ./a.out; rm a.out errno: 115; msg: Operation now in progress ``` Mac OS: ``` $ cc --std=c89 -Wall -Wextra -x c <(echo -e '#include <stdio.h>\n#include<errno.h>\n#include <string.h>\n\nint main() { int x = EINPROGRESS; printf("errno: %d; msg: %s\\n", x, strerror(x)); return 0; }') && ./a.out; rm a.out errno: 36; msg: Operation now in progress ``` As result the test fails on Mac OS on recent tarantool version (where the new libcurl is bundled). This commit eliminates the check for particular errno value. Follows up #70 (PR #71) Fixes #74
1 parent 0a87f3e commit 63e9f00

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/smtp.test.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,11 @@ test:test("smtp.client", function(test)
270270
'mail.body')
271271
local expected_reason = 'response reading failed'
272272
if is_curl_version_ge(7, 86, 0) == true then
273-
expected_reason = 'response reading failed (errno: 115)'
273+
expected_reason = 'response reading failed (errno: <errno>)'
274274
end
275-
test:is(r.reason, expected_reason, 'unexpected response code')
275+
local reason = r.reason:gsub('errno: [0-9]+', 'errno: <errno>')
276+
test:is(reason, expected_reason, 'unexpected response code',
277+
{original_reason = r.reason})
276278
test:is(r.status, -1, 'expected code')
277279

278280
r = client:request(addr, '[email protected]',
@@ -298,9 +300,11 @@ test:test("smtp.client", function(test)
298300
'mail.body')
299301
local expected_reason = 'response reading failed'
300302
if is_curl_version_ge(7, 86, 0) == true then
301-
expected_reason = 'response reading failed (errno: 115)'
303+
expected_reason = 'response reading failed (errno: <errno>)'
302304
end
303-
test:is(r.reason, expected_reason, 'unexpected response code')
305+
local reason = r.reason:gsub('errno: [0-9]+', 'errno: <errno>')
306+
test:is(reason, expected_reason, 'unexpected response code',
307+
{original_reason = r.reason})
304308
test:is(r.status, -1, 'expected code')
305309

306310
end)

0 commit comments

Comments
 (0)