Add test_failures stat

Summary: This adds the 'test_failures' stat (a count of the number of failing tests). Additionally it moves all stat aggregation into sync steps.

Reviewers: mattr, bryan

Differential Revision: https://tails.corp.dropbox.com/D49496