On 11/26/2015 05:37 AM, Bernd Schmidt wrote:
On 11/25/2015 11:47 PM, David Malcolm wrote:
FWIW, the reason I special-cased the linked list was to avoid any
dynamic memory allocation: the ctors run before main, so I wanted to
keep them as simple as possible.
Is there any particular reason for this? C++ doesn't disallow memory
allocation in global constructors, does it?
I'm not aware of any such restriction, but I'm not a C++ guru.
David, what's the reason for avoiding dynamic memory allocation here?
I do want some level of determinism over test ordering, for the sake of
everyone's sanity. It's probably simplest to either hardcode the order,
or have priority levels. I favor the former (and right now am leaning
towards a very explicit no-magic approach with no auto-registration,
given the linker issues I've been seeing with auto-registration).
I guess that works too. Certainly explicit function calls are
preferrable over #including other C files as a workaround for such a
problem.
My problem with priorities is that it's really just a poor man's
substitution for dependency analysis. And in my experience, it usually
fails.
I still wish others would chime in on the rest of the issues we've
discussed (run to first failure vs. providing elaborate test summaries),
I want to make my preference clear but I don't want to dictate it.
I favor run-all over run-to-first-failure as long as we don't have good
dependency analysis to order the tests. That in turn tends to imply
that each test ought to have a pass/fail indicator.
If we had good dependency analysis, then run-to-first-failure would be
my preference.
Jeff