test: Remove broken mutex optimizations in helper
test: Remove broken mutex optimizations in helper

These optimizations don’t actually improve much, and complicate
things.

They also trigger a serious issue, due to the way gocheck is
implemented. If an Assert fails, it calls runtime.Goexit, which will
terminate the currently running goroutine. While terminating the
goroutine, Goexit unwinds the stack and runs any deferred functions.
In the bad case, Assert will fail while a mutex is unlocked, and
there will be another deferred Unlock, which will trigger a panic.

This panic will not have a complete stack trace due to
golang/go#9404.

The solution is to treat t.Assert as code that looks like:

    if err != nil {
      return
    }

and remember that all deferred functions will be run.

Signed-off-by: Jonathan Rudenberg <3692bfa45759a67d83aedf0045f6cb635a966abf@titanous.com>

kgrz/flynn,lmars/flynn,jzila/flynn,benbjohnson/flynn,flynn/flynn,lmars/flynn,schatt/flynn,GrimDerp/flynn,philiplb/flynn,Brandywine2161/flynn,tonicbupt/flynn,kgrz/flynn,kgrz/flynn,arekkas/flynn,whouses/flynn,justintung/flynn,schatt/flynn,pkdevbox/flynn,ozum/flynn,benbjohnson/flynn,josephglanville/flynn,flynn/flynn,rikur/flynn,whouses/flynn,tonicbupt/flynn,felixrieseberg/flynn,pkdevbox/flynn,felixrieseberg/flynn,justintung/flynn,flynn/flynn,whouses/flynn,clifff/flynn,pkdevbox/flynn,benbjohnson/flynn,mubassirhayat/flynn,technosophos/flynn,technosophos/flynn,tonicbupt/flynn,kgrz/flynn,pkdevbox/flynn,Brandywine2161/flynn,justintung/flynn,josephglanville/flynn,pkdevbox/flynn,jzila/flynn,rikur/flynn,supermario/flynn,tonicbupt/flynn,benbjohnson/flynn,benbjohnson/flynn,Brandywine2161/flynn,lmars/flynn,rikur/flynn,mubassirhayat/flynn,felixrieseberg/flynn,schatt/flynn,jzila/flynn,GrimDerp/flynn,felixrieseberg/flynn,Brandywine2161/flynn,josephglanville/flynn,TribeMedia/flynn,arekkas/flynn,lmars/flynn,rikur/flynn,supermario/flynn,supermario/flynn,ozum/flynn,shads196770/flynn,flynn/flynn,kgrz/flynn,clifff/flynn,philiplb/flynn,kgrz/flynn,schatt/flynn,ozum/flynn,shads196770/flynn,clifff/flynn,jzila/flynn,rikur/flynn,josephglanville/flynn,TribeMedia/flynn,josephglanville/flynn,shads196770/flynn,clifff/flynn,GrimDerp/flynn,arekkas/flynn,TribeMedia/flynn,clifff/flynn,supermario/flynn,whouses/flynn,ozum/flynn,felixrieseberg/flynn,lmars/flynn,whouses/flynn,mubassirhayat/flynn,GrimDerp/flynn,shads196770/flynn,TribeMedia/flynn,jzila/flynn,GrimDerp/flynn,mubassirhayat/flynn,GrimDerp/flynn,jzila/flynn,pkdevbox/flynn,josephglanville/flynn,Brandywine2161/flynn,benbjohnson/flynn,technosophos/flynn,schatt/flynn,supermario/flynn,philiplb/flynn,clifff/flynn,technosophos/flynn,whouses/flynn,justintung/flynn,technosophos/flynn,arekkas/flynn,philiplb/flynn,rikur/flynn,ozum/flynn,schatt/flynn,shads196770/flynn,philiplb/flynn,supermario/flynn,ozum/flynn,shads196770/flynn,arekkas/flynn,TribeMedia/flynn,Brandywine2161/flynn,tonicbupt/flynn,flynn/flynn,TribeMedia/flynn,justintung/flynn,justintung/flynn