from lttng_ivc.utils.skip import must_be_root
from lttng_ivc.utils.utils import sessiond_spawn
from lttng_ivc.utils.utils import line_count
+from lttng_ivc.utils.utils import file_contains
"""
test_matrix_regen_metadata = [
("lttng-modules-2.7", "lttng-tools-2.7", "metadata regenerate", "Unsupported by tools"),
- ("lttng-modules-2.7", "lttng-tools-2.8", "metadata regenerate", "Unsupported by module"),
- ("lttng-modules-2.7", "lttng-tools-2.9", "regenerate metadata", "Unsupported by module"),
- ("lttng-modules-2.7", "lttng-tools-2.10", "regenerate metadata", "Unsupported by module"),
+ ("lttng-modules-2.7", "lttng-tools-2.8", "metadata regenerate", "Unsupported by modules"),
+ ("lttng-modules-2.7", "lttng-tools-2.9", "regenerate metadata", "Unsupported by modules"),
+ ("lttng-modules-2.7", "lttng-tools-2.10", "regenerate metadata", "Unsupported by modules"),
("lttng-modules-2.8", "lttng-tools-2.7", "metadata regenerate", "Unsupported by tools"),
("lttng-modules-2.8", "lttng-tools-2.8", "metadata regenerate", "Supported"),
("lttng-modules-2.8", "lttng-tools-2.9", "regenerate metadata", "Supported"),
test_matrix_statedump = [
("lttng-modules-2.7", "lttng-tools-2.7", "Unsupported by tools"),
("lttng-modules-2.7", "lttng-tools-2.8", "Unsupported by tools"),
- ("lttng-modules-2.7", "lttng-tools-2.9", "Unsupported by module"),
- ("lttng-modules-2.7", "lttng-tools-2.10", "Unsupported by module"),
+ ("lttng-modules-2.7", "lttng-tools-2.9", "Unsupported by modules"),
+ ("lttng-modules-2.7", "lttng-tools-2.10", "Unsupported by modules"),
("lttng-modules-2.8", "lttng-tools-2.7", "Unsupported by tools"),
("lttng-modules-2.8", "lttng-tools-2.8", "Unsupported by tools"),
("lttng-modules-2.8", "lttng-tools-2.9", "Unsupported by modules"),
# Validate that we have all event base on the current metadata
cp_process, cp_out, cp_err = runtime.run(babeltrace_cmd)
- assert(line_count(cp_out) == nb_events)
+ assert line_count(cp_out) == nb_events
# Empty the metadata file
open(get_metadata_file_path(trace_path), 'w').close()
# TODO: rework this a bit to differentiate each errors and rework how
# the condition are meet
if scenario == "Unsupported by tools" or scenario == "Unsupported by modules":
- with pytest.raises(subprocess.CalledProcessError):
+ if modules_label == "lttng-modules-2.7" and scenario == "Unsupported by modules":
+ # Error from lttng-modules-2.7 is not reported correctly by
+ # sessiond. But it is reported on the sessiond side.
+ # For now, run the command, validate that the error exist on
+ # sessiond side and mark as xfail.
runtime.run("lttng {}".format(command))
+ else:
+ with pytest.raises(subprocess.CalledProcessError):
+ runtime.run("lttng {}".format(command))
# Make sure everything looks good on this side
+ runtime.run("lttng stop")
+ runtime.run("lttng destroy -a")
+ stderr_path = runtime.get_subprocess_stderr_path(sessiond)
sessiond = runtime.subprocess_terminate(sessiond)
- if sessiond.returncode != 0:
- pytest.fail("Return value of sessiond is not zero")
+ if scenario == "Unsupported by modules":
+ error_msg = "Error: Failed to regenerate the kernel metadata"
+ assert file_contains(stderr_path, [error_msg]), "Error message missing"
+ if modules_label == "lttng-modules-2.7" and scenario == "Unsupported by modules":
+ pytest.xfail("Lttng-tools does not bubble up error from unsupported metadata regeneration")
+
return
runtime.run("lttng {}".format(command))
pytest.fail("Return value of sessiond is not zero")
cp_process, cp_out, cp_err = runtime.run(babeltrace_cmd)
- assert(line_count(cp_out) == nb_events)
+ assert line_count(cp_out) == nb_events
@must_be_root