From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A1C0F45C304 for ; Tue, 1 Dec 2020 00:46:33 +0300 (MSK) Date: Tue, 1 Dec 2020 00:46:33 +0300 From: Alexander Turenko Message-ID: <20201130214633.a4okm6brex6ilzpb@tkn_work_nb> References: <20201031162911.61876-1-sergos@tarantool.org> <12e5f150-8e08-1004-ad8a-c6bd1a04fd5f@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <12e5f150-8e08-1004-ad8a-c6bd1a04fd5f@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2] core: handle fiber cancellation for fiber.cond List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org > > diff --git a/test/app-tap/gh-5013-fiber-cancel.test.lua b/test/app-tap/gh-5013-fiber-cancel.test.lua > > new file mode 100755 > > index 000000000..ca4ca2c90 > > --- /dev/null > > +++ b/test/app-tap/gh-5013-fiber-cancel.test.lua > > @@ -0,0 +1,23 @@ > > +#!/usr/bin/env tarantool > > + > > +local tap = require('tap') > > +local fiber = require('fiber') > > +local test = tap.test("gh-5013-fiber-cancel") > > + > > +test:plan(2) > > + > > +local result = {} > > + > > +function test_f() > > + local cond = fiber.cond() > > + local res, err = pcall(cond.wait, cond) > > + result.res = res > > + result.err = err > > +end > > + > > +local f = fiber.create(test_f) > > +f:cancel() > > +fiber.yield() > > + > > +test:ok(result.res == false, 'expected result is false') > > +test:ok(tostring(result.err) == 'fiber is cancelled', 'fiber cancellation should be reported') > > 2. I think you are also supposed to call os.exit with test:check() > like other tap tests do. Otherwise it probably always ends with 0 > code, and won't work properly when we will make tap tests non-diff > based. Just side note. TAP13 tests are already not diff-based. test-run parses and verifies TAP13 output if a result file is not present. test-run also checks the exit code of a process. (That's all are about 'core = app' test suites.) But I anyway think that it is good property to return non-zero exit code from a test if it is not passed. When all tests are written this way, we have more freedom around ways to run a test. Who knows, maybe we'll want to run some tests in a very restricted environment, where it will be hard to get all this python stuff workable?