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 C8EC628024 for ; Tue, 14 Aug 2018 03:50:44 -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 k_ELlp9g7xfV for ; Tue, 14 Aug 2018 03:50:44 -0400 (EDT) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 7581D28013 for ; Tue, 14 Aug 2018 03:50:44 -0400 (EDT) Received: by mail-lf1-f45.google.com with SMTP id f135-v6so13087077lfg.10 for ; Tue, 14 Aug 2018 00:50:44 -0700 (PDT) From: Olga Arkhangelskaia Subject: [tarantool-patches] [PATCH v2] test: add test to check log_nonblock mode Date: Tue, 14 Aug 2018 10:49:54 +0300 Message-Id: <20180814074954.77928-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 lead to tarantool hanging forever. This tests checks such possibility. gh-3615 loss of nonblock flag in logger --- https://github.com/tarantool/tarantool/issues/3615 https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-test-for-hanging-1.10 v1: https://www.freelists.org/post/tarantool-patches/PATCH-boxtap-add-test-to-check-log-nonblock-mode Changes in v2: - now we fill socket with 1M of data test/box-tap/cfg.test.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua index 45b645630..d31936d9a 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,28 @@ os.exit(res) ]] test:is(run_script(code), 0, "remote syslog log configuration") +-- +-- gh-3615: check that log_nonblock is not lost +-- +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) +box.cfg{log = opt, log_nonblock=true} +-- Try to fill buffer +for i = 1, 1000 do log.info(string.rep('x', 1000)) end + +unix_socket:close() +os.remove(path) +os.exit(0) +]] +test:is(run_script(code), 0, "log_nonblock") + test:check() os.exit(0) -- 2.14.3 (Apple Git-98)