erlc: properly reuse the right erl_opts in test_compile

Avoid getting erl_opts twice in test_compile/3, and make sure the
correctly filtered (platform_define, etc.) version is used.