[PATCH] D139215: [ORC][test] Add initial MachOPlatformTest

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 10:56:09 PST 2022


keith created this revision.
keith added reviewers: lhames, dblaikie.
Herald added a subscriber: StephenFan.
Herald added a project: All.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

>From discussion on https://reviews.llvm.org/D130221


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139215

Files:
  llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
  llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp


Index: llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp
===================================================================
--- /dev/null
+++ llvm/unittests/ExecutionEngine/Orc/MachOPlatformTest.cpp
@@ -0,0 +1,25 @@
+//===----------- MachOPlatformTest.cpp -- Tests for MachOPlatform ---------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "OrcTestCommon.h"
+
+#include "llvm/ExecutionEngine/Orc/MachOPlatform.h"
+
+using namespace llvm::orc;
+
+TEST(MachOPlatformTest, InitializerSectionTest) {
+  EXPECT_TRUE(MachOPlatform::isInitializerSection("__DATA", "__mod_init_func"));
+  EXPECT_TRUE(
+      MachOPlatform::isInitializerSection("__DATA", "__objc_classlist"));
+  EXPECT_TRUE(MachOPlatform::isInitializerSection("__DATA", "__objc_selrefs"));
+  EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_proto"));
+  EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_protos"));
+  EXPECT_TRUE(MachOPlatform::isInitializerSection("__TEXT", "__swift5_types"));
+
+  EXPECT_FALSE(MachOPlatform::isInitializerSection("__TEXT", "__text"));
+}
Index: llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
===================================================================
--- llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
+++ llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt
@@ -24,6 +24,7 @@
   JITTargetMachineBuilderTest.cpp
   LazyCallThroughAndReexportsTest.cpp
   LookupAndRecordAddrsTest.cpp
+  MachOPlatformTest.cpp
   MapperJITLinkMemoryManagerTest.cpp
   MemoryMapperTest.cpp
   ObjectLinkingLayerTest.cpp


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139215.479681.patch
Type: text/x-patch
Size: 1819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/f2e62cd5/attachment.bin>


More information about the llvm-commits mailing list