Toolchain: rework tests build.

Handle test build with the new toolchain.