Files
jsix_import/src/user/test_runner/test_case.cpp
Justin C. Miller 4e5a796e50 [test_runner] Add test_runner program
This change introduces test_runner, which runs unit or integration tests
and then tells the kernel to exit QEMU with a status code indicating the
number of failed tests.

The test_runner program is not loaded by default. Use the test manifest
to enable it:

    ./configure --manifest=assets/manifests/test.yml

A number of tests from the old src/tests have moved over. More to come,
as well as moving code from testapp before getting rid of it.

The test.sh script has been repurposed to be a "headless" version of
qemu.sh for running tests, and it exits with the appropriate exit code.
(Though ./qemu.sh gained the ability to exit with the correct exit code
as well.) Exit codes from kernel panics have been updated so that the
bash scripts should exit with code 127.
2022-02-12 21:30:14 -08:00

33 lines
584 B
C++

#include "test_case.h"
namespace test {
util::vector<fixture*> registry::m_tests;
void
fixture::_log_failure(const char *test_name, const char *message,
const char *function, const char *file, uint64_t line)
{
// TODO: output results
++_test_failure_count;
}
void
registry::register_test_case(fixture &test)
{
m_tests.append(&test);
}
size_t
registry::run_all_tests()
{
size_t failures = 0;
for (auto *test : m_tests) {
test->test_execute();
failures += test->_test_failure_count;
}
return failures;
}
} // namespace test