2002 subaru forester surges and hesitates

It could be an engine computer problem if nonsense codes come out. Due to a shortage of good head gaskets in Subaru engines, I would wish for a compression test.