How do you build an optimized build of the unit tests? That is, I want to do a dub build equivalent to dmd -unittest -O -inline (possibly also -debug).

dub test --build=release and dub test --build=release-debug don't include the -unittest flag, and therefore don't actually run any unit tests. The other build values don't seem relevant or don't optimize.