test: Support an init/uninit functions for test suites
authorSimon Glass <sjg@chromium.org>
Fri, 7 Feb 2025 18:30:38 +0000 (11:30 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 12 Feb 2025 02:10:58 +0000 (20:10 -0600)
commitc908ecb7b51e886469c4fc8eb5492bdbda55b871
treeb668412c69689e5a9c9ebe4dc762789a9c830a4e
parent63adc40d4c18b3a39df68289cd6cf4d38e8dd5ad
test: Support an init/uninit functions for test suites

Some suites need things to be set up before they can run. Add a way to
declare an init function using the UNIT_TEST_INIT() macro. The init
function is just like any other test, but is always placed first so that
it runs before all the other test functions in the suite.

Add an uninit function as well, to clean up after the test.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/test/test.h
test/test-main.c