[lttng-dev] [PATCH lttng-tools 2/2] Port: fix format warnings on Cygwin

2018-05-15 Thread Michael Jeanson
On Cygwin, be64toh() returns a "long long unsigned int" while the
format specifier PRIu64 expects a "long unsigned int". Both types
are 64bits integers, just cast the result to uint64_t to silence
the warnings.

Signed-off-by: Michael Jeanson 
---
 src/bin/lttng-relayd/live.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c
index 4ade082b..6f50afc6 100644
--- a/src/bin/lttng-relayd/live.c
+++ b/src/bin/lttng-relayd/live.c
@@ -1039,12 +1039,12 @@ int viewer_attach_session(struct relay_connection *conn)
session = session_get_by_id(be64toh(request.session_id));
if (!session) {
DBG("Relay session %" PRIu64 " not found",
-   be64toh(request.session_id));
+   (uint64_t) be64toh(request.session_id));
response.status = htobe32(LTTNG_VIEWER_ATTACH_UNK);
goto send_reply;
}
DBG("Attach session ID %" PRIu64 " received",
-   be64toh(request.session_id));
+   (uint64_t) be64toh(request.session_id));
 
if (session->live_timer == 0) {
DBG("Not live session");
@@ -1301,7 +1301,7 @@ int viewer_get_next_index(struct relay_connection *conn)
vstream = viewer_stream_get_by_id(be64toh(request_index.stream_id));
if (!vstream) {
DBG("Client requested index of unknown stream id %" PRIu64,
-   be64toh(request_index.stream_id));
+   (uint64_t) be64toh(request_index.stream_id));
viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_ERR);
goto send_reply;
}
@@ -1415,7 +1415,7 @@ int viewer_get_next_index(struct relay_connection *conn)
 */
DBG("Sending viewer index for stream %" PRIu64 " offset %" PRIu64,
rstream->stream_handle,
-   be64toh(packet_index.offset));
+   (uint64_t) be64toh(packet_index.offset));
viewer_index.offset = packet_index.offset;
viewer_index.packet_size = packet_index.packet_size;
viewer_index.content_size = packet_index.content_size;
@@ -1510,7 +1510,7 @@ int viewer_get_packet(struct relay_connection *conn)
vstream = viewer_stream_get_by_id(be64toh(get_packet_info.stream_id));
if (!vstream) {
DBG("Client requested packet of unknown stream id %" PRIu64,
-   be64toh(get_packet_info.stream_id));
+   (uint64_t) be64toh(get_packet_info.stream_id));
reply_header.status = htobe32(LTTNG_VIEWER_GET_PACKET_ERR);
goto send_reply_nolock;
} else {
@@ -1530,7 +1530,7 @@ int viewer_get_packet(struct relay_connection *conn)
SEEK_SET);
if (lseek_ret < 0) {
PERROR("lseek fd %d to offset %" PRIu64, vstream->stream_fd->fd,
-   be64toh(get_packet_info.offset));
+   (uint64_t) be64toh(get_packet_info.offset));
goto error;
}
read_len = lttng_read(vstream->stream_fd->fd,
@@ -1539,7 +1539,7 @@ int viewer_get_packet(struct relay_connection *conn)
if (read_len < packet_data_len) {
PERROR("Relay reading trace file, fd: %d, offset: %" PRIu64,
vstream->stream_fd->fd,
-   be64toh(get_packet_info.offset));
+   (uint64_t) be64toh(get_packet_info.offset));
goto error;
}
reply_header.status = htobe32(LTTNG_VIEWER_GET_PACKET_OK);
@@ -1573,7 +1573,7 @@ send_reply_nolock:
}
 
DBG("Sent %u bytes for stream %" PRIu64, reply_size,
-   be64toh(get_packet_info.stream_id));
+   (uint64_t) be64toh(get_packet_info.stream_id));
 
 end_free:
free(reply);
@@ -1625,7 +1625,7 @@ int viewer_get_metadata(struct relay_connection *conn)
 * find it.
 */
DBG("Client requested metadata of unknown stream id %" PRIu64,
-   be64toh(request.stream_id));
+   (uint64_t) be64toh(request.stream_id));
reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR);
goto send_reply;
}
@@ -1711,7 +1711,7 @@ send_reply:
}
 
DBG("Sent %" PRIu64 " bytes of metadata for stream %" PRIu64, len,
-   be64toh(request.stream_id));
+   (uint64_t) be64toh(request.stream_id));
 
DBG("Metadata sent");
 
@@ -1800,7 +1800,7 @@ int viewer_detach_session(struct relay_connection *conn)
session = session_get_by_id(be64toh(request.session_id));
if (!session) {
DBG("Relay session %" PRIu64 " not found",
-   be64toh(request.sess

[lttng-dev] [PATCH lttng-tools 1/2] Add missing include for ssize_t on Cygwin

2018-05-15 Thread Michael Jeanson
Signed-off-by: Michael Jeanson 
---
 include/lttng/condition/condition-internal.h  | 1 +
 include/lttng/condition/evaluation-internal.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/lttng/condition/condition-internal.h 
b/include/lttng/condition/condition-internal.h
index 72a8922b..969c7682 100644
--- a/include/lttng/condition/condition-internal.h
+++ b/include/lttng/condition/condition-internal.h
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 typedef void (*condition_destroy_cb)(struct lttng_condition *condition);
 typedef bool (*condition_validate_cb)(const struct lttng_condition *condition);
diff --git a/include/lttng/condition/evaluation-internal.h 
b/include/lttng/condition/evaluation-internal.h
index 414760e0..e2b6c384 100644
--- a/include/lttng/condition/evaluation-internal.h
+++ b/include/lttng/condition/evaluation-internal.h
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 typedef void (*evaluation_destroy_cb)(struct lttng_evaluation *evaluation);
 typedef ssize_t (*evaluation_serialize_cb)(struct lttng_evaluation *evaluation,
-- 
2.17.0

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


[lttng-dev] [PATCH lttng-tools] Tests: Added autoloading session test cases

2018-05-15 Thread Anders Wallin
lttng-sessiond can auto load sessions at startup;
- with "--load" option to lttng-sessiond, load one file
  or all sessions files in that directory
- from session files in $LTTNG_HOME/.lttng/sessions/auto/
- from session files in $sysconfdir/lttng/sessions/auto

This test case validate the two first scenarios.

Signed-off-by: Anders Wallin 
---
 tests/fast_regression |  1 +
 .../regression/tools/save-load/test_autoload  | 98 +++
 2 files changed, 99 insertions(+)
 create mode 100755 tests/regression/tools/save-load/test_autoload

diff --git a/tests/fast_regression b/tests/fast_regression
index bbce068f..2f02f872 100644
--- a/tests/fast_regression
+++ b/tests/fast_regression
@@ -13,6 +13,7 @@ regression/tools/snapshots/test_ust_fast
 regression/tools/snapshots/test_ust_streaming
 regression/tools/save-load/test_save
 regression/tools/save-load/test_load
+regression/tools/save-load/test_autoload
 regression/tools/mi/test_mi
 regression/tools/wildcard/test_event_wildcard
 regression/tools/crash/test_crash
diff --git a/tests/regression/tools/save-load/test_autoload 
b/tests/regression/tools/save-load/test_autoload
new file mode 100755
index ..b9972bc6
--- /dev/null
+++ b/tests/regression/tools/save-load/test_autoload
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# Copyright (C) - 2018 Anders Wallin 
+#
+# 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; 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
+
+TEST_DESC="Auto load session(s)"
+
+CURDIR=$(dirname $0)/
+CONFIG_DIR="${CURDIR}/configuration"
+TESTDIR=$CURDIR/../../../
+SESSIOND_BIN="lttng-sessiond"
+RELAYD_BIN="lttng-relayd"
+LTTNG_BIN="lttng"
+export LTTNG_SESSION_CONFIG_XSD_PATH=$(readlink -m 
${TESTDIR}../src/common/config/)
+
+DIR=$(readlink -f $TESTDIR)
+
+NUM_TESTS=10
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+function test_auto_load_file()
+{
+   diag "Test auto load file"
+
+   export LTTNG_HOME=
+
+   start_lttng_sessiond $CURDIR/load-42.lttng
+   list_lttng_with_opts load-42
+   stop_lttng_sessiond
+}
+
+function test_auto_load_dir()
+{
+   diag "Test auto load directory"
+
+   export LTTNG_HOME=
+   export LTTNG_DIR=$(mktemp -d)
+   cp -f $CURDIR/load-42.lttng $LTTNG_DIR/
+
+   start_lttng_sessiond $LTTNG_DIR
+   list_lttng_with_opts load-42
+   stop_lttng_sessiond
+
+   rm -rf $LTTNG_DIR
+}
+
+function test_auto_load_lttng_home()
+{
+   diag "Test auto load by setting LTTNG_HOME"
+
+   export LTTNG_HOME=$(mktemp -d)
+   mkdir -p $LTTNG_HOME/.lttng/sessions/auto
+   cp -f $CURDIR/load-42.lttng $LTTNG_HOME/.lttng/sessions/auto
+
+   start_lttng_sessiond
+   list_lttng_with_opts load-42
+   stop_lttng_sessiond
+
+   rm -rf $LTTNG_HOME
+}
+
+TESTS=(
+   test_auto_load_file
+   test_auto_load_dir
+   test_auto_load_lttng_home
+)
+
+stop_lttng_sessiond
+
+for fct_test in ${TESTS[@]};
+do
+   TRACE_PATH=$(mktemp -d)
+
+   ${fct_test}
+   if [ $? -ne 0 ]; then
+   break;
+   fi
+   # Only delete if successful
+   rm -rf $TRACE_PATH
+done
-- 
2.17.0

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