test/test_spawn: use sync instead of sleeping