[lldb] Make the lit configuration values optional for the API tests
authorJonas Devlieghere <jonas@devlieghere.com>
Sat, 29 Aug 2020 01:05:01 +0000 (18:05 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Sat, 29 Aug 2020 01:08:22 +0000 (18:08 -0700)
commit3f2fb0132f7b09e1309e8f7e0b5ba8ea471b17e7
treea786cb3ee0df7392a6ca37845daba4e1831904a9
parent0231a4e5bd00785abea35b804d504a6cf4c4e464
[lldb] Make the lit configuration values optional for the API tests

LIT uses a model where the test suite is configurable trough a
lit.site.cfg file. Most of the time we use the lit.site.cfg with values
that match the current build configuration, generated by CMake.

Nothing prevents you from running the test suite with a different
configuration, either by overriding some of these values from the
command line, or by passing a different lit.site.cfg.

The latter is currently tedious. Many configuration values are optional
but they still need to be set because lit.cfg.py is accessing them
directly. This patch changes the code to use getattr to return the
attribute if it exists. This makes it possible to specify a minimal
lit.site.cfg with only the mandatory/desired configuration values.

Differential revision: https://reviews.llvm.org/D86821
lldb/test/API/lit.cfg.py
lldb/test/API/lldbtest.py