diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96f8d3e2f..80fe9278d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,9 @@ name: Main on: - pull_request: - branches: [main] + # pull_request: + # branches: [main] push: - branches: [main] + branches: [Mac_Build] release: types: [published] schedule: @@ -21,13 +21,13 @@ jobs: fail-fast: false matrix: include: - - name: ubu22-gcc12-clang-repl-17 - os: ubuntu-latest - compiler: gcc-12 - clang-runtime: '17' - cling: Off - cppyy: Off - extra_cmake_options: '-DLLVM_USE_LINKER=lld' + # - name: ubu22-gcc12-clang-repl-17 + # os: ubuntu-latest + # compiler: gcc-12 + # clang-runtime: '17' + # cling: Off + # cppyy: Off + # extra_cmake_options: '-DLLVM_USE_LINKER=lld' - name: ubu22-gcc9-clang-repl-16 os: ubuntu-22.04 @@ -38,28 +38,28 @@ jobs: coverage: true extra_cmake_options: '-DLLVM_USE_LINKER=lld' - - name: ubu22-gcc9-clang13-cling - os: ubuntu-22.04 - compiler: gcc-9 - clang-runtime: '13' - cling: On - cppyy: Off - extra_cmake_options: '-DLLVM_USE_LINKER=lld' + # - name: ubu22-gcc9-clang13-cling + # os: ubuntu-22.04 + # compiler: gcc-9 + # clang-runtime: '13' + # cling: On + # cppyy: Off + # extra_cmake_options: '-DLLVM_USE_LINKER=lld' - - name: ubu22-gcc9-clang13-cling-cppyy - os: ubuntu-22.04 - compiler: gcc-9 - clang-runtime: '13' - cling: On - cppyy: On - extra_cmake_options: '-DLLVM_USE_LINKER=lld' + # - name: ubu22-gcc9-clang13-cling-cppyy + # os: ubuntu-22.04 + # compiler: gcc-9 + # clang-runtime: '13' + # cling: On + # cppyy: On + # extra_cmake_options: '-DLLVM_USE_LINKER=lld' - - name: osx-clang-clang-repl-16 - os: macos-latest - compiler: clang - clang-runtime: '16' - cling: Off - cppyy: Off + # - name: osx-clang-clang-repl-16 + # os: macos-latest + # compiler: clang + # clang-runtime: '16' + # cling: Off + # cppyy: Off steps: - uses: actions/checkout@v3 @@ -93,6 +93,11 @@ jobs: run: | echo "BUILD_TYPE=Release" >> $GITHUB_ENV echo "CODE_COVERAGE=0" >> $GITHUB_ENV + if [[ "${os}" == "macos*" ]]; then + echo "ncpus=$(sysctl -n hw.physicalcpu)" >> $GITHUB_ENV + else + echo "ncpus=$(nproc --all)" >> $GITHUB_ENV + fi - name: Setup compiler on Linux if: runner.os == 'Linux' @@ -150,21 +155,20 @@ jobs: brew install git gcc gnupg python@3 pip install distro pytest - - name: Restore Cache LLVM/Clang runtime build directory - uses: actions/cache/restore@v3 - id: cache - with: - path: | - llvm-project - ${{ matrix.cling=='On' && 'cling' || '' }} - #key: ...-.x-patch-${{ hashFiles('patches/llvm/*') }} - #key: ${{ env.CLING_HASH }}-${{ env.LLVM_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x - key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }} + # - name: Restore Cache LLVM/Clang runtime build directory + # uses: actions/cache/restore@v3 + # id: cache + # with: + # path: | + # llvm-project + # ${{ matrix.cling=='On' && 'cling' || '' }} + # #key: ...-.x-patch-${{ hashFiles('patches/llvm/*') }} + # #key: ${{ env.CLING_HASH }}-${{ env.LLVM_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x + # key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-patch-${{ hashFiles(format('patches/llvm/clang{0}-*.patch', matrix.clang-runtime)) || 'none' }} - name: Build LLVM/Cling on Unix if the cache is invalid if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }} run: | - os="${{ matrix.os }}" cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]') if [[ "${cling_on}" == "ON" ]]; then git clone --depth=1 https://github.com/root-project/cling.git @@ -176,7 +180,7 @@ jobs: # Apply patches echo "Apply clang${{ matrix.clang-runtime }}-*.patch patches:" - # Adjust the find command for macOS + # Finding patch and applying it patch_dir="../patches/llvm" patch_pattern="clang${{ matrix.clang-runtime }}-*.patch" @@ -199,17 +203,14 @@ jobs: -DCLANG_ENABLE_FORMAT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ ../llvm - if [[ "${os}" == "macos*" ]]; then - cmake --build . --target clang --parallel $(sysctl -n hw.physicalcpu) - cmake --build . --target cling --parallel $(sysctl -n hw.physicalcpu) - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --target gtest_main --parallel $(sysctl -n hw.physicalcpu) - else - cmake --build . --target clang --parallel $(nproc --all) - cmake --build . --target cling --parallel $(nproc --all) - # Now build gtest.a and gtest_main for CppInterOp to run its tests. - cmake --build . --target gtest_main --parallel $(nproc --all) - fi + # cmake --build . --target clang --parallel $(sysctl -n hw.physicalcpu) + # cmake --build . --target cling --parallel $(sysctl -n hw.physicalcpu) + # # Now build gtest.a and gtest_main for CppInterOp to run its tests. + # cmake --build . --target gtest_main --parallel $(sysctl -n hw.physicalcpu) + cmake --build . --target clang --parallel $(sysctl -n hw.physicalcpu) + cmake --build . --target cling --parallel $(sysctl -n hw.physicalcpu) + # Now build gtest.a and gtest_main for CppInterOp to run its tests. + cmake --build . --target gtest_main --parallel $(sysctl -n hw.physicalcpu) else cmake -DLLVM_ENABLE_PROJECTS=clang \ -DLLVM_TARGETS_TO_BUILD="host;NVPTX" \ @@ -220,11 +221,8 @@ jobs: -DCLANG_ENABLE_FORMAT=OFF \ -DCLANG_ENABLE_BOOTSTRAP=OFF \ ../llvm - if [[ "${os}" == "macos*" ]]; then - cmake --build . --target clang clang-repl --parallel $(sysctl -n hw.physicalcpu) - else - cmake --build . --target clang clang-repl --parallel $(nproc --all) - fi + # cmake --build . --target clang clang-repl --parallel $(sysctl -n hw.physicalcpu) + cmake --build . --target clang clang-repl --parallel ${{ env.ncpus }} fi cd ../../ @@ -266,32 +264,27 @@ jobs: export CPPINTEROP_BUILD_DIR=$PWD cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]') if [[ "${cling_on}" == "ON" ]]; then - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DUSE_CLING=ON \ - -DUSE_REPL=OFF \ - -DCling_DIR=$LLVM_BUILD_DIR/tools/cling \ - -DLLVM_DIR=$LLVM_BUILD_DIR \ - -DBUILD_SHARED_LIBS=ON \ - -DCODE_COVERAGE=${CODE_COVERAGE} \ - -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \ + cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DUSE_CLING=ON \ + -DUSE_REPL=OFF \ + -DCling_DIR=$LLVM_BUILD_DIR/tools/cling \ + -DLLVM_DIR=$LLVM_BUILD_DIR \ + -DBUILD_SHARED_LIBS=ON \ + -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ + -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \ ../ else - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DUSE_CLING=OFF \ - -DUSE_REPL=ON \ - -DLLVM_DIR=$LLVM_BUILD_DIR \ - -DBUILD_SHARED_LIBS=ON \ - -DCODE_COVERAGE=${CODE_COVERAGE} \ - -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \ + cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DUSE_CLING=OFF \ + -DUSE_REPL=ON \ + -DLLVM_DIR=$LLVM_BUILD_DIR \ + -DBUILD_SHARED_LIBS=ON \ + -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ + -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR \ ../ fi - os="${{ matrix.os }}" - if [[ "${os}" == "macos*" ]]; then - cmake --build . --target check-cppinterop --parallel $(sysctl -n hw.physicalcpu) - else - cmake --build . --target check-cppinterop --parallel $(nproc --all) - fi + cmake --build . --target check-cppinterop --parallel ${{ env.ncpus }} cppyy_on=$(echo "${{ matrix.cppyy }}" | tr '[:lower:]' '[:upper:]') if [[ ("${cppyy_on}" != "ON") && ("${os}" = "ubuntu*") ]]; then valgrind --track-origins=yes --error-exitcode=1 unittests/CppInterOp/CppInterOpTests 2>&1 >/dev/null diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d32541941..9cb6fc9ce 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -1,11 +1,11 @@ name: clang-format on: - pull_request: - paths: - - '**.h' - - '**.cpp' - + # pull_request: + # paths: + # - '**.h' + # - '**.cpp' + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true diff --git a/.github/workflows/clang-tidy-review-post.yml b/.github/workflows/clang-tidy-review-post.yml index e2bbad058..549a94430 100644 --- a/.github/workflows/clang-tidy-review-post.yml +++ b/.github/workflows/clang-tidy-review-post.yml @@ -1,10 +1,10 @@ name: Post clang-tidy review comments on: - workflow_run: - workflows: ["clang-tidy-review"] - types: - - completed + # workflow_run: + # workflows: ["clang-tidy-review"] + # types: + # - completed permissions: checks: write diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index 0fc15aa21..3fc0366cf 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -1,10 +1,10 @@ name: clang-tidy-review on: - pull_request: - paths: - - '**.h' - - '**.cpp' + # pull_request: + # paths: + # - '**.h' + # - '**.cpp' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} diff --git a/unittests/CppInterOp/FunctionReflectionTest.cpp b/unittests/CppInterOp/FunctionReflectionTest.cpp index 745740502..d0b38c3d2 100644 --- a/unittests/CppInterOp/FunctionReflectionTest.cpp +++ b/unittests/CppInterOp/FunctionReflectionTest.cpp @@ -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 Decls, SubDecls; std::string code = "int f1(int i) { return i * i; }"; @@ -537,7 +540,6 @@ TEST(FunctionReflectionTest, GetFunctionAddress) { address << Cpp::GetFunctionAddress(Decls[0]); EXPECT_EQ(address.str(), output); } -#endif TEST(FunctionReflectionTest, IsVirtualMethod) { std::vector Decls, SubDecls; @@ -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 Decls; std::string code = R"( typedef struct _name { @@ -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 Decls; std::string code = R"( int f1(int i) { return i * i; } @@ -661,7 +670,6 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) { output = testing::internal::GetCapturedStdout(); EXPECT_EQ(output, "Dtor Called\n"); } -#endif TEST(FunctionReflectionTest, IsConstMethod) { std::vector Decls, SubDecls; @@ -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"( @@ -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"( @@ -783,4 +798,3 @@ TEST(FunctionReflectionTest, Destruct) { output = testing::internal::GetCapturedStdout(); EXPECT_EQ(output, "Destructor Executed"); } -#endif diff --git a/unittests/CppInterOp/JitTest.cpp b/unittests/CppInterOp/JitTest.cpp index d679da35b..93edd04a9 100644 --- a/unittests/CppInterOp/JitTest.cpp +++ b/unittests/CppInterOp/JitTest.cpp @@ -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 Decls; std::string code = R"( extern "C" int printf(const char*,...); @@ -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. diff --git a/unittests/CppInterOp/ScopeReflectionTest.cpp b/unittests/CppInterOp/ScopeReflectionTest.cpp index a7114573b..3601e6b1e 100644 --- a/unittests/CppInterOp/ScopeReflectionTest.cpp +++ b/unittests/CppInterOp/ScopeReflectionTest.cpp @@ -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 g_builtins = // {"bool", "char", "signed char", "unsigned char", "wchar_t", "short", "unsigned short", // "int", "unsigned int", "long", "unsigned long", "long long", "unsigned long long", @@ -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 Decls; @@ -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 { @@ -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::npos"); } -#endif TEST(ScopeReflectionTest, GetParentScope) { std::string code = R"(namespace N1 { @@ -538,7 +542,6 @@ TEST(ScopeReflectionTest, GetNumBases) { EXPECT_EQ(Cpp::GetNumBases(Decls[5]), 0); } - TEST(ScopeReflectionTest, GetBaseClass) { std::vector Decls; std::string code = R"( @@ -708,8 +711,11 @@ 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 )"; Interp->process(code); @@ -717,7 +723,6 @@ TEST(ScopeReflectionTest, InstantiateTemplateFunctionFromString) { auto* Instance1 = (Decl*)Cpp::InstantiateTemplateFunctionFromString(str); EXPECT_TRUE(Instance1); } -#endif TEST(ScopeReflectionTest, InstantiateClassTemplate) { std::vector Decls; @@ -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 #include )"; Interp->process(code); -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/unittests/CppInterOp/TypeReflectionTest.cpp b/unittests/CppInterOp/TypeReflectionTest.cpp index d5b931cae..61fb4af18 100644 --- a/unittests/CppInterOp/TypeReflectionTest.cpp +++ b/unittests/CppInterOp/TypeReflectionTest.cpp @@ -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"( @@ -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 +} \ No newline at end of file