Skip to content

Add core dump extraction from container in docker plugin - #124

Open
Tejaswini-Janjale25 wants to merge 2 commits into
eclipse-score:mainfrom
Tejaswini-Janjale25:tj_itf_test_extract_core_changes
Open

Add core dump extraction from container in docker plugin#124
Tejaswini-Janjale25 wants to merge 2 commits into
eclipse-score:mainfrom
Tejaswini-Janjale25:tj_itf_test_extract_core_changes

Conversation

@Tejaswini-Janjale25

Copy link
Copy Markdown

Add optional core dump extraction from Docker containers on teardown. Generic plugin change, currently used for ITF tests in bigdata.

@Tejaswini-Janjale25
Tejaswini-Janjale25 force-pushed the tj_itf_test_extract_core_changes branch from 1bdd4a4 to 6f63983 Compare July 21, 2026 10:23
@Tejaswini-Janjale25
Tejaswini-Janjale25 marked this pull request as ready for review July 21, 2026 10:25
Comment thread score/itf/plugins/docker.py Outdated
"--extract-core",
action="store_true",
default=False,
help="Extract core dump files from the container before teardown.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message can be improved e.g. help="Directory where extracted core dumps are stored.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the message

return

for remote_path in core_paths:
local_path = os.path.join(output_base, remote_path.lstrip("/"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check Path.is_dir() before attempting extraction?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a check — if the given output directory isn't a valid directory, we log a warning and skip extraction instead of trying to download into an invalid path.

@Tejaswini-Janjale25
Tejaswini-Janjale25 force-pushed the tj_itf_test_extract_core_changes branch from 6f63983 to 88da2c0 Compare July 23, 2026 04:53

@draganbjedov draganbjedov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using core is bad. It does not clearly states what is core. Instead core-dumps

Comment thread score/itf/plugins/qemu/__init__.py Outdated
)
parser.addoption("--qemu-image", action="store", help="Path to a QEMU image")
parser.addoption(
"--extract-core",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"--extract-core",
"--extract-core-dump",

Comment thread score/itf/plugins/qemu/__init__.py Outdated
help="Copy core dump files from the QEMU target to the host before teardown.",
)
parser.addoption(
"--core-output-dir",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"--core-output-dir",
"--core-dump-output-dir",

Comment thread score/itf/plugins/qemu/__init__.py Outdated
"--core-output-dir",
default=os.path.join(
os.environ.get("TEST_UNDECLARED_OUTPUTS_DIR", "/tmp"),
"cores",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"cores",
"coredumps",

Comment thread score/itf/plugins/qemu/__init__.py Outdated

def _extract_cores_from_qemu(target, output_base):
"""Extract core dump files from a QEMU (QNX) target via SSH/SFTP."""
logger.info(f"Attempting core extraction to {output_base}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.info(f"Attempting core extraction to {output_base}")
logger.info(f"Attempting core dumps extraction to {output_base}")

Comment thread score/itf/plugins/qemu/__init__.py Outdated
" && (ls -1 /opt/*/*.core /opt/*/*.core.gz /root/*.core /root/*.core.gz /data/*/*.core /data/*/*.core.gz 2>/dev/null || true)"
)

core_paths = [line.strip() for line in output.decode().splitlines() if line.strip()]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
core_paths = [line.strip() for line in output.decode().splitlines() if line.strip()]
coredumps_paths = [line.strip() for line in output.decode().splitlines() if line.strip()]

Comment thread score/itf/plugins/BUILD Outdated
)

config_setting(
name = "extract_core_enabled",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "extract_core_enabled",
name = "extract_core_dump_enabled",

Comment thread score/itf/plugins/BUILD Outdated
# docker plugin falls back to $TEST_UNDECLARED_OUTPUTS_DIR/cores.
# Set with: bazel test --//score/itf/plugins:core_output_dir=/abs/path
string_flag(
name = "core_output_dir",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "core_output_dir",
name = "core_dumps_output_dir",

Comment thread score/itf/plugins/docker.py Outdated
"Defaults to $TEST_UNDECLARED_OUTPUTS_DIR/sysroot or /tmp/sysroot.",
)
parser.addoption(
"--extract-core",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"--extract-core",
"--extract-core-dumps",

Comment thread score/itf/plugins/docker.py Outdated
help="Copy core dump files from the container to the host before teardown.",
)
parser.addoption(
"--core-output-dir",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"--core-output-dir",
"--core-dumps-output-dir",

Comment thread score/itf/plugins/docker.py Outdated
logger.warning(f"Failed to extract {remote_path}", exc_info=True)


def _extract_core_from_container(target, output_base):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _extract_core_from_container(target, output_base):
def _extract_core_dumps_from_container(target, output_base):

@Tejaswini-Janjale25
Tejaswini-Janjale25 force-pushed the tj_itf_test_extract_core_changes branch from 16a96e2 to 8cd262d Compare August 12, 2026 12:38
@Tejaswini-Janjale25
Tejaswini-Janjale25 force-pushed the tj_itf_test_extract_core_changes branch from 8cd262d to 5d81f97 Compare August 12, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants