2023-07-06 16:20:46 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
|
|
|
#include "oi/type_graph/DrgnParser.h"
|
|
|
|
|
2023-07-26 15:31:53 +01:00
|
|
|
namespace oi::detail {
|
|
|
|
class SymbolService;
|
|
|
|
}
|
|
|
|
namespace oi::detail::type_graph {
|
2023-07-06 16:20:46 +01:00
|
|
|
class TypeGraph;
|
|
|
|
}
|
|
|
|
struct drgn_type;
|
|
|
|
|
2023-07-26 15:31:53 +01:00
|
|
|
using namespace oi::detail;
|
|
|
|
|
2023-07-06 16:20:46 +01:00
|
|
|
class DrgnParserTest : public ::testing::Test {
|
|
|
|
protected:
|
|
|
|
static void SetUpTestSuite() {
|
|
|
|
symbols_ = new SymbolService{TARGET_EXE_PATH};
|
|
|
|
}
|
|
|
|
|
|
|
|
static void TearDownTestSuite() {
|
|
|
|
delete symbols_;
|
|
|
|
}
|
|
|
|
|
2023-08-16 19:15:09 +01:00
|
|
|
static type_graph::DrgnParser getDrgnParser(
|
|
|
|
type_graph::TypeGraph& typeGraph, type_graph::DrgnParserOptions options);
|
2023-07-06 16:20:46 +01:00
|
|
|
drgn_type* getDrgnRoot(std::string_view function);
|
|
|
|
|
2023-08-16 19:15:09 +01:00
|
|
|
virtual std::string run(std::string_view function,
|
|
|
|
type_graph::DrgnParserOptions options);
|
2023-07-06 16:20:46 +01:00
|
|
|
void test(std::string_view function,
|
|
|
|
std::string_view expected,
|
2023-08-16 19:15:09 +01:00
|
|
|
type_graph::DrgnParserOptions options = {});
|
2023-07-06 16:20:46 +01:00
|
|
|
void testContains(std::string_view function,
|
|
|
|
std::string_view expected,
|
2023-08-16 19:15:09 +01:00
|
|
|
type_graph::DrgnParserOptions options = {});
|
2023-07-06 16:20:46 +01:00
|
|
|
void testMultiCompiler(std::string_view function,
|
|
|
|
std::string_view expectedClang,
|
|
|
|
std::string_view expectedGcc,
|
2023-08-16 19:15:09 +01:00
|
|
|
type_graph::DrgnParserOptions options = {});
|
2023-07-06 16:20:46 +01:00
|
|
|
void testMultiCompilerContains(std::string_view function,
|
|
|
|
std::string_view expectedClang,
|
|
|
|
std::string_view expectedGcc,
|
2023-08-16 19:15:09 +01:00
|
|
|
type_graph::DrgnParserOptions options = {});
|
2023-07-06 16:20:46 +01:00
|
|
|
|
|
|
|
static SymbolService* symbols_;
|
|
|
|
};
|