Please use %check for such tests. This makes it easy, to bypass them with '--define check\ exit\ 0'; %build or %install would require manual editing of the .spec-file
What is %check? A standard macro? A standard build stage? Or something new? (I don't recall seeing it mentioned in Maximum RPM.)