Test for presence of bison and flex when building from git

Fixes #74

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Put the libbabeltrace-ctf specific parts of babeltrace.pc into a babeltrace-ctf.pc file

On some distributions libbabeltrace and libbabeltrace-ctf are packaged
into separate packages. This means they should have their own pkg-config
file.

The babeltrace-ctf.pc file requires the babeltrace.pc one.

With this change, to have the ctf support in libbabeltrace a pkg-config
user will need to specify the babeltrace-ctf package. To compile and
link with only the base libbabeltrace, the package babeltrace would be
used.

Fixes #550

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing lex/bison generated files to make clean

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix CTF parser hang with bison 3.0

Replace deprecated YYLEX_PARAM with %lex-param

See http://article.gmane.org/gmane.org.fsf.announce/2006 for details.

Tested with bison 2.5 and bison 3.0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix ctf_clock_declaration_visit returning an error when reading a boolean

The ret variable is used to read the "absolute" field's value and was
not reset to zero, thus returning an error whenever that value was TRUE.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: Move TAP helpers to tests/utils/tap

tests/utils/tap/tap.{h,c}:
For use in C tests. You can link against libtap with the usual automake
mechanisms.

New TAP helper:

tests/utils/tap/tap.sh:
For use in shell scripts tests. Source the script
(e.g. source "tests/utils/tap/tap.sh") to use the relevants TAP
functions.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: Rename tests under lib with tests naming convention

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: Split lib tests in multiple standalone test scripts

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: Add trace reading test with babeltrace bin

This test uses the sample traces found in tests/ctf-traces and the
babeltrace cli tool to parse them. The traces found in
ctf-traces/succeed should return a successful exit code and those in
ctf-traces/fail should return a failure exit code.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: Use Perl prove as the testsuite runner

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

$ cd babeltrace/tests
$ ./run.sh tests

One can also run tests manually using prove:

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

    OR

$ prove --exec '' - < testlist

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing test files to make dist

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
make check VPATH build

Copy scripts to builddir if VPATH build is detected.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing Makefile.am

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tests: fix string octal encoding

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: test_seek static linking

./configure --disable-shared --enable-static
make
make check

The make check fails for test_seek.

Fix this by ensuring that test_seek has a dependency on libbabeltrace
and libbabeltrace-ctf. This is a temporary work-around until we improve
our plugin handling.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Merge branch 'master' into bindings/python

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing call to _bt_ctf_get_decl_from_def() when calling _bt_ctf_get_int_len().

The python code that call _bt_ctf_get_int_len() fails to wrap self._d
with the call to _bt_ctf_get_decl_from_def.

Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Amit Margalit <amitm@il.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix (python): use of braces in format strings

Using braces in format strings without specifying a number (e.g. "The
number {} is incorrect".format(some_variable)) is available since Python
2.7, and older Python 2.6 required a number, zero-based (e.g. "The
number {0} is incorrect").

This patch adds these numbers for the sake of older systems.

Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Amit Margalit <amitm@il.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing declaration of ssize_t as unsigned long for SWIG

The file babeltrace.i.in contains a declaration of bt_get_int_len()
returning ssize_t, which SWIG does not recognize as an integer (perhaps
only in some cases).

Add a typedef to generate correct code.

Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Amit Margalit <amitm@il.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Revert "Add missing declaration of ssize_t as unsigned long for SWIG"

This reverts commit 515d3e63070e76440856bb9a123e9b3fb82d5fb5.

Jeremie pointed out that he recommended _not_ to merge this patch.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>