Skip to content

Commit

Permalink
Updating CI with macOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit1603 committed Sep 17, 2023
1 parent 6908546 commit ca4e59c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
paths:
- '**.h'
- '**.cpp'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
Expand Down
26 changes: 20 additions & 6 deletions unittests/CppInterOp/FunctionReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,11 @@ TEST(FunctionReflectionTest, IsStaticMethod) {
EXPECT_TRUE(Cpp::IsStaticMethod(SubDecls[2]));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_GetFunctionAddress) {
#else
TEST(FunctionReflectionTest, GetFunctionAddress) {
#endif
std::vector<Decl*> Decls, SubDecls;
std::string code = "int f1(int i) { return i * i; }";

Expand All @@ -537,7 +540,6 @@ TEST(FunctionReflectionTest, GetFunctionAddress) {
address << Cpp::GetFunctionAddress(Decls[0]);
EXPECT_EQ(address.str(), output);
}
#endif

TEST(FunctionReflectionTest, IsVirtualMethod) {
std::vector<Decl*> Decls, SubDecls;
Expand All @@ -558,8 +560,11 @@ TEST(FunctionReflectionTest, IsVirtualMethod) {
EXPECT_FALSE(Cpp::IsVirtualMethod(SubDecls[3])); // y()
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_JitCallAdvanced) {
#else
TEST(FunctionReflectionTest, JitCallAdvanced) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
typedef struct _name {
Expand All @@ -580,7 +585,11 @@ TEST(FunctionReflectionTest, JitCallAdvanced) {
Cpp::Destruct(object, Decls[1]);
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_GetFunctionCallWrapper) {
#else
TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
int f1(int i) { return i * i; }
Expand Down Expand Up @@ -661,7 +670,6 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
output = testing::internal::GetCapturedStdout();
EXPECT_EQ(output, "Dtor Called\n");
}
#endif

TEST(FunctionReflectionTest, IsConstMethod) {
std::vector<Decl*> Decls, SubDecls;
Expand Down Expand Up @@ -716,8 +724,11 @@ TEST(FunctionReflectionTest, GetFunctionArgDefault) {
EXPECT_EQ(Cpp::GetFunctionArgDefault(Decls[1], 2), "34126");
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Construct) {
#else
TEST(FunctionReflectionTest, Construct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -751,7 +762,11 @@ TEST(FunctionReflectionTest, Construct) {
EXPECT_EQ(output, "Constructor Executed");
}

#ifdef __APPLE__
TEST(FunctionReflectionTest, DISABLED_Destruct) {
#else
TEST(FunctionReflectionTest, Destruct) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -783,4 +798,3 @@ TEST(FunctionReflectionTest, Destruct) {
output = testing::internal::GetCapturedStdout();
EXPECT_EQ(output, "Destructor Executed");
}
#endif
6 changes: 4 additions & 2 deletions unittests/CppInterOp/JitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ static int printf_jit(const char* format, ...) {
return 0;
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(JitTest, DISABLED_InsertOrReplaceJitSymbol) {
#else
TEST(JitTest, InsertOrReplaceJitSymbol) {
#endif
std::vector<Decl*> Decls;
std::string code = R"(
extern "C" int printf(const char*,...);
Expand All @@ -31,7 +34,6 @@ TEST(JitTest, InsertOrReplaceJitSymbol) {
Cpp::InsertOrReplaceJitSymbol("non_existent", (uint64_t)&printf_jit));
EXPECT_TRUE(Cpp::InsertOrReplaceJitSymbol("non_existent", 0));
}
#endif

TEST(Streams, StreamRedirect) {
// printf and etc are fine here.
Expand Down
27 changes: 17 additions & 10 deletions unittests/CppInterOp/ScopeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ TEST(ScopeReflectionTest, SizeOf) {
EXPECT_EQ(Cpp::SizeOf(Decls[7]), (size_t)16);
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IsBuiltin) {
#else
TEST(ScopeReflectionTest, IsBuiltin) {
#endif
// static std::set<std::string> g_builtins =
// {"bool", "char", "signed char", "unsigned char", "wchar_t", "short", "unsigned short",
// "int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long",
Expand Down Expand Up @@ -127,7 +130,6 @@ TEST(ScopeReflectionTest, IsBuiltin) {
for (ClassTemplateSpecializationDecl *CTSD : CTD->specializations())
EXPECT_TRUE(Cpp::IsBuiltin(C.getTypeDeclType(CTSD).getAsOpaquePtr()));
}
#endif

TEST(ScopeReflectionTest, IsTemplate) {
std::vector<Decl *> Decls;
Expand Down Expand Up @@ -410,8 +412,11 @@ TEST(ScopeReflectionTest, GetScopefromCompleteName) {
EXPECT_EQ(Cpp::GetQualifiedName(Cpp::GetScopeFromCompleteName("N1::N2::C::S")), "N1::N2::C::S");
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_GetNamed) {
#else
TEST(ScopeReflectionTest, GetNamed) {
#endif
std::string code = R"(namespace N1 {
namespace N2 {
class C {
Expand Down Expand Up @@ -448,7 +453,6 @@ TEST(ScopeReflectionTest, GetNamed) {
EXPECT_EQ(Cpp::GetQualifiedName(std_string_class), "std::string");
EXPECT_EQ(Cpp::GetQualifiedName(std_string_npos_var), "std::basic_string<char>::npos");
}
#endif

TEST(ScopeReflectionTest, GetParentScope) {
std::string code = R"(namespace N1 {
Expand Down Expand Up @@ -538,7 +542,6 @@ TEST(ScopeReflectionTest, GetNumBases) {
EXPECT_EQ(Cpp::GetNumBases(Decls[5]), 0);
}


TEST(ScopeReflectionTest, GetBaseClass) {
std::vector<Decl *> Decls;
std::string code = R"(
Expand Down Expand Up @@ -708,16 +711,18 @@ TEST(ScopeReflectionTest, InstantiateNNTPClassTemplate) {
/*type_size*/ args1.size()));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_InstantiateTemplateFunctionFromString) {
#else
TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) {
#endif
Cpp::CreateInterpreter();
std::string code = R"(#include <memory>)";
Interp->process(code);
const char* str = "std::make_unique<int,int>";
auto* Instance1 = (Decl*)Cpp::InstantiateTemplateFunctionFromString(str);
EXPECT_TRUE(Instance1);
}
#endif

TEST(ScopeReflectionTest, InstantiateClassTemplate) {
std::vector<Decl *> Decls;
Expand Down Expand Up @@ -850,12 +855,14 @@ TEST(ScopeReflectionTest, GetClassTemplateInstantiationArgs) {
EXPECT_TRUE(instance_types.size() == 0);
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(ScopeReflectionTest, DISABLED_IncludeVector) {
#else
TEST(ScopeReflectionTest, IncludeVector) {
#endif
std::string code = R"(
#include <vector>
#include <iostream>
)";
Interp->process(code);
}
#endif
}
8 changes: 5 additions & 3 deletions unittests/CppInterOp/TypeReflectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,11 @@ TEST(TypeReflectionTest, IsPODType) {
EXPECT_FALSE(Cpp::IsPODType(0));
}

#if !(__clang__ && __APPLE__)
#ifdef __APPLE__
TEST(TypeReflectionTest, DISABLED_IsSmartPtrType) {
#else
TEST(TypeReflectionTest, IsSmartPtrType) {
#endif
Cpp::CreateInterpreter();

Interp->declare(R"(
Expand Down Expand Up @@ -552,5 +555,4 @@ TEST(TypeReflectionTest, IsSmartPtrType) {
EXPECT_TRUE(Cpp::IsSmartPtrType(get_type_from_varname("smart_ptr6")));
EXPECT_FALSE(Cpp::IsSmartPtrType(get_type_from_varname("raw_ptr")));
EXPECT_FALSE(Cpp::IsSmartPtrType(get_type_from_varname("object")));
}
#endif
}

0 comments on commit ca4e59c

Please sign in to comment.