Testing the nature of borehole walls or the formation by using drilling mud or cutting data