Mali edged out Tunisia on penalties to move into the quarters of the tournament in Morocco, while Senegal beat Sudan 3-1 to advance in the continental showpiece.