* [PATCH 1/2] trace-cruncher: Add error handling to PyTep_short_kprobe_print()
@ 2022-02-23 13:10 Yordan Karadzhov (VMware)
2022-02-23 13:10 ` [PATCH 2/2] trace-cruncher: Moving tests outside of tracecruncher/ Yordan Karadzhov (VMware)
0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-02-23 13:10 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware)
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) <y.karadz@gmail.com>
---
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)
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] trace-cruncher: Moving tests outside of tracecruncher/
2022-02-23 13:10 [PATCH 1/2] trace-cruncher: Add error handling to PyTep_short_kprobe_print() Yordan Karadzhov (VMware)
@ 2022-02-23 13:10 ` Yordan Karadzhov (VMware)
0 siblings, 0 replies; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2022-02-23 13:10 UTC (permalink / raw)
To: linux-trace-devel; +Cc: Yordan Karadzhov (VMware)
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) <y.karadz@gmail.com>
---
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
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-23 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 13:10 [PATCH 1/2] trace-cruncher: Add error handling to PyTep_short_kprobe_print() Yordan Karadzhov (VMware)
2022-02-23 13:10 ` [PATCH 2/2] trace-cruncher: Moving tests outside of tracecruncher/ Yordan Karadzhov (VMware)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).