fuzzer_util.h 829 B

123456789101112131415161718192021222324
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_EXPLORER_FUZZING_FUZZER_UTIL_H_
  5. #define CARBON_EXPLORER_FUZZING_FUZZER_UTIL_H_
  6. #include "common/error.h"
  7. #include "explorer/ast/ast.h"
  8. #include "testing/fuzzing/carbon.pb.h"
  9. namespace Carbon::Testing {
  10. // Parses and executes a fuzzer-generated program.
  11. // Returns program result if execution was successful.
  12. auto ParseAndExecuteProto(const Fuzzing::Carbon& carbon) -> ErrorOr<int>;
  13. // Returns a full path for a file under bazel runfiles.
  14. // Exposed for testing.
  15. auto GetRunfilesFile(const std::string& file) -> ErrorOr<std::string>;
  16. } // namespace Carbon::Testing
  17. #endif // CARBON_EXPLORER_FUZZING_FUZZER_UTIL_H_