How to stop automake from aborting when a test doesn't compile

I'm trying to write unit tests using the default test driver in automake. My project hierarchy is similar to this example:

./
  - ...
  - Makefile.am
  - src/
      - ...
  - tests/test1.cpp
  - tests/test2.cpp

And my Makefile.am resembles this:

...

check_PROGRAMS = tests/test1 \
                 tests/test2

tests_test1_SOURCES = tests/test1.cpp \
                      src/...

tests_test2_SOURCES = tests/test2.cpp \
                      src/...

TESTS = $(check_PROGRAMS)
XFAIL_TESTS = tests/test2

make check then builds the unit tests and runs them, where test2 is expected to fail. This works fine when test2 compiles; however, if test2 fails to compile, then make check exits immediately without outputting any test results. Often, I write unit tests before some expected functionality exists, so they fail to compile; because of this, I would like automake to treat these compilation errors as simple failures, so that they can be reported as an XFAIL instead of shutting down the whole testing procedure.

I read through what appeared to be relevant sections in the automake manual, but couldn't figure it out. Does anyone know how to have automake's testing process do what I want?