Magnetometer self test