Skip to content

Adding java code_hotspots test integration#80

Closed
jaidev17 wants to merge 11 commits into
arm:mainfrom
jaidev17:feature/apx-java-hotspots-test
Closed

Adding java code_hotspots test integration#80
jaidev17 wants to merge 11 commits into
arm:mainfrom
jaidev17:feature/apx-java-hotspots-test

Conversation

@jaidev17
Copy link
Copy Markdown
Contributor

@jaidev17 jaidev17 commented May 4, 2026

Add APX code_hotspots integration test for Java workload

Adds an end-to-end integration test that runs apx_recipe_run against a real Java workload (CpuBurner) using the code_hotspots recipe. Also fixes a bug in extract_run_id where hardcoding line index 1 caused failures when Java stderr output was interleaved into the combined output string.

…tput

The previous implementation hardcoded line index 1, which failed for the
Java workload where APX may emit the run_id JSON on a different line or
where _combine_command_output inserts [stderr] content between lines.

Now scans all JSON-looking lines (same pattern as _extract_session_id),
returning the first one that contains a valid run_id.
The cp /tmp/CpuBurnerOriginal.java approach failed because the file is
not present on the remote target at workload execution time - it was only
copied to the runner host, not the SSH target. The original base64 inline
approach is self-contained and does not depend on any pre-staged files.

Also removes the now-unnecessary workflow steps that copied the Java file
to the runner and /tmp.
Copilot AI review requested due to automatic review settings May 4, 2026 21:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an end-to-end integration test that exercises the apx_recipe_run MCP tool against a Java workload (CpuBurner) using the code_hotspots recipe, and makes extract_run_id() more robust to mixed stdout/stderr output.

Changes:

  • Make APX run-id parsing scan for JSON candidates across lines instead of assuming a fixed line index.
  • Add a Java CpuBurner-based APX code_hotspots integration test request and wire it into the existing MCP integration test flow.
  • Update CI integration test workflow to install Java on the runner.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
mcp-local/utils/apx.py Updates run-id extraction to handle interleaved stderr/stdout output more robustly.
mcp-local/tests/test_mcp.py Adds a second APX integration test call that runs the Java CpuBurner workload.
mcp-local/tests/CpuBurnerOriginal.java Introduces the Java workload source used by the new integration test.
mcp-local/tests/constants.py Adds the JSON-RPC request payload and workload command for the Java APX run.
.github/workflows/integration-tests.yml Installs default-jdk-headless on the runner for integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mcp-local/utils/apx.py
Comment on lines 533 to +542
def extract_run_id(output: str) -> str:
if not output:
return ""
try:
data = json.loads(output.split("\n")[1])
return data.get("data", {}).get("run_id", {})
except Exception:
return ""
candidates = [line.strip() for line in output.splitlines() if line.strip().startswith("{")]
for candidate in candidates:
try:
data = json.loads(candidate)
run_id = data.get("data", {}).get("run_id")
if run_id:
return run_id
Comment thread mcp-local/tests/constants.py Outdated
"cmd": (
"which java || (sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends default-jdk-headless); "
"D=$(mktemp -d); "
"cp /workspace/mcp-local/tests/CpuBurnerOriginal.java $D/CpuBurner.java; "
Comment thread mcp-local/tests/constants.py Outdated
"name": "apx_recipe_run",
"arguments": {
"cmd": (
"which java || (sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends default-jdk-headless); "
@@ -0,0 +1,199 @@
// CpuBurner.java
// Orignal un-optimised version workC function is deliberately slow
@jaidev17 jaidev17 closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants