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

Result of running an external command.

Fields
int statusExit status code (0 for success)
string outputStandard output captured from the command
string errorStandard error captured from the command
structTempFile

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 file
bool autoDeleteFlag to control whether the file should be deleted on cleanup
Methods
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

fnbool hasExternalTool(string toolName)Check if an external tool is available in the system PATH.
fnCommandResult runCommand(string[] args)Execute an external command and capture its output.
fnCommandResult runCommandWithOutput(string[] args)Execute an external command and capture stdout and stderr.
fnstring createTempElfFile(const(ubyte)[] data, string prefix = "elftest")Create a temporary ELF file with the given data.
fnvoid cleanupTempFile(string path)Clean up a temporary file.
fnvoid requireTool(string toolName, string message = null)Skip a test if an external tool is not available.