CrashTest.h 741 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2019-2020, Shannon Booth <shannon.ml.booth@gmail.com>
  4. * Copyright (c) 2021, Brian Gianforaro <bgianf@serenityos.org>
  5. *
  6. * SPDX-License-Identifier: BSD-2-Clause
  7. */
  8. #pragma once
  9. #include <AK/Function.h>
  10. #include <AK/String.h>
  11. namespace Test {
  12. class Crash {
  13. public:
  14. enum class RunType {
  15. UsingChildProcess,
  16. UsingCurrentProcess,
  17. };
  18. enum class Failure {
  19. DidNotCrash,
  20. UnexpectedError,
  21. };
  22. Crash(String test_type, Function<Crash::Failure()> crash_function);
  23. bool run(RunType run_type = RunType::UsingChildProcess);
  24. private:
  25. String m_type;
  26. Function<Crash::Failure()> m_crash_function;
  27. };
  28. }