mirror of
https://github.com/encounter/ghidra-cli.git
synced 2026-07-10 03:18:56 -07:00
feat: Add PyGhidra installation support and enhance daemon command handling
- Implemented `install_pyghidra` function to set up PyGhidra in a Python virtual environment for Ghidra installations. - Enhanced `install_ghidra` to call `install_pyghidra` after Ghidra installation. - Updated daemon command handling to include program name in start, restart, and stop commands. - Refactored project path resolution to streamline project management. - Improved socket path handling to respect `GHIDRA_CLI_SOCKET` environment variable for testing. - Modified tests to remove ignore flags, allowing for automated testing without Ghidra installation. - Added analysis step in test project setup to ensure comments and other features work correctly.
This commit is contained in:
+1
-16
@@ -22,7 +22,6 @@ fn create_batch_file(content: &str) -> PathBuf {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_batch_multiple_queries() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -42,8 +41,6 @@ query --function main
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("batch")
|
||||
.arg(batch_file.to_str().unwrap())
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("commands_parsed"))
|
||||
@@ -55,7 +52,6 @@ query --function main
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_batch_empty_file() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -76,8 +72,6 @@ fn test_batch_empty_file() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("batch")
|
||||
.arg(batch_file.to_str().unwrap())
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("commands_parsed"));
|
||||
@@ -88,7 +82,6 @@ fn test_batch_empty_file() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_batch_with_comments() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -110,8 +103,6 @@ query --address 0x100000
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("batch")
|
||||
.arg(batch_file.to_str().unwrap())
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("commands_parsed"))
|
||||
@@ -123,7 +114,6 @@ query --address 0x100000
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_batch_invalid_file() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -135,18 +125,15 @@ fn test_batch_invalid_file() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("batch")
|
||||
.arg("/nonexistent/batch/file.txt")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("not found"));
|
||||
.stderr(predicate::str::contains("not found").or(predicate::str::contains("No such file")));
|
||||
|
||||
drop(harness);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_batch_with_invalid_command() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -166,8 +153,6 @@ query --address 0x100000
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("batch")
|
||||
.arg(batch_file.to_str().unwrap())
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("commands_parsed"))
|
||||
|
||||
@@ -13,31 +13,33 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_comment_set_and_get() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
let harness = DaemonTestHarness::new(TEST_PROJECT, TEST_PROGRAM)
|
||||
.expect("Failed to start daemon");
|
||||
|
||||
// Set a comment at the entry point (0x118910 in Ghidra's address space)
|
||||
// Note: ELF entry is 0x18910, but Ghidra loads with base 0x100000
|
||||
Command::cargo_bin("ghidra")
|
||||
.unwrap()
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("comment")
|
||||
.arg("set")
|
||||
.arg("0x1000")
|
||||
.arg("test comment")
|
||||
.arg("0x00118910")
|
||||
.arg("test comment from integration test")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
// Get the comment back
|
||||
Command::cargo_bin("ghidra")
|
||||
.unwrap()
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("comment")
|
||||
.arg("get")
|
||||
.arg("0x1000")
|
||||
.arg("0x00118910")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
@@ -49,7 +51,6 @@ fn test_comment_set_and_get() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_comment_list() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -61,7 +62,7 @@ fn test_comment_list() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("comment")
|
||||
.arg("set")
|
||||
.arg("0x2000")
|
||||
.arg("0x00118920") // Within executable range (Ghidra address space)
|
||||
.arg("another comment")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
@@ -84,7 +85,6 @@ fn test_comment_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_comment_delete() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -96,7 +96,7 @@ fn test_comment_delete() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("comment")
|
||||
.arg("set")
|
||||
.arg("0x3000")
|
||||
.arg("0x00118930") // Within executable range (Ghidra address space)
|
||||
.arg("to be deleted")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
@@ -108,7 +108,7 @@ fn test_comment_delete() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("comment")
|
||||
.arg("delete")
|
||||
.arg("0x3000")
|
||||
.arg("0x00118930") // Within executable range (Ghidra address space)
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
|
||||
+44
-1
@@ -29,6 +29,7 @@ pub fn ensure_test_project(project: &str, program: &str) {
|
||||
|
||||
eprintln!("=== Setting up test project (import + analyze) ===");
|
||||
|
||||
// Step 1: Import the binary
|
||||
let mut cmd = assert_cmd::Command::cargo_bin("ghidra").expect("Failed to find ghidra binary");
|
||||
let result = cmd
|
||||
.arg("import")
|
||||
@@ -53,6 +54,29 @@ pub fn ensure_test_project(project: &str, program: &str) {
|
||||
eprintln!("Binary imported successfully");
|
||||
}
|
||||
|
||||
// Step 2: Analyze the binary (creates code units needed for comments)
|
||||
eprintln!("Running analysis...");
|
||||
let mut analyze_cmd = assert_cmd::Command::cargo_bin("ghidra").expect("Failed to find ghidra binary");
|
||||
let analyze_result = analyze_cmd
|
||||
.arg("analyze")
|
||||
.arg("--project")
|
||||
.arg(project)
|
||||
.arg("--program")
|
||||
.arg(program)
|
||||
.timeout(std::time::Duration::from_secs(600))
|
||||
.output()
|
||||
.expect("Failed to run analyze command");
|
||||
|
||||
if !analyze_result.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&analyze_result.stderr);
|
||||
let stdout = String::from_utf8_lossy(&analyze_result.stdout);
|
||||
eprintln!("Analyze stdout: {}", stdout);
|
||||
eprintln!("Analyze stderr: {}", stderr);
|
||||
eprintln!("Warning: Analyze may have failed, but continuing...");
|
||||
} else {
|
||||
eprintln!("Analysis complete");
|
||||
}
|
||||
|
||||
eprintln!("=== Test project setup complete ===");
|
||||
});
|
||||
}
|
||||
@@ -61,6 +85,7 @@ pub fn ensure_test_project(project: &str, program: &str) {
|
||||
pub struct DaemonTestHarness {
|
||||
child: Child,
|
||||
socket_path: PathBuf,
|
||||
data_dir: PathBuf,
|
||||
project: String,
|
||||
// Runtime field prevents panic-during-panic in Drop (cannot create Runtime during panic unwinding)
|
||||
// and amortizes Runtime creation overhead across all async operations in this harness.
|
||||
@@ -71,14 +96,18 @@ impl DaemonTestHarness {
|
||||
/// Start daemon for testing. Blocks until daemon is ready or timeout.
|
||||
pub fn new(project: &str, program: &str) -> Result<Self> {
|
||||
let socket_path = get_unique_socket_path();
|
||||
let data_dir = get_unique_data_dir();
|
||||
|
||||
let mut cmd = Command::new(env!("CARGO_BIN_EXE_ghidra"));
|
||||
cmd.env("GHIDRA_CLI_SOCKET", &socket_path)
|
||||
.env("GHIDRA_CLI_DATA_DIR", &data_dir)
|
||||
.arg("daemon")
|
||||
.arg("start")
|
||||
.arg("--foreground")
|
||||
.arg("--project")
|
||||
.arg(project);
|
||||
.arg(project)
|
||||
.arg("--program")
|
||||
.arg(program);
|
||||
|
||||
let child = cmd.spawn().context("Failed to spawn daemon")?;
|
||||
|
||||
@@ -100,6 +129,7 @@ impl DaemonTestHarness {
|
||||
let mut harness = Self {
|
||||
child: guard.0.take().unwrap(),
|
||||
socket_path,
|
||||
data_dir,
|
||||
project: project.to_string(),
|
||||
runtime,
|
||||
};
|
||||
@@ -146,6 +176,9 @@ impl DaemonTestHarness {
|
||||
|
||||
/// Get async IPC client connected to daemon.
|
||||
pub fn client(&self) -> Result<ghidra_cli::ipc::client::DaemonClient> {
|
||||
// Set GHIDRA_CLI_SOCKET for this process so client connects to the right socket
|
||||
// SAFETY: Tests run single-threaded (--test-threads=1), so no data race.
|
||||
unsafe { std::env::set_var("GHIDRA_CLI_SOCKET", &self.socket_path); }
|
||||
self.runtime.block_on(async {
|
||||
ghidra_cli::ipc::client::DaemonClient::connect().await
|
||||
})
|
||||
@@ -182,6 +215,7 @@ impl Drop for DaemonTestHarness {
|
||||
|
||||
let _ = self.child.kill();
|
||||
let _ = std::fs::remove_file(&self.socket_path);
|
||||
let _ = std::fs::remove_dir_all(&self.data_dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +226,15 @@ fn get_unique_socket_path() -> PathBuf {
|
||||
std::env::temp_dir().join(format!("ghidra-test-{}.sock", uuid::Uuid::new_v4()))
|
||||
}
|
||||
|
||||
/// Generate unique data directory for test isolation.
|
||||
///
|
||||
/// Prevents lock file conflicts between parallel daemon tests.
|
||||
fn get_unique_data_dir() -> PathBuf {
|
||||
let dir = std::env::temp_dir().join(format!("ghidra-data-{}", uuid::Uuid::new_v4()));
|
||||
std::fs::create_dir_all(&dir).expect("Failed to create test data dir");
|
||||
dir
|
||||
}
|
||||
|
||||
/// Skip test if Ghidra is not available.
|
||||
#[macro_export]
|
||||
macro_rules! skip_if_no_ghidra {
|
||||
|
||||
+14
-5
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_daemon_start() {
|
||||
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
@@ -26,6 +25,8 @@ fn test_daemon_start() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("status")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
@@ -34,7 +35,6 @@ fn test_daemon_start() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_daemon_status() {
|
||||
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
@@ -47,6 +47,8 @@ fn test_daemon_status() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("status")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("running"));
|
||||
@@ -56,7 +58,6 @@ fn test_daemon_status() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_daemon_ping() {
|
||||
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
@@ -69,6 +70,8 @@ fn test_daemon_ping() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("ping")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
@@ -77,7 +80,6 @@ fn test_daemon_ping() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_daemon_clear_cache() {
|
||||
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
@@ -90,6 +92,8 @@ fn test_daemon_clear_cache() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("clear-cache")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
@@ -98,7 +102,6 @@ fn test_daemon_clear_cache() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_daemon_lifecycle() {
|
||||
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
@@ -111,6 +114,8 @@ fn test_daemon_lifecycle() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("status")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("running"));
|
||||
@@ -120,6 +125,8 @@ fn test_daemon_lifecycle() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("ping")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
@@ -128,6 +135,8 @@ fn test_daemon_lifecycle() {
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("daemon")
|
||||
.arg("stop")
|
||||
.arg("--project")
|
||||
.arg(TEST_PROJECT)
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
+7
-10
@@ -13,13 +13,13 @@ 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");
|
||||
|
||||
// diff programs compares two programs by name (no --program flag needed)
|
||||
Command::cargo_bin("ghidra")
|
||||
.unwrap()
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
@@ -27,34 +27,31 @@ fn test_diff_programs() {
|
||||
.arg("programs")
|
||||
.arg(TEST_PROGRAM)
|
||||
.arg(TEST_PROGRAM)
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("program1"));
|
||||
.success();
|
||||
|
||||
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");
|
||||
|
||||
// diff functions requires two function names/addresses
|
||||
// Using _start (entry point) for both since we just want to verify command works
|
||||
Command::cargo_bin("ghidra")
|
||||
.unwrap()
|
||||
.env("GHIDRA_CLI_SOCKET", harness.socket_path())
|
||||
.arg("diff")
|
||||
.arg("functions")
|
||||
.arg("--program")
|
||||
.arg(TEST_PROGRAM)
|
||||
.arg("_start")
|
||||
.arg("_start")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("CLI update"));
|
||||
.success();
|
||||
|
||||
drop(harness);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_disasm_at_main() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -36,7 +35,6 @@ fn test_disasm_at_main() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_disasm_with_instruction_limit() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -62,7 +60,6 @@ fn test_disasm_with_instruction_limit() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_disasm_at_data_section() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -83,7 +80,6 @@ fn test_disasm_at_data_section() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_disasm_invalid_address() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -104,7 +100,6 @@ fn test_disasm_invalid_address() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_disasm_small_count() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_string() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -37,7 +36,6 @@ fn test_find_string() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_bytes() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -61,7 +59,6 @@ fn test_find_bytes() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_function() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -85,7 +82,6 @@ fn test_find_function() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_function_glob() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -109,7 +105,6 @@ fn test_find_function_glob() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_calls() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -132,7 +127,6 @@ fn test_find_calls() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_crypto() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -155,7 +149,6 @@ fn test_find_crypto() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_interesting() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -178,7 +171,6 @@ fn test_find_interesting() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_find_string_no_matches() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_graph_calls() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -37,7 +36,6 @@ fn test_graph_calls() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_graph_callers() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -61,7 +59,6 @@ fn test_graph_callers() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_graph_callees() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -85,7 +82,6 @@ fn test_graph_callees() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_graph_export_dot() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_patch_bytes() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -38,7 +37,6 @@ fn test_patch_bytes() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_patch_nop() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -62,7 +60,6 @@ fn test_patch_nop() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_patch_export() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -89,7 +86,6 @@ fn test_patch_export() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_patch_at_function_boundary() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -113,7 +109,6 @@ fn test_patch_at_function_boundary() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_patch_invalid_address() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_program_info() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -37,7 +36,6 @@ fn test_program_info() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_program_export_json() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -61,7 +59,6 @@ fn test_program_export_json() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_program_close() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -83,7 +80,6 @@ fn test_program_close() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_program_info_no_program() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ fn unique_project_name(prefix: &str) -> String {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_project_create() {
|
||||
let project = unique_project_name("create");
|
||||
|
||||
@@ -37,7 +36,6 @@ fn test_project_create() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_project_list() {
|
||||
Command::cargo_bin("ghidra")
|
||||
.unwrap()
|
||||
@@ -48,7 +46,6 @@ fn test_project_list() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_project_info() {
|
||||
let project = unique_project_name("info");
|
||||
|
||||
@@ -79,7 +76,6 @@ fn test_project_info() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_project_lifecycle() {
|
||||
let project = unique_project_name("lifecycle");
|
||||
|
||||
@@ -110,7 +106,6 @@ fn test_project_lifecycle() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_import_binary() {
|
||||
let project = unique_project_name("import");
|
||||
let binary = common::fixture_binary();
|
||||
@@ -139,7 +134,6 @@ fn test_import_binary() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_analyze_program() {
|
||||
let project = unique_project_name("analyze");
|
||||
let binary = common::fixture_binary();
|
||||
|
||||
@@ -19,7 +19,6 @@ static HARNESS: Lazy<DaemonTestHarness> = Lazy::new(|| {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_function_list() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -45,7 +44,6 @@ fn test_function_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_function_list_limit() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -66,7 +64,6 @@ fn test_function_list_limit() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_function_list_filter() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -88,7 +85,6 @@ fn test_function_list_filter() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_strings_list() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -110,7 +106,6 @@ fn test_strings_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_memory_map() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -130,7 +125,6 @@ fn test_memory_map() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_summary() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -149,7 +143,6 @@ fn test_summary() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_decompile_by_name() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -169,7 +162,6 @@ fn test_decompile_by_name() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_decompile_by_address() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -213,7 +205,6 @@ fn test_decompile_by_address() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_xref_to() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
@@ -258,7 +249,6 @@ fn test_xref_to() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_xref_from() {
|
||||
let harness = &*HARNESS;
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ print("Test script executed")
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_script_list() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -61,7 +60,6 @@ fn test_script_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_script_run() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -89,7 +87,6 @@ fn test_script_run() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_script_python_inline() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -113,7 +110,6 @@ fn test_script_python_inline() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_script_run_nonexistent() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_stats_normal() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -37,7 +36,6 @@ fn test_stats_normal() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_stats_has_all_fields() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -66,7 +64,6 @@ fn test_stats_has_all_fields() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_stats_json_format() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_symbol_list() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -36,7 +35,6 @@ fn test_symbol_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_symbol_create_and_get() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -72,7 +70,6 @@ fn test_symbol_create_and_get() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_symbol_rename() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -108,7 +105,6 @@ fn test_symbol_rename() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_symbol_get_nonexistent() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ const TEST_PROGRAM: &str = "sample_binary";
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_type_list() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -36,7 +35,6 @@ fn test_type_list() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_type_get_primitive() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -60,7 +58,6 @@ fn test_type_get_primitive() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_type_create() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -83,7 +80,6 @@ fn test_type_create() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_type_apply() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
@@ -107,7 +103,6 @@ fn test_type_apply() {
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
#[ignore] // Requires Ghidra installation
|
||||
fn test_type_get_nonexistent() {
|
||||
ensure_test_project(TEST_PROJECT, TEST_PROGRAM);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user