From patchwork Wed Feb 23 13:10:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12756904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 369B7C433EF for ; Wed, 23 Feb 2022 13:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232744AbiBWNLH (ORCPT ); Wed, 23 Feb 2022 08:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiBWNLG (ORCPT ); Wed, 23 Feb 2022 08:11:06 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32D197B96 for ; Wed, 23 Feb 2022 05:10:37 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id s24so37651253edr.5 for ; Wed, 23 Feb 2022 05:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NWbTsutxTV7KrJxLrOztaMFzJkz+48L3U6gjrc1pKjA=; b=APJ02cNy0sjbWEF4nEhtOa+MjetyivKYhItWETxdyThbFjb6PqrkNKbHSkz87yJ1pi HvY+cTDoKZDrZM8qEkEn5/QwgFdEw506V7fjL874JaAf7AQyspRUUXYfuPQSGv94d2o9 SVI/0VPHRypT9nb+ybum0PUSjrUvoHVW2uitBlgSDT62yEAg9z8zatg/l0uwY4aTdW6f HRAlc7KsPFxLk/hod7HyPxe58i3AOPuVjlqYNk+KGJvr6ps/CzOuz49qGhKOemFwc7UJ n+kL3a2XjkiG0kt4CBQVD+1gMALeSs64EkKk+uKErTw8+PYhzyxnJE0gjpitDioPsKnM id1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NWbTsutxTV7KrJxLrOztaMFzJkz+48L3U6gjrc1pKjA=; b=UerwVtBmz44bElKIsGVu1tLo8jEoJY+Aq6nyQurzr82K89A4efoDAtbjKR9a6OEedy 7fsXqeUCkRJXbUjltbgPr/5QR9V3v5AbAC701mVz9ppn8722bDSa7Ypx9cthQLJppkg/ Eaf2Pwkc+Aclw7k7KwHtsiGeUBubIOr3Iix9nkcY2NOhtTgL1zVnAAUw0rQe5aQ8KoYK S8y88p4jSgGFWN0AIv6VaKsWX+EGwkMKIkR66r15VjIPrVoEh5amn8luPBRh8YYzKIw0 L581l0NxHRdv7WS8KBmE/obAQzn1spvMpq6K5Dly0d9HgWEBffII0eFXbKBHXaUZYtrj Ysmg== X-Gm-Message-State: AOAM530AAFgpKI5iCJ1FT+keR5vvecCdc96eOzzZ6yGRAbaOahO/MsS8 5xxzVMVLa+WCc/JasbLPE+q3wRVCbME= X-Google-Smtp-Source: ABdhPJxm2iHeZgaZ5hAQvXvBgstQCj8ltT9aSNauNQO7uvXfydTwdkOhaXLZE3fLKVcHFfOKCvgA8Q== X-Received: by 2002:aa7:d403:0:b0:40f:739c:cbae with SMTP id z3-20020aa7d403000000b0040f739ccbaemr31912092edq.267.1645621836157; Wed, 23 Feb 2022 05:10:36 -0800 (PST) Received: from crow.. ([95.87.219.163]) by smtp.gmail.com with ESMTPSA id qo12sm7420402ejb.79.2022.02.23.05.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:10:35 -0800 (PST) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 1/2] trace-cruncher: Add error handling to PyTep_short_kprobe_print() Date: Wed, 23 Feb 2022 15:10:23 +0200 Message-Id: <20220223131024.62332-1-y.karadz@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org The return value of the libtracefs API used internally has to be checked and an error message printed in a case of an error. Signed-off-by: Yordan Karadzhov (VMware) --- src/ftracepy-utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index 85f5bbc..e8411ae 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -632,8 +632,13 @@ PyObject *PyTep_short_kprobe_print(PyTep *self, PyObject *args, ret = tep_register_event_handler(self->ptrObj, id, system, event, kprobe_info_short, NULL); + if (ret < 0) { + TfsError_fmt(NULL, "Failed to register handler for event %s/%s (%i).", + system, event, id); + return NULL; + } - return PyLong_FromLong(ret); + Py_RETURN_NONE; } static bool check_file(struct tracefs_instance *instance, const char *file) From patchwork Wed Feb 23 13:10:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12756905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66297C433EF for ; Wed, 23 Feb 2022 13:10:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbiBWNLJ (ORCPT ); Wed, 23 Feb 2022 08:11:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiBWNLI (ORCPT ); Wed, 23 Feb 2022 08:11:08 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD35B985B2 for ; Wed, 23 Feb 2022 05:10:38 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id g20so2236040edw.6 for ; Wed, 23 Feb 2022 05:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WtagkF8zj8/n87pPUfLdAIWdCWMOC7pJgW9DIbBOjqI=; b=ZL6sWEr8ZtXcbRcBKe5yUBG8BvoLzT/nhtUsbZCQkkxbw/gofhYDGoSzs/MNzKhOe1 qgiiolkUwFlFMiJvcSR6J0w6eHiXkXUGdkxhy//kmavPIVNPTKBpvZE32ww7Zs3CamuY xnjt+t2NsF5PggE7yghJcPqEJbB2LAvDPBjiRbey4wwFRYkT1ZqvRcDDZtLIWZIZrx+/ SFJCKKVTOAJmsfbcng0yB1wD6+9giklXMFXsX3nnVmcpCj+sc0lY/zI36CDJuGOhIYrG QeaEKvAJWNCFceYJwSfQ+yDjkqhY3GFXYh4qOxG0TZHQfNQJxE1qaMni5I6Psyj3utLs vryQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WtagkF8zj8/n87pPUfLdAIWdCWMOC7pJgW9DIbBOjqI=; b=lxgwSPIrGAOHCHnr65/2awLeasOSM1yY6SSkgdGlUxuzgfB/nE0Udg08kHVeuvz0w3 +0Zz3L4Bns0n29wwEKy30E38nhVb6w4KF7hL7Zw5F9o6n/k3accVcYdBK8qXKmfbJQvh XW/q5pUEPB7ksiXBcwJyxntUq/e6+4XdG5aK2+P5LWCm2OPSXe+NcrdncnA5dgtA9YoH yvnMJs6xCAYO3WULwdZ2enLISUEMbzXBbC9I0xbhhAz5C1KE5Hw/meJzb2vGE+F2+XX2 ruYvbDn4EXThnKIFd8iw9USE7nPJF+9K6eNj8LnWgoYQ+9nfyTlplVK8VbuqXAwYxBgC Ucig== X-Gm-Message-State: AOAM532VtzEySQfQvo7g+n/caarr1HDIWTXB93lVT+Y3YkhxxqcTx0SK ouFkTKbelu+J9UyTmNvx9YsmqTPnKsA= X-Google-Smtp-Source: ABdhPJyzNOqDeX/hw4QPg2Krq390kt0F4KfTchLMueAkGokQsgjsoACjPFaCfR46eMlAKigYMYH62Q== X-Received: by 2002:a05:6402:128d:b0:410:f204:6ec2 with SMTP id w13-20020a056402128d00b00410f2046ec2mr31729803edv.104.1645621837044; Wed, 23 Feb 2022 05:10:37 -0800 (PST) Received: from crow.. ([95.87.219.163]) by smtp.gmail.com with ESMTPSA id qo12sm7420402ejb.79.2022.02.23.05.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:10:36 -0800 (PST) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 2/2] trace-cruncher: Moving tests outside of tracecruncher/ Date: Wed, 23 Feb 2022 15:10:24 +0200 Message-Id: <20220223131024.62332-2-y.karadz@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220223131024.62332-1-y.karadz@gmail.com> References: <20220223131024.62332-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org This patch is a partial revert of commit: 086f784 (Moving tests under tracecruncher/) The problem that the reverted commit tries to address is that tests have been installed in the top level of the python version namespace which is not where it's expected. Here we solve this problem by making sure the tests are not installed at all. This is done by moving the 'tests' directory back to the trunk of the repository and in the same time removing the unnecessary '__init__.py' file from the top-level directory of the tests (./tests/__init__.py). Note that we keep '__init__.py' files in the sub-directories of 'tests'. Signed-off-by: Yordan Karadzhov (VMware) --- CONTRIBUTING.md | 2 +- {tracecruncher/tests => tests}/0_get_data/__init__.py | 0 {tracecruncher/tests => tests}/0_get_data/test_get_data.py | 0 {tracecruncher/tests => tests}/1_unit/__init__.py | 0 {tracecruncher/tests => tests}/1_unit/test_01_ftracepy_unit.py | 0 .../tests => tests}/1_unit/test_02_datawrapper_unit.py | 0 {tracecruncher/tests => tests}/1_unit/test_03_ksharkpy_unit.py | 0 {tracecruncher/tests => tests}/2_integration/__init__.py | 0 .../2_integration/test_01_ftracepy_integration.py | 0 .../2_integration/test_03_ksharkpy_integration.py | 0 tracecruncher/tests/__init__.py | 0 11 files changed, 1 insertion(+), 1 deletion(-) rename {tracecruncher/tests => tests}/0_get_data/__init__.py (100%) rename {tracecruncher/tests => tests}/0_get_data/test_get_data.py (100%) rename {tracecruncher/tests => tests}/1_unit/__init__.py (100%) rename {tracecruncher/tests => tests}/1_unit/test_01_ftracepy_unit.py (100%) rename {tracecruncher/tests => tests}/1_unit/test_02_datawrapper_unit.py (100%) rename {tracecruncher/tests => tests}/1_unit/test_03_ksharkpy_unit.py (100%) rename {tracecruncher/tests => tests}/2_integration/__init__.py (100%) rename {tracecruncher/tests => tests}/2_integration/test_01_ftracepy_integration.py (100%) rename {tracecruncher/tests => tests}/2_integration/test_03_ksharkpy_integration.py (100%) delete mode 100644 tracecruncher/tests/__init__.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0eb9f85..865fcc8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ as described by the Linux kernel. Make sure that all your changes are covered by the tests. Before submitting your patch, check if everything works at 100% by running the tests in **tracecruncher/tests**. Compile your changes and install trace-cruncher (`sudo make install`), to make sure that your code is used in the tests. As trace-cruncher interacts with the Linux kernel tracing infrastructure, the tests must be run with root privileges: ``` shell -cd tracecruncher/tests +cd tests sudo python3 -m unittest discover . ``` diff --git a/tracecruncher/tests/0_get_data/__init__.py b/tests/0_get_data/__init__.py similarity index 100% rename from tracecruncher/tests/0_get_data/__init__.py rename to tests/0_get_data/__init__.py diff --git a/tracecruncher/tests/0_get_data/test_get_data.py b/tests/0_get_data/test_get_data.py similarity index 100% rename from tracecruncher/tests/0_get_data/test_get_data.py rename to tests/0_get_data/test_get_data.py diff --git a/tracecruncher/tests/1_unit/__init__.py b/tests/1_unit/__init__.py similarity index 100% rename from tracecruncher/tests/1_unit/__init__.py rename to tests/1_unit/__init__.py diff --git a/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py b/tests/1_unit/test_01_ftracepy_unit.py similarity index 100% rename from tracecruncher/tests/1_unit/test_01_ftracepy_unit.py rename to tests/1_unit/test_01_ftracepy_unit.py diff --git a/tracecruncher/tests/1_unit/test_02_datawrapper_unit.py b/tests/1_unit/test_02_datawrapper_unit.py similarity index 100% rename from tracecruncher/tests/1_unit/test_02_datawrapper_unit.py rename to tests/1_unit/test_02_datawrapper_unit.py diff --git a/tracecruncher/tests/1_unit/test_03_ksharkpy_unit.py b/tests/1_unit/test_03_ksharkpy_unit.py similarity index 100% rename from tracecruncher/tests/1_unit/test_03_ksharkpy_unit.py rename to tests/1_unit/test_03_ksharkpy_unit.py diff --git a/tracecruncher/tests/2_integration/__init__.py b/tests/2_integration/__init__.py similarity index 100% rename from tracecruncher/tests/2_integration/__init__.py rename to tests/2_integration/__init__.py diff --git a/tracecruncher/tests/2_integration/test_01_ftracepy_integration.py b/tests/2_integration/test_01_ftracepy_integration.py similarity index 100% rename from tracecruncher/tests/2_integration/test_01_ftracepy_integration.py rename to tests/2_integration/test_01_ftracepy_integration.py diff --git a/tracecruncher/tests/2_integration/test_03_ksharkpy_integration.py b/tests/2_integration/test_03_ksharkpy_integration.py similarity index 100% rename from tracecruncher/tests/2_integration/test_03_ksharkpy_integration.py rename to tests/2_integration/test_03_ksharkpy_integration.py diff --git a/tracecruncher/tests/__init__.py b/tracecruncher/tests/__init__.py deleted file mode 100644 index e69de29..0000000