Repository navigation
Description
Summary
Create a comprehensive test infrastructure with sample binary files covering all supported formats (ELF, PE, Mach-O) to enable integration testing of the binary analyzer.
Context
StringyMcStringFace currently has strong foundational parsers for ELF, PE, and Mach-O formats via goblin, but lacks integration tests with real binary fixtures. As the string extraction, semantic classification, and ranking systems are being developed, we need a robust test framework to validate:
- Section classification accuracy across formats
- String extraction from different sections (.rodata, .rdata, __cstring, etc.)
- UTF-8 and UTF-16 handling in PE binaries
- Import/export symbol extraction
- Cross-platform compatibility
Without proper test fixtures, we cannot validate the analyzer's behavior against real-world binaries or catch regressions as new features are added.
Proposed Solution
1. Directory Structure
tests/
├── fixtures/
│ ├── elf/
│ │ ├── simple_hello_x64
│ │ ├── simple_hello_arm64
│ │ └── with_rodata_strings
│ ├── pe/
│ │ ├── simple_hello_x64.exe
│ │ ├── with_utf16_strings.exe
│ │ └── with_resources.exe
│ ├── macho/
│ │ ├── simple_hello_x64
│ │ ├── simple_hello_arm64
│ │ └── with_cstring_section
│ └── README.md # Documentation of each fixture
├── integration/
│ ├── test_format_detection.rs
│ ├── test_section_classification.rs
│ └── test_string_extraction.rs
└── common/
└── mod.rs # Shared test utilities
2. Binary Fixtures Requirements
Each test binary should be minimal but contain known string patterns:
ELF Binaries:
- Simple hello world with strings in .rodata
- Known function names for import testing
- Various string encodings
PE Binaries:
- UTF-16LE strings in .rdata section
- Version info resources
- Import table with known DLLs
- Optional: manifest resources
Mach-O Binaries:
- Strings in __cstring section
- Both x86_64 and arm64 architectures
- Known dylib imports
3. Test Binary Creation
Use simple C/Rust programs compiled with known strings:
// example_fixture.c
const char* url = "https://api.example.com/v1/";
const char* path = "/usr/local/bin/stringy";
const char* guid = "{12345678-1234-1234-1234-123456789abc}";
int main() {
printf("Test binary for StringyMcStringFace\n");
return 0;
}Compile for each platform:
- Linux:
gcc -o tests/fixtures/elf/with_rodata_strings example_fixture.c - Windows: Cross-compile or build on Windows target
- macOS:
clang -o tests/fixtures/macho/with_cstring_section example_fixture.c
4. Integration Test Framework
Create tests that:
- Load each fixture
- Verify format detection
- Validate section classification
- Extract strings and compare against known values
- Test that offsets and RVAs are calculated correctly
5. Documentation
Create tests/fixtures/README.md documenting:
- What each binary contains
- Expected strings and their locations
- How to regenerate binaries if needed
- Checksums for integrity verification
Acceptance Criteria
-
tests/fixtures/directory structure created with subdirectories for each format - At least one test binary for each format (ELF, PE, Mach-O)
- Each fixture contains documented known strings at known offsets
- Integration tests can load and parse each fixture successfully
- Tests verify format detection works correctly
- Tests verify section classification for each format
- README.md documents all fixtures with expected contents
- Tests pass in CI/CD pipeline
- Fixtures are committed to git (or documented build process for local generation)
Related Components
- Binary format detection (goblin integration)
- Section classification system
- String extraction engines (to be tested once implemented)
- Container parsers for ELF, PE, Mach-O
Task-ID
stringy-analyzer/basic-test-infrastructure
Activity
unclesp1d3r commentedon Sep 30, 2025
@coderabbitai Enhance this issue body with additional context and a proposed solution. Improve the issue title and assign the proper labels and other metadata.
[-]Basic Test Infrastructure[/-][+]Establish Test Infrastructure with Multi-Format Binary Fixtures[/+]coderabbitai commentedon Sep 30, 2025
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 7239
@unclesp1d3r, I'll enhance this issue with additional context and a proposed solution. Let me update it now.
🏁 Script executed:
Length of output: 237
@unclesp1d3r, I've successfully enhanced issue #34! Here's what was updated:
Changes Made
✅ Title Updated:
✅ Body Enhanced with:
I attempted to add a
priority:mediumlabel, but it doesn't exist in your repository. The existing labels are already well-suited for this issue:area:analyzer- Correct componenttype:enhancement- Correct typestatus:backlog- Current statuslang:rust- Implementation languageneeds:tests- Ironically appropriate since this issue is about creating tests!You can view the enhanced issue here: #34
If you'd like to add priority labels to your repository, you can create them through the GitHub UI under Issues → Labels, or let me know if you'd like me to create a priority label system for you.
🐰
unclesp1d3r commentedon Jul 4, 2026
Implemented: multi-format fixtures (ELF/PE/Mach-O) under tests/fixtures/ generated by 'just gen-fixtures'. Closing as completed.