South Africa defeats Australia in second cricket test