Testing
Unit tests
Section titled “Unit tests”cargo test --releaseSeven tests: hashes against published values, date conversion, text classification, the XOR finder, the stack-text finder, the LZMA decoder against UPX’s own tiny sample, and LZMA against NRV2E on real packed files. The last one is skipped when upx-samples\ is absent.
Hidden test modes
Section titled “Hidden test modes”The app has two modes that produce a text report instead of opening a window.
KarakStudio.exe --decompile <file> <report.txt> [function]With no function, runs the C view and graph layout on every function, writes a listing, runs a code search and exercises cross-references, then reports counts: functions converted, too long, crashed, lines produced, gotos, instructions not modelled. With a function name or hex address, also writes that function’s C code.
KarakStudio.exe --compare <A> <B> <report.txt>Opens both files and compares them section by section at the same addresses, then compares imports and function counts. Used to check that a UPX-packed file unpacks to the same code as its original.
The hardening test
Section titled “The hardening test”python fuzz.py target\release\KarakStudio.exe <work folder> [runs per seed] [random seed]Takes a set of real programs, corrupts each in a dozen ways (broken headers, impossible sizes, cut-off files, random bytes as code, thousands of nested jumps, scribbled tables), and runs each result through --decompile with a 20-second limit. It reports files that crash, hang or misbehave and keeps them in <work folder>\bad. Nothing is executed; the corrupted files are only read.
Run it after any change to pe.rs, engine.rs, decomp.rs, upx.rs or triage.rs.
Checking the window
Section titled “Checking the window”There is no automated test of the window. After a change, open a 64-bit and a 32-bit program and click through each view, each look, and whatever you changed.