Files
carbon-lang/explorer/fuzzing/fuzzer_util.h
T
Jon Ross-Perkins b1ee45c1e4 Extract ParseAndExecute as its own library. (#2813)
Currently ParseAndExecute-style logic is done in main.cpp and a test. #2799 is adding another test that needs it, as is #2811.

Also more clearly marks fuzzing as testing.

This is being extracted out of #2799 in order to try unblocking progress while review continues.
2023-05-12 08:00:43 -07:00

25 lines
828 B
C++

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