Updated test lifecycle to run 'make check' and only run if the test flag is set