tests: Move to kernel style SPDX license identifiers The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. See https://spdx.org/ids-how for details. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Change-Id: I89cd4b4b7440f71f52426a5508252932bb46e796 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests: make functions static in test_utils_expand_path.c Fixes: CC test_utils_expand_path.o /home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:126:5: error: no previous declaration for ‘prepare_valid_results’ [-Werror=missing-declarations] int prepare_valid_results(void) ^~~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:182:5: error: no previous declaration for ‘free_valid_results’ [-Werror=missing-declarations] int free_valid_results(void) ^~~~~~~~~~~~~~~~~~ /home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:195:5: error: no previous declaration for ‘prepare_symlink_tree’ [-Werror=missing-declarations] int prepare_symlink_tree(void) ^~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/lttng-tools/tests/unit/test_utils_expand_path.c:235:5: error: no previous declaration for ‘free_symlink_tree’ [-Werror=missing-declarations] int free_symlink_tree(void) ^~~~~~~~~~~~~~~~~ Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Change-Id: I220a2f8dadb355adb4fb974a2f3a0e161b0618e6 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: tests: replace truncation-prone logging helper The printerr() error logging scheme in test_utils_expand_path is prone to unexpected truncations which results in a lot of warnings when building using GCC 9.2. It is replaced by a variable-argument macro that uses fprintf() directly. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix tests: the tree origin can be a symlink itself Problem: The base tree is defined as "/tmp/.....XXXXXX". On systems where "/tmp/" is itself a symlink utils_expand_path will expand the tree origin itself. For example on a base core-image-minimal Yocto build /tmp is a symlink to "/var/tmp", which is a symlink to "/var/volatile". utils_expand_path will return something like this for the symlink test: "/var/volative/.....XXXXXX/...." which is the valid result. Solution: Simply use realpath on the tree_origin and use this path to perform the test validation. This work was performed in the effort to support yocto fully and be able to run the test suite to detect problem as early as possible. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add utils_expand_path_keep_symlink fonction This function mimics the behaviour of utils_expand_path() but omits to expand symbolic links. This is useful to keep the full path to a user-provided path, which can contain a symlink. We will use this of the lttng-save of sessions containing userspace-probe. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Don't override user variables within the build system Instead use the appropriatly prefixed AM_* variables as to not interfere when a user variable is passed to a make command. The proper use of flag variables is documented at : https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mi: mi backend + mi for command version The machine interface option is now available for version. Other commands will shortly follow. Mi backend is expected to grow with addition of mi support to other commands. How to use: lttng --mi <mi_output_type> <command> This syntax will be the same for all commands. Currently *only xml is supported as machine interface output.* As for errors handling, if an error/warning occurs while using mi it will be reported on stderr as normal. The integrity of the mi output cannot be guaranteed if an error/warning occurs. The error output format is consistent and easy for a machine client to parse. Thus no mi output format is required for error output. Example: lttng --mi xml version Output: <?xml version="1.0" encoding="UTF-8"?> <command> <name>version</name> <output> <string>2.4.0-rc2</string> <major>2</major> <minor>4</minor> <patchLevel>0</patchLevel> <name>Époque Opaque</name> <description>The Époque Opaque is a black IPA from Trou du Diable brewery. The nose is eerily reminiscent of the coffee crisp candy from of our childhood. These strong mocha accents are present on the palate, which are quickly subdued by Japanese and Australian hops leading to a final state of satisfaction enjoyable for any fan of bitter beer.</description> <url>http://lttng.org</url> <license>lttng is free software and under the GPL license and part LGPL</license> </output> </command> Signed-off-by: Olivier Cotte <olivier.cotte@polymtl.ca> Signed-off-by: Jonathan Rajotte <jonathan.r.julien@gmail.com> Signed-off-by: David Goulet <dgoulet@efficios.com>
Tests: add symlink tests for test_utils_expand_path These new test cases allows to test the utils_expand_path function with an existing tree using symlinks. It allows to verify the right behavior of the function in complex situation. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>