tests: Build core tests only if core is actually being built