From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 1ABDCEBF9F5; Tue, 4 Feb 2025 13:09:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1ABDCEBF9F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1738663760; bh=aw6PY2jxDIE5DFPD+d3JOm2PT57cVaD9hqLhmr/tK5E=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ZXkSO1E4JN+zto4Yo7Pwxl4GIWsK0ZrzA7Z8nwkpt52otBnsirZnKAAMAZWb/nEpm HnoEx0UJFv9m23AAxN/yfH53zutPJjRa3TzA9AtjZc+iFf4XrwGUjavAqE6VXQDPUN kyGpc0WpLeMeNh3G3e5P3oIMAQSQCCKam0uXySGE= Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 94177EBF9E7 for ; Tue, 4 Feb 2025 13:08:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 94177EBF9E7 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-ab7515df1faso51629266b.2 for ; Tue, 04 Feb 2025 02:08:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738663686; x=1739268486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=buZJd0jA4C/EIVKU509Rm1AqnfGte88ZNcBlXeHroKs=; b=u85xluWPMhXyjWz1AYNKEDLsSg1qpADBu3EK+RcPrtCekxXTz9M+fna99TB1yVyVkc qZDAuznKFkmhQ7qNCOBHERz5VfVKpHIyUFF/fVgc5fC/C268P+cAayk8ESuMCcviNCta ip7D3x26ikf7Ksx5RTxYegsjx1mRWMT8raypSIjEIst/D1AriP/5SZg/6v1ctSHewGIz Mo0yMcBodLyBgmM1LvXlzNIHbM2ruZughDEr1RwZeNWEu7SBu433jctV6jtSBIqMUGVL hgwAefXkQ2760U9KD5ImBry3ExaDn8LV6Mhq8IAoYvbjtPF4AItTbEDQ42qBLOE9k2fe 4BvA== X-Gm-Message-State: AOJu0YzSZi7DumK9VgWyeYC8t2D/B3cY0Oo1stJDRM6ML1l52S+ZfeRt Rj9hDr8y6ykEfp7PtlaTt+DHJrU7Ckcza3G9SNNwIMzxO+QEzKBENIbAkCwP X-Gm-Gg: ASbGnculSZl0tLIafpdKioCkSFxqfT6C42+mjDoogVP1xWThWS6kpSzKudkYaw1R/YL LbYxXZTdmyNzHHXUmIx2H2b2+0HVqW5Kv1z7/WqZj4a30FSQmPu2cvYb07eCmtkgeRibp8qD/PH VPexHp0tAUBkeP2h8V43f0f2Woe85/tmn2hmP9cCVzcXAwyGwZRRkzIIWNMiqGAnXvXADskrdae HmGOG+25eZ1hbhKzw3vWEOA6EnvwmfOf8xOy1LfrsdLql75MokkO9w+ss+3Lr/VFOy/VBF5Emes 5IPgkA== X-Google-Smtp-Source: AGHT+IHcxOXkDYkDvWEF+ZrDpeRbJlXw29WD7O4hvT3WHF74xe5UPAx25+cIOMioVaT0lx3dWWjCgA== X-Received: by 2002:a17:907:3fa3:b0:aa6:4a5b:b729 with SMTP id a640c23a62f3a-ab6cfd10b54mr2283698966b.33.1738663685440; Tue, 04 Feb 2025 02:08:05 -0800 (PST) Received: from localhost ([5.181.62.98]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e49ff719sm894097666b.114.2025.02.04.02.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 02:08:05 -0800 (PST) X-Google-Original-From: Sergey Bronnikov To: tarantool-patches@dev.tarantool.org, Sergey Kaplun Date: Tue, 4 Feb 2025 13:03:40 +0300 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 4/4] sysprof: fix a message with stop without run X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The function `misc.sysprof.stop()` reports that profiler is already running: | $ ./build/src/luajit -e 'print(misc.sysprof.stop())' | nil profiler is running already 22 The patch fixes that. --- src/lj_sysprof.c | 2 +- test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c index 88c7a41b..b76f503c 100644 --- a/src/lj_sysprof.c +++ b/src/lj_sysprof.c @@ -493,7 +493,7 @@ int lj_sysprof_stop(lua_State *L) global_State *g = sp->g; struct lj_wbuf *out = &sp->out; - if (SPS_IDLE == sp->state) + if (SPS_PROFILE != sp->state) return PROFILE_ERRRUN; else if (G(L) != g) return PROFILE_ERRUSE; diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua index 68a4b72f..91f9ca5c 100644 --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua @@ -10,7 +10,7 @@ local test = tap.test("misc-sysprof-lapi"):skipcond({ ["Disabled due to #10803"] = os.getenv("LUAJIT_TEST_USE_VALGRIND"), }) -test:plan(33) +test:plan(34) jit.off() -- XXX: Run JIT tuning functions in a safe frame to avoid errors @@ -98,7 +98,8 @@ assert(res, err) -- Not running. res, err, errno = misc.sysprof.stop() -test:ok(res == nil and err, "res and error with not running") +test:is(res, nil, "res with not running") +test:ok(err:match("profiler is running already"), "error with not running") test:ok(type(errno) == "number", "errno with not running") -- Bad path. -- 2.34.1