TestMain.cpp 647 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Andrew Kaster <akaster@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibTest/TestCase.h>
  8. #include <AK/Format.h>
  9. #include <LibTest/TestSuite.h>
  10. #ifdef KERNEL
  11. # define TEST_MAIN test_main
  12. #else
  13. # define TEST_MAIN main
  14. #endif
  15. int TEST_MAIN(int argc, char** argv)
  16. {
  17. if (argc < 1 || !argv[0] || '\0' == *argv[0]) {
  18. warnln("Test main does not have a valid test name!");
  19. return 1;
  20. }
  21. int ret = ::Test::TestSuite::the().main(argv[0], argc, argv);
  22. ::Test::TestSuite::release();
  23. return ret;
  24. }