Test failures for system with no threads

I test libcxx for baremetal targets and I recently saw many test
failures. Upon investigation, it seems that recent config changes have
altered when available_features is populated. This is causing wrong set
of libraries to be linked. Here are more details:

Previously features like 'libcpp-has-no-threads' were added in the
available_features in parse_config_site_and_add_features
which was called before configure_link_flags. So when control reached
LinuxLocalTI.add_cxx_link_flags (called from configure_link_flags),
available_features was already populated. The add_cxx_link_flags could
check whether feature like 'libcpp-has-no-threads' is present or not and
link -lpthread accordingly

After recent changes, the 'available_features' is populated in
newconfig.configure which is called after configure_link_flags. As a
result, when add_cxx_link_flags is called, the 'available_features' is
empty and add_cxx_link_flags always calculates enable_threads to be true.

I assume that enable_threads is true on most systems so thats why this
error was not caught. I was testing with LIBCXX_ENABLE_THREADS set to
false so noticed this error.

I am working on a fix unless someone beats me to it. But would
appreciate if somebody who is more familiar with this area can confirm
that my analysis is correct.



Sorry for the delayed reply. The best way to solve this problem (and all other problems too) is to move away from the classic (legacy) config, and to define how you want to run the test suite yourself from first principles. This should be a lot easier than trying to force the legacy config into doing what you want. You can see an example of doing that here: libcxx/test/configs/libcxx-trunk-shared.cfg.in.

Please reach out if you need help on specifics.