Files
ghidra-cli/tests/diff_tests.rs
T
Alexander KiselevandClaude Opus 4.5 a1cf872189 feat: Implement all analysis commands with daemon routing
Add complete implementation for all stub commands:
- Symbol operations (list, get, create, rename, delete)
- Type operations (list, get, create, apply)
- Comment operations (list, get, set, delete)
- Graph operations (calls, callers, callees, export)
- Find operations (string, bytes, function, calls, crypto, interesting)
- Diff operations (programs, functions)
- Patch operations (bytes, nop, export)
- Script operations (list, run, python inline)
- Disasm command (disassembly at address)
- Batch operations (execute commands from file)
- Stats command (program statistics)

Fix critical routing bug where new commands fell through to
"Command not yet implemented" instead of being routed to daemon.

Add ExecuteCli IPC command for forwarding CLI commands through daemon.
Add comprehensive integration tests for all new commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 07:08:59 -08:00

61 lines
1.4 KiB
Rust

//! Tests for diff operations.
use assert_cmd::Command;
use predicates::prelude::*;
use serial_test::serial;
#[macro_use]
mod common;
use common::{ensure_test_project, DaemonTestHarness};
const TEST_PROJECT: &str = "diff-test";
const TEST_PROGRAM: &str = "sample_binary";
#[test]
#[serial]
#[ignore] // Requires Ghidra installation
fn test_diff_programs() {
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
let harness = DaemonTestHarness::new(TEST_PROJECT, TEST_PROGRAM)
.expect("Failed to start daemon");
Command::cargo_bin("ghidra")
.unwrap()
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
.arg("diff")
.arg("programs")
.arg(TEST_PROGRAM)
.arg(TEST_PROGRAM)
.arg("--program")
.arg(TEST_PROGRAM)
.assert()
.success()
.stdout(predicate::str::contains("program1"));
drop(harness);
}
#[test]
#[serial]
#[ignore]
fn test_diff_functions() {
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
let harness = DaemonTestHarness::new(TEST_PROJECT, TEST_PROGRAM)
.expect("Failed to start daemon");
Command::cargo_bin("ghidra")
.unwrap()
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
.arg("diff")
.arg("functions")
.arg("--program")
.arg(TEST_PROGRAM)
.assert()
.failure()
.stderr(predicate::str::contains("CLI update"));
drop(harness);
}