Fixed Rake tasks so they reports failures properly

Bug: 47042
Change-Id: Ic95f9dcfbc4a2b36db404b1bd228fdd9b89f34bf