ddn.elf.test_utils
Test utility functions for external tool integration.
This module provides utilities for detecting and invoking external tools (readelf, objdump, nm, etc.) in unit tests, along with temporary file management for test data.
Types 2
structCommandResult
Result of running an external command.
Fields
int statusExit status code (0 for success)string outputStandard output captured from the commandstring errorStandard error captured from the commandstructTempFile
RAII wrapper for temporary file management.
This struct ensures temporary files are cleaned up automatically when they go out of scope, even if exceptions occur.
Fields
string pathPath to the temporary filebool autoDeleteFlag to control whether the file should be deleted on cleanupMethods
TempFile create(const(ubyte)[] data, string prefix = "elftest")Create a temporary file from byte data.void cleanup()Clean up the temporary file.Destructors
~thisDestructor ensures cleanup happens automatically.Functions 6
fn
CommandResult runCommandWithOutput(string[] args)Execute an external command and capture stdout and stderr.fn
string createTempElfFile(const(ubyte)[] data, string prefix = "elftest")Create a temporary ELF file with the given data.fn
void requireTool(string toolName, string message = null)Skip a test if an external tool is not available.