Re: [lttng-dev] [trap-probe] Add lttng-probe-trap

2013-03-21 Thread Mathieu Desnoyers
* Francis Deslauriers (fdesl...@gmail.com) wrote:
> This probe monitors trap entry and trap exit trace event.

It looks good to me! However, maybe it would be safer to first get a
feedback on your Linux mainline patch before pulling this one in ?
Otherwise, we could end up with incompatible definitions compared to
mainline Linux.

If this is OK with you, please re-post when the mainline Linux patch
gets accepted.

Thanks,

Mathieu

> 
> Signed-off-by: Francis Deslauriers 
> ---
>  instrumentation/events/lttng-module/trap.h |   46 +++
>  instrumentation/events/mainline/trap.h |   47 
> 
>  probes/Makefile|1 +
>  probes/lttng-probe-trap.c  |   43 +
>  4 files changed, 137 insertions(+)
>  create mode 100644 instrumentation/events/lttng-module/trap.h
>  create mode 100644 instrumentation/events/mainline/trap.h
>  create mode 100644 probes/lttng-probe-trap.c
> 
> diff --git a/instrumentation/events/lttng-module/trap.h 
> b/instrumentation/events/lttng-module/trap.h
> new file mode 100644
> index 000..124bbba
> --- /dev/null
> +++ b/instrumentation/events/lttng-module/trap.h
> @@ -0,0 +1,46 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM trap
> +
> +#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_TRAP_H
> +
> +#include 
> +
> +TRACE_EVENT(trap_entry,
> +
> + TP_PROTO(struct pt_regs *regs, long trap),
> +
> + TP_ARGS(regs, trap),
> +
> + TP_STRUCT__entry(
> + __field(long,   trap)
> + __field(unsigned long,  ip  )
> +
> + ),
> + TP_fast_assign(
> + tp_assign(trap, trap)
> + tp_assign(ip, regs ? instruction_pointer(regs) : 0UL)
> + ),
> +
> + TP_printk("number=%ld ip=%lu", __entry->trap, __entry->ip)
> +)
> +
> +TRACE_EVENT(trap_exit,
> +
> + TP_PROTO(long trap),
> +
> + TP_ARGS(trap),
> +
> + TP_STRUCT__entry(
> + __field(long,   trap)
> + ),
> + TP_fast_assign(
> + tp_assign(trap, trap)
> + ),
> +
> + TP_printk("number=%ld", __entry->trap)
> +)
> +
> +#endif /* _TRACE_TRAP_H */
> +/* This part must be outside protection */
> +#include "../../../probes/define_trace.h"
> diff --git a/instrumentation/events/mainline/trap.h 
> b/instrumentation/events/mainline/trap.h
> new file mode 100644
> index 000..171b9cf
> --- /dev/null
> +++ b/instrumentation/events/mainline/trap.h
> @@ -0,0 +1,47 @@
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM trap
> +
> +#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_TRAP_H
> +
> +#include 
> +
> +TRACE_EVENT(trap_entry,
> +
> + TP_PROTO(struct pt_regs *regs, long trap),
> +
> + TP_ARGS(regs, trap),
> +
> + TP_STRUCT__entry(
> + __field(long,   trap)
> + __field(unsigned long,  ip  )
> + ),
> +
> + TP_fast_assign(
> + __entry->trap   = trap;
> + __entry->ip = regs ? instruction_pointer(regs) : 0UL;
> + ),
> +
> + TP_printk("number=%ld ip=%lu", __entry->trap, __entry->ip)
> +);
> +
> +TRACE_EVENT(trap_exit,
> +
> + TP_PROTO(long trap),
> +
> + TP_ARGS(trap),
> +
> + TP_STRUCT__entry(
> + __field(long,   trap)
> + ),
> +
> + TP_fast_assign(
> + __entry->trap   = trap;
> + ),
> +
> + TP_printk("number=%ld", __entry->trap)
> +);
> +
> +#endif /* _TRACE_TRAP_H */
> +/* This part must be outside protection */
> +#include 
> diff --git a/probes/Makefile b/probes/Makefile
> index 088cd5f..c8d0085 100644
> --- a/probes/Makefile
> +++ b/probes/Makefile
> @@ -15,6 +15,7 @@ obj-m += lttng-probe-timer.o
>  obj-m += lttng-probe-kmem.o
>  obj-m += lttng-probe-module.o
>  obj-m += lttng-probe-power.o
> +obj-m += lttng-probe-trap.o
>  
>  obj-m += lttng-probe-statedump.o
>  
> diff --git a/probes/lttng-probe-trap.c b/probes/lttng-probe-trap.c
> new file mode 100644
> index 000..17c1526
> --- /dev/null
> +++ b/probes/lttng-probe-trap.c
> @@ -0,0 +1,43 @@
> +/*
> + * probes/lttng-probe-trap.c
> + *
> + * LTTng trap probes.
> + *
> + * Copyright (C) 2010-2012 Mathieu Desnoyers 
> + * Copyright (C) 2013 Francis Deslauriers .
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; only
> + * version 2.1 of the License.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Fr

[lttng-dev] [trap-probe] Add lttng-probe-trap

2013-03-21 Thread Francis Deslauriers
This probe monitors trap entry and trap exit trace event.

Signed-off-by: Francis Deslauriers 
---
 instrumentation/events/lttng-module/trap.h |   46 +++
 instrumentation/events/mainline/trap.h |   47 
 probes/Makefile|1 +
 probes/lttng-probe-trap.c  |   43 +
 4 files changed, 137 insertions(+)
 create mode 100644 instrumentation/events/lttng-module/trap.h
 create mode 100644 instrumentation/events/mainline/trap.h
 create mode 100644 probes/lttng-probe-trap.c

diff --git a/instrumentation/events/lttng-module/trap.h 
b/instrumentation/events/lttng-module/trap.h
new file mode 100644
index 000..124bbba
--- /dev/null
+++ b/instrumentation/events/lttng-module/trap.h
@@ -0,0 +1,46 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM trap
+
+#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_TRAP_H
+
+#include 
+
+TRACE_EVENT(trap_entry,
+
+   TP_PROTO(struct pt_regs *regs, long trap),
+
+   TP_ARGS(regs, trap),
+
+   TP_STRUCT__entry(
+   __field(long,   trap)
+   __field(unsigned long,  ip  )
+
+   ),
+   TP_fast_assign(
+   tp_assign(trap, trap)
+   tp_assign(ip, regs ? instruction_pointer(regs) : 0UL)
+   ),
+
+   TP_printk("number=%ld ip=%lu", __entry->trap, __entry->ip)
+)
+
+TRACE_EVENT(trap_exit,
+
+   TP_PROTO(long trap),
+
+   TP_ARGS(trap),
+
+   TP_STRUCT__entry(
+   __field(long,   trap)
+   ),
+   TP_fast_assign(
+   tp_assign(trap, trap)
+   ),
+
+   TP_printk("number=%ld", __entry->trap)
+)
+
+#endif /* _TRACE_TRAP_H */
+/* This part must be outside protection */
+#include "../../../probes/define_trace.h"
diff --git a/instrumentation/events/mainline/trap.h 
b/instrumentation/events/mainline/trap.h
new file mode 100644
index 000..171b9cf
--- /dev/null
+++ b/instrumentation/events/mainline/trap.h
@@ -0,0 +1,47 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM trap
+
+#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_TRAP_H
+
+#include 
+
+TRACE_EVENT(trap_entry,
+
+   TP_PROTO(struct pt_regs *regs, long trap),
+
+   TP_ARGS(regs, trap),
+
+   TP_STRUCT__entry(
+   __field(long,   trap)
+   __field(unsigned long,  ip  )
+   ),
+
+   TP_fast_assign(
+   __entry->trap   = trap;
+   __entry->ip = regs ? instruction_pointer(regs) : 0UL;
+   ),
+
+   TP_printk("number=%ld ip=%lu", __entry->trap, __entry->ip)
+);
+
+TRACE_EVENT(trap_exit,
+
+   TP_PROTO(long trap),
+
+   TP_ARGS(trap),
+
+   TP_STRUCT__entry(
+   __field(long,   trap)
+   ),
+
+   TP_fast_assign(
+   __entry->trap   = trap;
+   ),
+
+   TP_printk("number=%ld", __entry->trap)
+);
+
+#endif /* _TRACE_TRAP_H */
+/* This part must be outside protection */
+#include 
diff --git a/probes/Makefile b/probes/Makefile
index 088cd5f..c8d0085 100644
--- a/probes/Makefile
+++ b/probes/Makefile
@@ -15,6 +15,7 @@ obj-m += lttng-probe-timer.o
 obj-m += lttng-probe-kmem.o
 obj-m += lttng-probe-module.o
 obj-m += lttng-probe-power.o
+obj-m += lttng-probe-trap.o
 
 obj-m += lttng-probe-statedump.o
 
diff --git a/probes/lttng-probe-trap.c b/probes/lttng-probe-trap.c
new file mode 100644
index 000..17c1526
--- /dev/null
+++ b/probes/lttng-probe-trap.c
@@ -0,0 +1,43 @@
+/*
+ * probes/lttng-probe-trap.c
+ *
+ * LTTng trap probes.
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers 
+ * Copyright (C) 2013 Francis Deslauriers .
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+
+/*
+ * Create the tracepoint static inlines from the kernel to validate that our
+ * trace event macros match the kernel we run on.
+ */
+#include 
+#include "../wrapper/tracepoint.h"
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module
+
+#include "../instrumentation/events/lttng-module/trap.h"
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Francis Deslauriers ");

Re: [lttng-dev] [PATCH lttng-tools] Add missing buffers-uid folder in ust regression test Makefile

2013-03-21 Thread Mathieu Desnoyers
changing the subject, CCing to David.

* Jérémie Galarneau (jeremie.galarn...@efficios.com) wrote:
> 
> Signed-off-by: Jérémie Galarneau 
> ---
>  tests/regression/ust/Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/regression/ust/Makefile.am 
> b/tests/regression/ust/Makefile.am
> index d8904bb..c5dee21 100644
> --- a/tests/regression/ust/Makefile.am
> +++ b/tests/regression/ust/Makefile.am
> @@ -1,6 +1,6 @@
>  if HAVE_LIBLTTNG_UST_CTL
>  SUBDIRS = nprocesses high-throughput low-throughput before-after 
> multi-session \
> -   overlap
> +   overlap buffers-uid
>  
>  EXTRA_DIST = runall.sh run-ust-global-tests.sh test_event_basic 
> test_event_wildcard
>  
> -- 
> 1.8.2
> 
> 
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [lttng-tools PATCH] Add a git version information in LTTng versions compiled from git sources

2013-03-21 Thread Raphaël Beamonte
Signed-off-by: Raphaël Beamonte 
---
 .gitignore  |2 ++
 Makefile.am |4 +--
 include/Makefile.am |   45 ++-
 include/version.h.tmpl  |   27 +++
 src/bin/lttng-sessiond/lttng-sessiond.h |   14 ++
 src/bin/lttng-sessiond/main.c   |2 +-
 src/bin/lttng/commands/version.c|4 ++-
 src/bin/lttng/lttng.c   |5 +++-
 src/bin/lttng/utils.h   |   13 +
 9 files changed, 110 insertions(+), 6 deletions(-)
 create mode 100644 include/version.h.tmpl

diff --git a/.gitignore b/.gitignore
index ac72bf4..a36f0b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,8 @@ config/
 !config/epoll.m4
 !config/config_feature.m4
 
+include/version.h
+
 src/bin/lttng-sessiond/lttng-sessiond
 src/bin/lttng/lttng
 src/bin/lttng-consumerd/lttng-consumerd
diff --git a/Makefile.am b/Makefile.am
index b0537ce..03fdabc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,9 @@
 ACLOCAL_AMFLAGS = -I config
 
-SUBDIRS = src \
+SUBDIRS = include \
+ src \
  tests \
  extras \
- include \
  doc
 
 dist_doc_DATA = LICENSE \
diff --git a/include/Makefile.am b/include/Makefile.am
index 0bcb6f9..fce6276 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1 +1,44 @@
-lttnginclude_HEADERS = lttng/lttng.h lttng/lttng-error.h
+## The version.h file must be verified and generated or updated if the
+## git commit id (called git version here) changed since the last build
+## of lttng-tools.
+version.h: version.h.tmpl
+   ## We first create variables for the current git version and
+   ## the locations of the version.h and version.h.tmpl files
+   (git_version="$$(git describe --long --all 2>/dev/null)"; \
+   version_h_tmpl="$(top_builddir)/include/version.h.tmpl"; \
+   version_h="$(top_builddir)/include/version.h"; \
+   ## If the version.h file doesn't exist or is not up to date,
+   ## We replace it by the version.h.tmpl file
+   if [ ! -e "$${version_h}" ] || \
+   [ "$${version_h_tmpl}" -nt "$${version_h}" ]; then \
+   cp "$${version_h_tmpl}" "$${version_h}"; \
+   fi; \
+   if [ -z "$${git_version}" ]; then \
+   ## If we don't have a git version, we verify that there is
+   ## not any define of GIT_VERSION in the version.h file, or
+   ## we remove it.
+   if [ $$(grep -c "^#define GIT_VERSION" "$${version_h}") -gt 0 
]; then \
+   sed -i "/^#define GIT_VERSION/d" "$${version_h}"; \
+   fi; \
+   else \
+   ## If we have a git version, we verify that it isn't the same
+   ## as the one currently in the file (if there is one), as we
+   ## don't want to update the file if it is already up to date
+   if [ $$(grep -cE "^#define GIT_VERSION \"?$${git_version}\"?$$" 
"$${version_h}") -eq 0 ]; then \
+   if [ $$(grep -c "^#define GIT_VERSION" "$${version_h}") 
-gt 0 ]; then \
+   ## If there is already a GIT_VERSION defined,
+   ## we just replace it by the new version
+   sed -i "s'^#define GIT_VERSION.*$$'#define 
GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
+   else \
+   ## Else, we add a GIT_VERSION define
+   ## containing our new version.
+   sed -i "s'^\(#define 
VERSION_H.*\)$$'\1\n\n#define GIT_VERSION \"$${git_version}\"'" 
"$${version_h}"; \
+   fi; \
+   fi; \
+   fi)
+
+## version.h is defined as a .PHONY file even if it's a real file as
+## we want our routine to be runned for each build.
+.PHONY: version.h
+
+lttnginclude_HEADERS = lttng/lttng.h lttng/lttng-error.h version.h
diff --git a/include/version.h.tmpl b/include/version.h.tmpl
new file mode 100644
index 000..c42789c
--- /dev/null
+++ b/include/version.h.tmpl
@@ -0,0 +1,27 @@
+/*
+ * version.h
+ *
+ * Linux Trace Toolkit version header file
+ *
+ * Copyright (C) 2013 - Raphaël Beamonte 
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License, version 2.1 only,
+ * as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, 

Re: [lttng-dev] [PATCH lttng-ust] Add missing buffers-uid folder in ust regression test Makefile

2013-03-21 Thread Jérémie Galarneau
Oops...Wrong subject! Applies to lttng-tools, obviously.

Jérémie

On Thu, Mar 21, 2013 at 5:26 PM, Jérémie Galarneau
 wrote:
>
> Signed-off-by: Jérémie Galarneau 
> ---
>  tests/regression/ust/Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/regression/ust/Makefile.am 
> b/tests/regression/ust/Makefile.am
> index d8904bb..c5dee21 100644
> --- a/tests/regression/ust/Makefile.am
> +++ b/tests/regression/ust/Makefile.am
> @@ -1,6 +1,6 @@
>  if HAVE_LIBLTTNG_UST_CTL
>  SUBDIRS = nprocesses high-throughput low-throughput before-after 
> multi-session \
> - overlap
> + overlap buffers-uid
>
>  EXTRA_DIST = runall.sh run-ust-global-tests.sh test_event_basic 
> test_event_wildcard
>
> --
> 1.8.2
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-ust] Add missing buffers-uid folder in ust regression test Makefile

2013-03-21 Thread Jérémie Galarneau

Signed-off-by: Jérémie Galarneau 
---
 tests/regression/ust/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/regression/ust/Makefile.am b/tests/regression/ust/Makefile.am
index d8904bb..c5dee21 100644
--- a/tests/regression/ust/Makefile.am
+++ b/tests/regression/ust/Makefile.am
@@ -1,6 +1,6 @@
 if HAVE_LIBLTTNG_UST_CTL
 SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session 
\
- overlap
+ overlap buffers-uid
 
 EXTRA_DIST = runall.sh run-ust-global-tests.sh test_event_basic 
test_event_wildcard
 
-- 
1.8.2


___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools 4/6] Tests: Use Perl prove as the testsuite runner

2013-03-21 Thread Christian Babeux
Okay I'll post a patch updating the README.

On Thu, Mar 21, 2013 at 5:21 PM, Yannick Brosseau
 wrote:
> On 2013-03-21 17:12, Christian Babeux wrote:
>>> This new dependency should be documented in the README file.
>> Since lttng-tools depends on Automake (which is a Perl script), would
>> that still be relevant to add?
>>
> Automake is not needed if you use the tar.gz, so I think it should be there

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools 4/6] Tests: Use Perl prove as the testsuite runner

2013-03-21 Thread Yannick Brosseau
On 2013-03-21 17:12, Christian Babeux wrote:
>> This new dependency should be documented in the README file.
> Since lttng-tools depends on Automake (which is a Perl script), would
> that still be relevant to add?
>
Automake is not needed if you use the tar.gz, so I think it should be there

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools 4/6] Tests: Use Perl prove as the testsuite runner

2013-03-21 Thread Christian Babeux
> This new dependency should be documented in the README file.

Since lttng-tools depends on Automake (which is a Perl script), would
that still be relevant to add?

Thanks,

Christian

On Thu, Mar 21, 2013 at 4:58 PM, Yannick Brosseau
 wrote:
> On 2013-03-21 15:56, Christian Babeux wrote:
>> Currently the regression and unit testsuites are runned via a custom
>> runner script. By using the Perl prove utility, we can run the testsuites
>> and also gain additionnal features such as: parallel jobs, separate 
>> testlists,
>> etc.
>>
>
> This new dependency should be documented in the README file.
>
> Yannick
>
>
> ___
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools 4/6] Tests: Use Perl prove as the testsuite runner

2013-03-21 Thread Yannick Brosseau
On 2013-03-21 15:56, Christian Babeux wrote:
> Currently the regression and unit testsuites are runned via a custom
> runner script. By using the Perl prove utility, we can run the testsuites
> and also gain additionnal features such as: parallel jobs, separate testlists,
> etc.
>

This new dependency should be documented in the README file.

Yannick


___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-tools 6/6] Tests: Do not exit when a failure occurs in test_buffers_uid

2013-03-21 Thread Christian Babeux

Signed-off-by: Christian Babeux 
---
 tests/regression/ust/buffers-uid/test_buffers_uid | 5 -
 1 file changed, 5 deletions(-)

diff --git a/tests/regression/ust/buffers-uid/test_buffers_uid 
b/tests/regression/ust/buffers-uid/test_buffers_uid
index 1c590f2..215a060 100755
--- a/tests/regression/ust/buffers-uid/test_buffers_uid
+++ b/tests/regression/ust/buffers-uid/test_buffers_uid
@@ -230,11 +230,6 @@ start_lttng_sessiond
 while [ $i -lt $TEST_COUNT ]; do
TRACE_PATH=$(mktemp -d)
${TESTS[$i]}
-   if [ $? -ne 0 ]; then
-   stop_lttng_sessiond
-   exit 1
-   fi
-
rm -rf $TRACE_PATH
let "i++"
 done
-- 
1.8.1.3


___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-tools 3/6] Tests: Fix tests first line of output to follow TAP guidelines

2013-03-21 Thread Christian Babeux
>From the Test::Harness::TAP documentation [1]:

 The plan tells how many tests will be run, or how many tests have run.
 It's a check that the test file hasn't stopped prematurely. It must
 appear once, whether at the beginning or end of the output.

The TAP plan *must* be the first line of output of any tests. Currently,
most of the tests output their description and then the TAP plan. This can
cause issues while parsing the test output for "strict" TAP parser such
as the one used in the prove tool.

This commit ensure that the first line outputted by any tests is the TAP
plan.

Signed-off-by: Christian Babeux 
---
 tests/regression/kernel/test_all_events  | 4 ++--
 tests/regression/kernel/test_event_basic | 4 ++--
 tests/regression/tools/filtering/test_invalid_filter | 4 ++--
 tests/regression/tools/filtering/test_unsupported_op | 4 ++--
 tests/regression/tools/filtering/test_valid_filter   | 4 ++--
 tests/regression/tools/health/test_thread_exit   | 5 +++--
 tests/regression/tools/health/test_thread_stall  | 4 ++--
 tests/regression/tools/health/test_tp_fail   | 4 ++--
 tests/regression/tools/streaming/test_high_throughput_limits | 4 ++--
 tests/regression/tools/streaming/test_kernel | 4 ++--
 tests/regression/tools/streaming/test_ust| 4 ++--
 tests/regression/ust/before-after/test_before_after  | 4 ++--
 tests/regression/ust/buffers-uid/test_buffers_uid| 4 ++--
 tests/regression/ust/high-throughput/test_high_throughput| 4 ++--
 tests/regression/ust/low-throughput/test_low_throughput  | 4 ++--
 tests/regression/ust/multi-session/test_multi_session| 4 ++--
 tests/regression/ust/nprocesses/test_nprocesses  | 4 ++--
 tests/regression/ust/overlap/test_overlap| 4 ++--
 tests/regression/ust/test_event_basic| 4 ++--
 tests/regression/ust/test_event_wildcard | 4 ++--
 tests/unit/test_kernel_data.c| 4 ++--
 tests/unit/test_session.c| 4 ++--
 tests/unit/test_uri.c| 4 ++--
 tests/unit/test_ust_data.c   | 4 ++--
 24 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/tests/regression/kernel/test_all_events 
b/tests/regression/kernel/test_all_events
index 4862748..afd42ab 100755
--- a/tests/regression/kernel/test_all_events
+++ b/tests/regression/kernel/test_all_events
@@ -23,8 +23,6 @@ NUM_TESTS=8
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function test_all_event()
 {
TRACE_PATH=$(mktemp -d)
@@ -47,6 +45,8 @@ function test_all_event()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
isroot=1
 else
diff --git a/tests/regression/kernel/test_event_basic 
b/tests/regression/kernel/test_event_basic
index 4de94dc..5c19744 100755
--- a/tests/regression/kernel/test_event_basic
+++ b/tests/regression/kernel/test_event_basic
@@ -23,8 +23,6 @@ NUM_TESTS=12
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function test_event_basic()
 {
TRACE_PATH=$(mktemp -d)
@@ -51,6 +49,8 @@ function test_event_basic()
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 if [ "$(id -u)" == "0" ]; then
isroot=1
 else
diff --git a/tests/regression/tools/filtering/test_invalid_filter 
b/tests/regression/tools/filtering/test_invalid_filter
index 700fa23..9e8a3c6 100755
--- a/tests/regression/tools/filtering/test_invalid_filter
+++ b/tests/regression/tools/filtering/test_invalid_filter
@@ -28,8 +28,6 @@ NUM_TESTS=119
 
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function enable_ust_lttng_event_filter
 {
sess_name="$1"
@@ -85,6 +83,8 @@ function test_bytecode_limit
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 IFS=$'\n'
 INVALID_FILTERS=(
# Unsupported ops
diff --git a/tests/regression/tools/filtering/test_unsupported_op 
b/tests/regression/tools/filtering/test_unsupported_op
index d0c6c86..b5b7f27 100755
--- a/tests/regression/tools/filtering/test_unsupported_op
+++ b/tests/regression/tools/filtering/test_unsupported_op
@@ -27,8 +27,6 @@ TRACE_PATH=$(mktemp -d)
 NUM_TESTS=46
 source $TESTDIR/utils/utils.sh
 
-print_test_banner "$TEST_DESC"
-
 function enable_ust_lttng_event_filter_unsupported
 {
sess_name=$1
@@ -86,6 +84,8 @@ function test_unsupported_op
 
 plan_tests $NUM_TESTS
 
+print_test_banner "$TEST_DESC"
+
 # Unsupported operators
 OP_STR=("MUL" "DIV" "MOD" "PLUS" "MINUS" "LSHIFT" "RSHIFT"
"BIN_AND" "BIN_OR" "BIN_XOR" "UNARY_BIN_NOT")
diff --git a/tests/regression/tools/filtering/test_valid_filter 
b/tests/regression/tools

[lttng-dev] [PATCH lttng-tools 1/6] Tests: Fix wrong number of tests in test plan of the thread stall test

2013-03-21 Thread Christian Babeux

Signed-off-by: Christian Babeux 
---
 tests/regression/tools/health/test_thread_stall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/regression/tools/health/test_thread_stall 
b/tests/regression/tools/health/test_thread_stall
index 92cfb01..1651c02 100755
--- a/tests/regression/tools/health/test_thread_stall
+++ b/tests/regression/tools/health/test_thread_stall
@@ -24,7 +24,7 @@ SESSION_NAME="health_thread_stall"
 EVENT_NAME="bogus"
 HEALTH_CHECK_BIN="health_check"
 SESSIOND_PRELOAD=".libs/libhealthstall.so"
-NUM_TESTS=12
+NUM_TESTS=11
 
 source $TESTDIR/utils/utils.sh
 
-- 
1.8.1.3


___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-tools 5/6] Tests: Cleanup tests runner that are no longer required

2013-03-21 Thread Christian Babeux
Test runners have been superseeded by testlists and the prove utility.

Signed-off-by: Christian Babeux 
---
 tests/regression/Makefile.am|  2 +-
 tests/regression/kernel/Makefile.am |  2 +-
 tests/regression/kernel/run.sh  | 32 -
 tests/regression/run.sh | 23 --
 tests/regression/tools/Makefile.am  |  2 --
 tests/regression/tools/run.sh   | 39 --
 tests/regression/ust/Makefile.am|  2 +-
 tests/unit/Makefile.am  |  2 --
 tests/unit/run.sh   | 34 --
 tests/utils/runner.sh   | 48 -
 10 files changed, 3 insertions(+), 183 deletions(-)
 delete mode 100755 tests/regression/kernel/run.sh
 delete mode 100755 tests/regression/run.sh
 delete mode 100755 tests/regression/tools/run.sh
 delete mode 100755 tests/unit/run.sh
 delete mode 100644 tests/utils/runner.sh

diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am
index 3641cf1..ddb7372 100644
--- a/tests/regression/Makefile.am
+++ b/tests/regression/Makefile.am
@@ -1,6 +1,6 @@
 SUBDIRS = tools kernel ust
 
-EXTRA_DIST = run-report.py test_list.py run.sh
+EXTRA_DIST = run-report.py test_list.py
 
 if HAVE_LIBLTTNG_UST_CTL
 SUBDIRS += ust
diff --git a/tests/regression/kernel/Makefile.am 
b/tests/regression/kernel/Makefile.am
index cff432d..6b2b891 100644
--- a/tests/regression/kernel/Makefile.am
+++ b/tests/regression/kernel/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = run.sh test_event_basic test_all_events
+EXTRA_DIST = test_event_basic test_all_events
diff --git a/tests/regression/kernel/run.sh b/tests/regression/kernel/run.sh
deleted file mode 100755
index fe042e4..000
--- a/tests/regression/kernel/run.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2013 - Christian Babeux 
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-
-DIR=$(dirname $0)
-TESTDIR=$DIR/../..
-source $TESTDIR/utils/runner.sh
-
- ADD TESTS HERE 
-
-tests=( $DIR/test_event_basic
-$DIR/test_all_events )
-
- END TESTS HERE 
-
-opts=("$@")
-run_tests tests[@] opts[@]
diff --git a/tests/regression/run.sh b/tests/regression/run.sh
deleted file mode 100755
index f0ea748..000
--- a/tests/regression/run.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2013 - Christian Babeux 
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-DIR=$(dirname $0)
-
-$DIR/kernel/run.sh $@
-$DIR/ust/run.sh $@
-$DIR/tools/run.sh $@
diff --git a/tests/regression/tools/Makefile.am 
b/tests/regression/tools/Makefile.am
index 9065a37..eef793a 100644
--- a/tests/regression/tools/Makefile.am
+++ b/tests/regression/tools/Makefile.am
@@ -1,3 +1 @@
 SUBDIRS = streaming filtering health
-
-EXTRA_DIST = run.sh
diff --git a/tests/regression/tools/run.sh b/tests/regression/tools/run.sh
deleted file mode 100755
index 4f7d2c9..000
--- a/tests/regression/tools/run.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2013 - Christian Babeux 
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-

[lttng-dev] [PATCH lttng-tools 4/6] Tests: Use Perl prove as the testsuite runner

2013-03-21 Thread Christian Babeux
Currently the regression and unit testsuites are runned via a custom
runner script. By using the Perl prove utility, we can run the testsuites
and also gain additionnal features such as: parallel jobs, separate testlists,
etc.

This commit modify the make check target to run Perl prove as the testsuite
runner.

Testlist:

tests/unit_tests  : unit tests.
tests/fast_regression : a fast regression testsuite.
tests/long_regression : a long regression testsuite (includes slow tests such
as test_low_throughput and others).
tests/root_regression : a testsuite for tests that need root access
(mostly tests using lttng-modules and bandwith limits).

Running a testsuite:

$ cd lttng-tools/tests
$ ./run.sh 

One can also run tests manually using prove:

$ prove --exec '' path/to/test

  OR

$ prove --exec '' - < testlist

Signed-off-by: Christian Babeux 
---
 .gitignore|  1 -
 tests/Makefile.am |  4 +++-
 tests/fast_regression | 14 ++
 tests/long_regression | 16 
 tests/root_regression |  4 
 tests/run.sh  |  6 +++---
 tests/unit_tests  |  4 
 7 files changed, 44 insertions(+), 5 deletions(-)
 create mode 100644 tests/fast_regression
 create mode 100644 tests/long_regression
 create mode 100644 tests/root_regression
 create mode 100644 tests/unit_tests

diff --git a/.gitignore b/.gitignore
index ac72bf4..ee58252 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,7 +62,6 @@ gen-nevents
 gen-events-time
 gen-events
 gen-ust-events
-unit_tests
 health_check
 tests/regression/ust/overlap/demo/demo
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b75de49..c53b2d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,6 @@
 SUBDIRS = utils regression unit
 
 check-am:
-   ./run.sh
+   ./run.sh unit_tests
+   ./run.sh fast_regression
+
diff --git a/tests/fast_regression b/tests/fast_regression
new file mode 100644
index 000..fb4ac60
--- /dev/null
+++ b/tests/fast_regression
@@ -0,0 +1,14 @@
+regression/tools/filtering/test_invalid_filter
+regression/tools/filtering/test_unsupported_op
+regression/tools/filtering/test_valid_filter
+regression/tools/health/test_thread_exit
+regression/tools/health/test_thread_stall
+regression/tools/health/test_tp_fail
+regression/tools/streaming/test_ust
+regression/ust/before-after/test_before_after
+regression/ust/buffers-uid/test_buffers_uid
+regression/ust/multi-session/test_multi_session
+regression/ust/nprocesses/test_nprocesses
+regression/ust/overlap/test_overlap
+regression/ust/test_event_basic
+regression/ust/test_event_wildcard
diff --git a/tests/long_regression b/tests/long_regression
new file mode 100644
index 000..8bae843
--- /dev/null
+++ b/tests/long_regression
@@ -0,0 +1,16 @@
+regression/tools/filtering/test_invalid_filter
+regression/tools/filtering/test_unsupported_op
+regression/tools/filtering/test_valid_filter
+regression/tools/health/test_thread_exit
+regression/tools/health/test_thread_stall
+regression/tools/health/test_tp_fail
+regression/tools/streaming/test_ust
+regression/ust/before-after/test_before_after
+regression/ust/buffers-uid/test_buffers_uid
+regression/ust/high-throughput/test_high_throughput
+regression/ust/low-throughput/test_lo_throughput
+regression/ust/multi-session/test_multi_session
+regression/ust/nprocesses/test_nprocesses
+regression/ust/overlap/test_overlap
+regression/ust/test_event_basic
+regression/ust/test_event_wildcard
diff --git a/tests/root_regression b/tests/root_regression
new file mode 100644
index 000..2ae884d
--- /dev/null
+++ b/tests/root_regression
@@ -0,0 +1,4 @@
+regression/kernel/test_all_events
+regression/kernel/test_event_basic
+regression/tools/streaming/test_high_throughput_limits
+regression/tools/streaming/test_kernel
diff --git a/tests/run.sh b/tests/run.sh
index d63c72b..c6c50fd 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-DIR=$(dirname $0)
 
-$DIR/regression/run.sh $@
-$DIR/unit/run.sh $@
+[ -z "$1" ] && echo "Error: No testlist. Please specify a testlist to run." && 
exit 1
+
+prove --merge --exec '' - < $1
diff --git a/tests/unit_tests b/tests/unit_tests
new file mode 100644
index 000..d7c68b6
--- /dev/null
+++ b/tests/unit_tests
@@ -0,0 +1,4 @@
+unit/test_kernel_data
+unit/test_session
+unit/test_uri
+unit/test_ust_data
-- 
1.8.1.3


___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


[lttng-dev] [PATCH lttng-tools 2/6] Tests: Fix missing TAP output in overlap test

2013-03-21 Thread Christian Babeux
The start and stop tracing shell functions are currently redirected to
/dev/null. This has the unfortunate side-effect of silencing the TAP
output thus producing an incomplete test output.

This commit remove the /dev/null redirection of those commands.

Signed-off-by: Christian Babeux 
---
 tests/regression/ust/overlap/test_overlap | 104 ++
 1 file changed, 50 insertions(+), 54 deletions(-)

diff --git a/tests/regression/ust/overlap/test_overlap 
b/tests/regression/ust/overlap/test_overlap
index 4e0d90c..e823072 100755
--- a/tests/regression/ust/overlap/test_overlap
+++ b/tests/regression/ust/overlap/test_overlap
@@ -88,11 +88,11 @@ test_enable_simple_wildcard()
enable_ust_lttng_event $SESSION_NAME "$event_wild1"
enable_ust_lttng_event $SESSION_NAME "$event_wild2"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
 
@@ -110,11 +110,11 @@ test_enable_wildcard_filter()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==1"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==0"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
return $?
@@ -131,11 +131,11 @@ test_enable_wildcard_filter_2()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==0"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==1"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
return $?
@@ -152,11 +152,11 @@ test_enable_wildcard_filter_3()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==1"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==1"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
return $?
@@ -173,11 +173,11 @@ test_enable_wildcard_filter_4()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==0"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==0"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_no_demo_events
return $?
@@ -194,11 +194,11 @@ test_enable_wildcard_filter_5()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==1"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==0"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
return $?
@@ -215,11 +215,11 @@ test_enable_wildcard_filter_6()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==0"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==1"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_matches $DEMO_EVENT1 $NUM_DEMO1_EVENT $TRACE_PATH
trace_matches $DEMO_EVENT1_2 0 $TRACE_PATH
@@ -239,11 +239,11 @@ test_enable_wildcard_filter_7()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==1"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==1"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_all_demo_events
return $?
@@ -260,11 +260,11 @@ test_enable_wildcard_filter_8()
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild1" "1==0"
enable_ust_lttng_event_filter $SESSION_NAME "$event_wild2" "1==0"
 
-   start_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   start_lttng_tracing $SESSION_NAME
 
run_demo_app
 
-   stop_lttng_tracing $SESSION_NAME >/dev/null 2>&1
+   stop_lttng_tracing $SESSION_NAME
 
trace_match_no_demo_events
ret

Re: [lttng-dev] [lttng-tools PATCH] Add a git version information in LTTng versions compiled from git sources

2013-03-21 Thread David Goulet
This does not compile event after a clean and bootstrap.

make[3]: Entering directory
`/home/dgoulet/Documents/git/lttng-tools/src/bin/lttng'
  CC conf.o
  CC start.o
In file included from commands/../command.h:26:0,
 from commands/start.c:27:
commands/../utils.h:23:21: fatal error: version.h: No such file or directory
compilation terminated.

David

Raphaël Beamonte:
> Signed-off-by: Raphaël Beamonte 
> ---
>  .gitignore  |2 ++
>  include/Makefile.am |   45 
> ++-
>  include/version.h.tmpl  |   27 +++
>  src/bin/lttng-sessiond/lttng-sessiond.h |   14 ++
>  src/bin/lttng-sessiond/main.c   |2 +-
>  src/bin/lttng/commands/version.c|4 ++-
>  src/bin/lttng/lttng.c   |5 +++-
>  src/bin/lttng/utils.h   |   13 +
>  8 files changed, 108 insertions(+), 4 deletions(-)
>  create mode 100644 include/version.h.tmpl
> 
> diff --git a/.gitignore b/.gitignore
> index ac72bf4..a36f0b9 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -31,6 +31,8 @@ config/
>  !config/epoll.m4
>  !config/config_feature.m4
>  
> +include/version.h
> +
>  src/bin/lttng-sessiond/lttng-sessiond
>  src/bin/lttng/lttng
>  src/bin/lttng-consumerd/lttng-consumerd
> diff --git a/include/Makefile.am b/include/Makefile.am
> index 0bcb6f9..fce6276 100644
> --- a/include/Makefile.am
> +++ b/include/Makefile.am
> @@ -1 +1,44 @@
> -lttnginclude_HEADERS = lttng/lttng.h lttng/lttng-error.h
> +## The version.h file must be verified and generated or updated if the
> +## git commit id (called git version here) changed since the last build
> +## of lttng-tools.
> +version.h: version.h.tmpl
> + ## We first create variables for the current git version and
> + ## the locations of the version.h and version.h.tmpl files
> + (git_version="$$(git describe --long --all 2>/dev/null)"; \
> + version_h_tmpl="$(top_builddir)/include/version.h.tmpl"; \
> + version_h="$(top_builddir)/include/version.h"; \
> + ## If the version.h file doesn't exist or is not up to date,
> + ## We replace it by the version.h.tmpl file
> + if [ ! -e "$${version_h}" ] || \
> + [ "$${version_h_tmpl}" -nt "$${version_h}" ]; then \
> + cp "$${version_h_tmpl}" "$${version_h}"; \
> + fi; \
> + if [ -z "$${git_version}" ]; then \
> + ## If we don't have a git version, we verify that there is
> + ## not any define of GIT_VERSION in the version.h file, or
> + ## we remove it.
> + if [ $$(grep -c "^#define GIT_VERSION" "$${version_h}") -gt 0 
> ]; then \
> + sed -i "/^#define GIT_VERSION/d" "$${version_h}"; \
> + fi; \
> + else \
> + ## If we have a git version, we verify that it isn't the same
> + ## as the one currently in the file (if there is one), as we
> + ## don't want to update the file if it is already up to date
> + if [ $$(grep -cE "^#define GIT_VERSION \"?$${git_version}\"?$$" 
> "$${version_h}") -eq 0 ]; then \
> + if [ $$(grep -c "^#define GIT_VERSION" "$${version_h}") 
> -gt 0 ]; then \
> + ## If there is already a GIT_VERSION defined,
> + ## we just replace it by the new version
> + sed -i "s'^#define GIT_VERSION.*$$'#define 
> GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
> + else \
> + ## Else, we add a GIT_VERSION define
> + ## containing our new version.
> + sed -i "s'^\(#define 
> VERSION_H.*\)$$'\1\n\n#define GIT_VERSION \"$${git_version}\"'" 
> "$${version_h}"; \
> + fi; \
> + fi; \
> + fi)
> +
> +## version.h is defined as a .PHONY file even if it's a real file as
> +## we want our routine to be runned for each build.
> +.PHONY: version.h
> +
> +lttnginclude_HEADERS = lttng/lttng.h lttng/lttng-error.h version.h
> diff --git a/include/version.h.tmpl b/include/version.h.tmpl
> new file mode 100644
> index 000..c42789c
> --- /dev/null
> +++ b/include/version.h.tmpl
> @@ -0,0 +1,27 @@
> +/*
> + * version.h
> + *
> + * Linux Trace Toolkit version header file
> + *
> + * Copyright (C) 2013 - Raphaël Beamonte 
> + *
> + * This library is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License, version 2.1 
> only,
> + * as published by the Free Software Foundation.
> + *
> + * This library is distributed in the hope that it will be useful, but 
> WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
> License
> + * for more details.
> + *
> + * You should have received a c

Re: [lttng-dev] [PATCH lttng-tools] Fix: Memory leak on error paths of relay_add_stream

2013-03-21 Thread David Goulet
Merged all 7!

David

Christian Babeux:
> On error paths the memory allocated for stream is never freed.
> 
> Also, fix undefined behavior on asprintf alloc failure. According to
> asprintf(3), the content of the pointer passed to it is undefined if
> an alloc failure occurs, so we could end up freeing a pointer in an
> undefined state. Force its value to NULL.
> 
> Signed-off-by: Christian Babeux 
> ---
>  src/bin/lttng-relayd/main.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c
> index 4f9d742..00b7ea3 100644
> --- a/src/bin/lttng-relayd/main.c
> +++ b/src/bin/lttng-relayd/main.c
> @@ -941,6 +941,7 @@ int relay_add_stream(struct lttcomm_relayd_hdr *recv_hdr,
>   ret = asprintf(&path, "%s/%s", root_path, stream_info.channel_name);
>   if (ret < 0) {
>   PERROR("asprintf stream path");
> + path = NULL;
>   goto end;
>   }
>  
> @@ -963,13 +964,17 @@ int relay_add_stream(struct lttcomm_relayd_hdr 
> *recv_hdr,
>  end:
>   free(path);
>   free(root_path);
> +
> + reply.handle = htobe64(stream->stream_handle);
>   /* send the session id to the client or a negative return code on error 
> */
>   if (ret < 0) {
>   reply.ret_code = htobe32(LTTNG_ERR_UNK);
> + /* stream was not properly added to the ht, so free it */
> + free(stream);
>   } else {
>   reply.ret_code = htobe32(LTTNG_OK);
>   }
> - reply.handle = htobe64(stream->stream_handle);
> +
>   send_ret = cmd->sock->ops->sendmsg(cmd->sock, &reply,
>   sizeof(struct lttcomm_relayd_status_stream), 0);
>   if (send_ret < 0) {

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [PATCH lttng-tools] Add with-sessiond-bin configure option

2013-03-21 Thread David Goulet
Merged thanks!

David

Simon Marchi:
> I also cleaned up the little check_sessiond function. The check using
> access(2) was only done for the command line option, but I think it is a
> good idea to do it wherever the path comes from.
> 
> closes #441
> 
> Signed-off-by: Simon Marchi 
> ---
>  configure.ac  |   17 +
>  src/bin/lttng/lttng.c |   37 -
>  2 files changed, 37 insertions(+), 17 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 71fbb60..7349713 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -91,12 +91,20 @@ AC_ARG_WITH([consumerd64-libdir],
>   [CONSUMERD64_LIBDIR=''])
>  AC_SUBST([CONSUMERD64_LIBDIR])
>  
> +AC_ARG_WITH([sessiond-bin],
> + AS_HELP_STRING([--with-sessiond-bin],
> + [Location of the sessiond executable (including the filename)]),
> + [SESSIOND_BIN="$withval"],
> + [SESSIOND_BIN=''])
> +AC_SUBST([SESSIOND_BIN])
> +
>  AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_BIN], "$CONSUMERD32_BIN", [Location 
> of the 32-bit consumerd executable.])
>  AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], "$CONSUMERD64_BIN", [Location 
> of the 64-bit consumerd executable])
>  AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], "$CONSUMERD32_LIBDIR", 
> [Search for consumerd 32-bit libraries in this location.])
>  AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_LIBDIR], "$CONSUMERD64_LIBDIR", 
> [Search for consumerd 64-bit libraries in this location.])
>  AC_DEFINE_UNQUOTED([CONFIG_BABELTRACE_BIN], "$BABELTRACE_BIN", [Location of 
> the babeltrace viewer executable.])
>  AC_DEFINE_UNQUOTED([CONFIG_LTTV_GUI_BIN], "$LTTV_GUI_BIN", [Location of the 
> lttv GUI viewer executable.])
> +AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the 
> sessiond executable.])
>  
>  # Check for pthread
>  AC_CHECK_LIB([pthread], [pthread_create], [],
> @@ -383,6 +391,15 @@ AS_ECHO("`eval eval echo $libdir`")
>  # If we build the sessiond, print the paths it will use
>  AS_IF([test "x$consumerd_only" = "xno"],[
>   AS_ECHO()
> + AS_ECHO_N("The lttng command will look for the lttng-sessiond 
> executable at: ")
> + AS_IF([test "$SESSIOND_BIN" = ""],[
> + AS_ECHO_N("`eval eval echo $bindir`")
> + AS_ECHO("/lttng-sessiond")
> + ],[
> + AS_ECHO("$SESSIOND_BIN")
> + ])
> +
> + AS_ECHO()
>   AS_ECHO("The sessiond daemon will look in the following directories: ")
>   AS_ECHO_N("32-bit consumerd executable at: ")
>   AS_IF([test "$CONSUMERD32_BIN" = ""],[
> diff --git a/src/bin/lttng/lttng.c b/src/bin/lttng/lttng.c
> index 8562144..4097956 100644
> --- a/src/bin/lttng/lttng.c
> +++ b/src/bin/lttng/lttng.c
> @@ -346,35 +346,38 @@ end:
>  static int check_sessiond(void)
>  {
>   int ret;
> - char *pathname = NULL, *alloc_pathname = NULL;
> + char *pathname = NULL;
>  
>   ret = lttng_session_daemon_alive();
>   if (ret == 0) { /* not alive */
>   /* Try command line option path */
> - if (opt_sessiond_path != NULL) {
> - ret = access(opt_sessiond_path, F_OK | X_OK);
> - if (ret < 0) {
> - ERR("No such file or access denied: %s", 
> opt_sessiond_path);
> - goto end;
> - }
> - pathname = opt_sessiond_path;
> - } else {
> - /* Try LTTNG_SESSIOND_PATH env variable */
> + pathname = opt_sessiond_path;
> +
> + /* Try LTTNG_SESSIOND_PATH env variable */
> + if (pathname == NULL) {
>   pathname = getenv(DEFAULT_SESSIOND_PATH_ENV);
>   }
>  
> - /* Let's rock and roll */
> + /* Try with configured path */
>   if (pathname == NULL) {
> - ret = asprintf(&alloc_pathname, INSTALL_BIN_PATH 
> "/lttng-sessiond");
> - if (ret < 0) {
> - perror("asprintf spawn sessiond");
> - goto end;
> + if (CONFIG_SESSIOND_BIN[0] != '\0') {
> + pathname = CONFIG_SESSIOND_BIN;
>   }
> - pathname = alloc_pathname;
> + }
> +
> + /* Let's rock and roll while trying the default path */
> + if (pathname == NULL) {
> + pathname = INSTALL_BIN_PATH "/lttng-sessiond";
> + }
> +
> + /* Check existence and permissions */
> + ret = access(pathname, F_OK | X_OK);
> + if (ret < 0) {
> + ERR("No such file or access denied: %s", pathname);
> + goto end;
>   }
>  
>   ret = spawn_sessiond(pathname);
> - free(alloc_pathname);
>   if (ret < 0) {
>   ERR("Problem occurred when starting %s", pathname);
>  

[lttng-dev] Per UID buffers in UST

2013-03-21 Thread David Goulet
Hi everyone,

Just a quick heads up that the support for per UID buffers for UST has
been pushed into the master branch of tools and can be used like so:

$ lttng create
$ lttng enable-channel -u --buffers-uid chan1
$ lttng enable-event -a -u -c chan1
$ lttng start

Of course, you'll need the master HEAD of lttng-ust as well.

Please, I encourage anyone of you to test it! and of course report bugs
or anything weird or not working :).

commit 7972aab22f74b18faa168c0482216a3dd711a075

Cheers!
David

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


Re: [lttng-dev] [RFC-PATCH] Adding trap tracepoints definitions

2013-03-21 Thread Mathieu Desnoyers
* Francis Deslauriers (fdesl...@gmail.com) wrote:
> On Wed, Mar 20, 2013 at 10:51 PM, Mathieu Desnoyers
>  wrote:
> > Subject change:
> >
> > "Adding trap tracepoints definitions"
> >
> > -> "Add trap trace event definitions"
> >
> > ->
> >
> > Add trace trace event definitions. It will allow each architecture to
> > instrument their traps.
> 
> How about this?
> Add trap trace event definitions
> 
> Add trap entry and trap exit trace event definitions. It will allow each
> architecture to instrument their traps.
> 
> 
> This way we dont repeat the subject and it is more specific.

sounds good!

With these changes, please put my:

Reviewed-by: Mathieu Desnoyers 

Thanks,

Mathieu

> 
> >
> > I'm being even more strict than usual as you notice given that this
> > patch is targeting lkml.
> >
> > Thanks,
> >
> > Mathieu
> >
> >>
> >> Signed-off-by: Francis Deslauriers 
> >> ---
> >>  include/trace/events/trap.h |   47 
> >> +++
> >>  1 file changed, 47 insertions(+)
> >>  create mode 100644 include/trace/events/trap.h
> >>
> >> diff --git a/include/trace/events/trap.h b/include/trace/events/trap.h
> >> new file mode 100644
> >> index 000..171b9cf
> >> --- /dev/null
> >> +++ b/include/trace/events/trap.h
> >> @@ -0,0 +1,47 @@
> >> +#undef TRACE_SYSTEM
> >> +#define TRACE_SYSTEM trap
> >> +
> >> +#if !defined(_TRACE_TRAP_H) || defined(TRACE_HEADER_MULTI_READ)
> >> +#define _TRACE_TRAP_H
> >> +
> >> +#include 
> >> +
> >> +TRACE_EVENT(trap_entry,
> >> +
> >> + TP_PROTO(struct pt_regs *regs, long trap),
> >> +
> >> + TP_ARGS(regs, trap),
> >> +
> >> + TP_STRUCT__entry(
> >> + __field(long,   trap)
> >> + __field(unsigned long,  ip  )
> >> + ),
> >> +
> >> + TP_fast_assign(
> >> + __entry->trap   = trap;
> >> + __entry->ip = regs ? instruction_pointer(regs) : 0UL;
> >> + ),
> >> +
> >> + TP_printk("number=%ld ip=%lu", __entry->trap, __entry->ip)
> >> +);
> >> +
> >> +TRACE_EVENT(trap_exit,
> >> +
> >> + TP_PROTO(long trap),
> >> +
> >> + TP_ARGS(trap),
> >> +
> >> + TP_STRUCT__entry(
> >> + __field(long,   trap)
> >> + ),
> >> +
> >> + TP_fast_assign(
> >> + __entry->trap   = trap;
> >> + ),
> >> +
> >> + TP_printk("number=%ld", __entry->trap)
> >> +);
> >> +
> >> +#endif /* _TRACE_TRAP_H */
> >> +/* This part must be outside protection */
> >> +#include 
> >> --
> >> 1.7.10.4
> >>
> >>
> >> ___
> >> lttng-dev mailing list
> >> lttng-dev@lists.lttng.org
> >> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> >
> > --
> > Mathieu Desnoyers
> > EfficiOS Inc.
> > http://www.efficios.com

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

___
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev