simpleperf: Detect test environment before running tests

Some tests are sensitive to delays detecting test environment.
So do it before running tests.

Bug: 343174590
Test: run CtsSimpleperfTestCases --gtest_filter=record_cmd.stop_when_no_more_targets
Change-Id: Id0e4a5072fa855ca51748020d01d98d4748bb724
1 file changed