}
}
+ if ((!opt_ctrl_url && opt_data_url) || (opt_ctrl_url && !opt_data_url)) {
+ ERR("You need both control and data URL.");
+ ret = CMD_ERROR;
+ goto error;
+ }
+
if (opt_output_path != NULL) {
traces_path = utils_expand_path(opt_output_path);
if (traces_path == NULL) {
} else if (opt_url) { /* Handling URL (-U opt) */
url = opt_url;
print_str_url = url;
+ } else if (opt_data_url && opt_ctrl_url) {
+ /*
+ * With both control and data, we'll be setting the consumer URL after
+ * session creation thus use no URL.
+ */
+ url = NULL;
} else if (!opt_no_output) {
/* Auto output path */
alloc_path = utils_get_home_dir();
}
url = alloc_url;
- if (!opt_data_url && !opt_ctrl_url) {
- print_str_url = alloc_url + strlen("file://");
- }
+ print_str_url = alloc_url + strlen("file://");
} else {
/* No output means --no-output or --snapshot mode. */
url = NULL;
}
- if ((!opt_ctrl_url && opt_data_url) || (opt_ctrl_url && !opt_data_url)) {
- ERR("You need both control and data URL.");
- ret = CMD_ERROR;
- goto error;
- }
-
+ /* Use default live URL if NO url is/are found. */
if ((opt_live_timer && !opt_url) && (opt_live_timer && !opt_data_url)) {
- /* Use default live URL if none is found. */
ret = asprintf(&alloc_url, "net://127.0.0.1");
if (ret < 0) {
PERROR("asprintf default live URL");
lsm.cmd_type = LTTNG_CREATE_SESSION_LIVE;
lttng_ctl_copy_string(lsm.session.name, name, sizeof(lsm.session.name));
- size = uri_parse_str_urls(url, NULL, &uris);
- if (size <= 0) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
- }
+ if (url) {
+ size = uri_parse_str_urls(url, NULL, &uris);
+ if (size <= 0) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
- /* file:// is not accepted for live session. */
- if (uris[0].dtype == LTTNG_DST_PATH) {
- ret = -LTTNG_ERR_INVALID;
- goto end;
+ /* file:// is not accepted for live session. */
+ if (uris[0].dtype == LTTNG_DST_PATH) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+ } else {
+ size = 0;
}
lsm.u.session_live.nb_uri = size;
DIR=$(readlink -f $TESTDIR)
-NUM_TESTS=10
+NUM_TESTS=11
source $TESTDIR/utils/utils.sh
print_test_banner "$TEST_DESC"
+function test_custom_url()
+{
+ # Create session with custom URL
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
+ -C tcp://localhost:1819 -D tcp://localhost:9187 >/dev/null 2>&1
+ ok $? "Create session in live mode with delay $DELAY_USEC and custom URLs"
+}
+
function setup_live_tracing()
{
# Create session with default path
trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH
rm -rf $TRACE_PATH
-
stop_lttng_relayd
+
+test_custom_url
+pkill $RELAYD_BIN
+
stop_lttng_sessiond