[test] fix some tests on stock OS X and some minor cleanup