From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id EEAC928428 for ; Mon, 13 Aug 2018 03:13:16 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id meDVJ9lPvnpm for ; Mon, 13 Aug 2018 03:13:16 -0400 (EDT) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 93BA1283D1 for ; Mon, 13 Aug 2018 03:13:16 -0400 (EDT) Received: by mail-lf1-f46.google.com with SMTP id l16-v6so10479730lfc.13 for ; Mon, 13 Aug 2018 00:13:16 -0700 (PDT) From: Olga Arkhangelskaia Subject: [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode Date: Mon, 13 Aug 2018 10:12:08 +0300 Message-Id: <20180813071208.40972-1-krishtal.olja@gmail.com> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: Olga Arkhangelskaia We should test log_nonblock mode. In some cases the loss of this flag leads to tarantool hanging forever (centos/fedora 26/27). This tests checks such possibility. Closes #3615 --- https://github.com/tarantool/tarantool/issues/3615 https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-test-for-hanging-1.10 test/box-tap/cfg.test.lua | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua index 45b645630..0d2133bee 100755 --- a/test/box-tap/cfg.test.lua +++ b/test/box-tap/cfg.test.lua @@ -6,7 +6,7 @@ local socket = require('socket') local fio = require('fio') local uuid = require('uuid') local msgpack = require('msgpack') -test:plan(95) +test:plan(96) -------------------------------------------------------------------------------- -- Invalid values @@ -530,5 +530,38 @@ os.exit(res) ]] test:is(run_script(code), 0, "remote syslog log configuration") +-- +-- Check nonblock mode +-- +code=[[ +local socket = require('socket') +local log = require('log') +local fio = require('fio') + +path = fio.pathjoin(fio.cwd(), 'log_unix_socket_test.sock') +unix_socket = socket('AF_UNIX', 'SOCK_DGRAM', 0) +unix_socket:bind('unix/', path) + +opt = string.format("syslog:server=unix:%s,identity=tarantool", path) +local res = 1 +local buf = 'Started\n' +box.cfg{log = opt, log_nonblock=true} +-- Try to fill socket buffer +a = 0 +while a < 10 do + a = a + 1 + log.info('Test nonblock') +end +while unix_socket:readable(0.001) do + buf = buf .. unix_socket:recv(1000) + if buf:match('Test nonblock') then res = 0 end +end + +unix_socket:close() +os.remove(path) +os.exit(res) +]] +test:is(run_script(code), 0, "log_nonblock") + test:check() os.exit(0) -- 2.14.3 (Apple Git-98)