This patch adds a new feature to lit. We can now define setup and teardown routines that will be run before the whole test suite starts and after it completes, respectively.
The primary use case for this feature is running std::filesystem tests in libc++ on a remote target. There, we need to copy test inputs to the target machine via SSH, run the tests on those inputs, and then, after all the tests have been run, we need to remove those test inputs from the target machine.
Is suite really the best name here? IIUC a lit invocation can discover multiple test suites but the callbacks in this patch aren't executed when a suite starts/finishes. IIUC the implementation calls the setup calls backs before any tests run and then calls the teardown callbacks after all tests have been executed. In that sense the callbacks are actually global to the entire lit invocation, even though the callbacks originate from a particular suite.
Wouldn't _global_setup_callbacks (or _global_pre_test_callbacks) and _global_teardown_callbacks (or _global_post_test_callbacks) with similar changes elsewhere be a more descriptive name?