I also encountered the last problem, it can be handled pretty easily with __attribute__((constructor)):
void (*_test_functions[NTEST_FUNCTIONS])(void);
int _test_function_idx;
#define TEST_FUNCTION(fname) \
void fname(void); \
__attribute__((constructor)) static void _init_ ## fname (void) { \
_test_functions[_test_functions_idx++] = fname; \
} \
void fname()
TEST_FUNCTION(test_foo_bar) {
assert(foo_bar == 0);
}