Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2019 10:59:01 -0700
From:      Alan Somers <asomers@freebsd.org>
To:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>
Subject:   atf-c++ vs GoogleTest vs share/mk
Message-ID:  <CAOtMX2h_tJHH=mX8wVrMLQNeCsN%2B_D4Jw35KyuiHUcQniNweWg@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
So it turns out to be impossible to use GoogleMock with atf-c++.  The
problem is that atf-c++'s only way to report a test failure is
ATF_FAIL, which immediately terminates the program on failure.  That
conflicts with the way that GoogleMock uses pthreads, which is to
report a failure while a pthread mutex is locked.  atf-c++ has many
other shortcomings, too.  It lacks the ATF_CHECK_* macros, and its
syntax is surprisingly inconsistent with atf-c's.

So I tried writing a C++ program that uses atf-c instead.  But the
Makefiles in share/mk make that a frustrating proposition.  They don't
want C++ programs to link to atf-c, and they don't want atf-c programs
to be built in C++ mode.

Googletest would probably work fine, but I would sorely miss ATF's
test case isolation features.

So what should I do?  Should I fix atf-c++?  That would entail
basically copying over everything from atf-c, which would be a lot of
work.  Or should I hack atf.test.mk to allow C++ programs to use
atf-c?  That would be ugly, but easier.  Or should I just switch to
Googletest, and live with its fragile cleanup handlers?

-Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2h_tJHH=mX8wVrMLQNeCsN%2B_D4Jw35KyuiHUcQniNweWg>