Fix and improve the test script am: 2d69d5680c
am: 8c847cfd14

Change-Id: Icd7ccdf53505ec700a00dab99e3f075dbc819880