[llvm] f892783 - [NFC][llvm-exegesis] Disable tests using preprocessor directives

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 12:13:16 PDT 2023


Author: Aiden Grossman
Date: 2023-06-26T19:12:49Z
New Revision: f8927838fa85587027943c053750c403d88dae1d

URL: https://github.com/llvm/llvm-project/commit/f8927838fa85587027943c053750c403d88dae1d
DIFF: https://github.com/llvm/llvm-project/commit/f8927838fa85587027943c053750c403d88dae1d.diff

LOG: [NFC][llvm-exegesis] Disable tests using preprocessor directives

This patch changes to disabling tests in SubprocessMemoryTest.cpp using
preprocessor directives rather than pulling the file out of the build
using CMake. This is the de facto canonical way to do it in the rest of
the tree as seen in other unittest files such as DwarfDebugInfoTest.cpp.

Added: 
    

Modified: 
    llvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
    llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt b/llvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
index dda63e37f29be..bf8951f3b1148 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
+++ b/llvm/unittests/tools/llvm-exegesis/X86/CMakeLists.txt
@@ -4,27 +4,15 @@ add_llvm_exegesis_unittest_includes(
   ${LLVM_MAIN_SRC_DIR}/tools/llvm-exegesis/lib
   )
 
-set(LLVM_EXEGESIS_X86_UNITTEST_SOURCES
+add_llvm_exegesis_unittest_sources(
   BenchmarkResultTest.cpp
   RegisterAliasingTest.cpp
   SchedClassResolutionTest.cpp
   SnippetFileTest.cpp
   SnippetGeneratorTest.cpp
   SnippetRepetitorTest.cpp
+  SubprocessMemoryTest.cpp
   TargetTest.cpp
-)
-
-# Only compile the subprocess memory unittests on x86_64 linux. They only
-# sense to run on POSIX systems due to the implementations use of the POSIX
-# shared memory APIs and there are currently test failures on certain platforms
-# (s390x/PPC) that need further investigation.
-# TODO(boomanaiden154): Investigate and fix test failures on PPC
-if(LLVM_HOST_TRIPLE MATCHES "^x86_64-.*-linux")
-  list(APPEND LLVM_EXEGESIS_X86_UNITTEST_SOURCES SubprocessMemoryTest.cpp)
-endif()
-
-add_llvm_exegesis_unittest_sources(
-  ${LLVM_EXEGESIS_X86_UNITTEST_SOURCES}
   )
 
 add_llvm_exegesis_unittest_link_components(

diff  --git a/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp
index a7ddd7596825c..9d194b6b247ca 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp
@@ -49,12 +49,24 @@ class SubprocessMemoryTest : public X86TestBase {
   SubprocessMemory SM;
 };
 
+// Some of the tests below are failing on s390x and PPC due to the shared
+// memory calls not working in some cases, so they have been disabled.
+// TODO(boomanaiden154): Investigate and fix this issue on PPC.
+
+#if defined(__powerpc__) || defined(__s390x__)
+TEST_F(SubprocessMemoryTest, DISABLED_OneDefinition) {
+#else
 TEST_F(SubprocessMemoryTest, OneDefinition) {
+#endif
   testCommon({{"test1", {APInt(8, 0xff), 4096, 0}}}, 0);
   checkSharedMemoryDefinition("/0memdef0", 4096, {0xff});
 }
 
+#if defined(__powerpc__) || defined(__s390x__)
+TEST_F(SubprocessMemoryTest, DISABLED_MultipleDefinitions) {
+#else
 TEST_F(SubprocessMemoryTest, MultipleDefinitions) {
+#endif
   testCommon({{"test1", {APInt(8, 0xaa), 4096, 0}},
               {"test2", {APInt(8, 0xbb), 4096, 1}},
               {"test3", {APInt(8, 0xcc), 4096, 2}}},
@@ -64,7 +76,11 @@ TEST_F(SubprocessMemoryTest, MultipleDefinitions) {
   checkSharedMemoryDefinition("/1memdef2", 4096, {0xcc});
 }
 
+#if defined(__powerpc__) || defined(__s390x__)
+TEST_F(SubprocessMemoryTest, DISABLED_DefinitionFillsCompletely) {
+#else
 TEST_F(SubprocessMemoryTest, DefinitionFillsCompletely) {
+#endif
   testCommon({{"test1", {APInt(8, 0xaa), 4096, 0}},
               {"test2", {APInt(16, 0xbbbb), 4096, 1}},
               {"test3", {APInt(24, 0xcccccc), 4096, 2}}},
@@ -77,9 +93,12 @@ TEST_F(SubprocessMemoryTest, DefinitionFillsCompletely) {
   checkSharedMemoryDefinition("/2memdef2", 4096, Test3Expected);
 }
 
-// The test below only works on little endian systems.
-#ifdef __ORDER_LITTLE_ENDIAN__
+// The following test is only supported on little endian systems.
+#if defined(__powerpc__) || defined(__s390x__) || __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+TEST_F(SubprocessMemoryTest, DISABLED_DefinitionEndTruncation) {
+#else
 TEST_F(SubprocessMemoryTest, DefinitionEndTruncation) {
+#endif
   testCommon({{"test1", {APInt(48, 0xaabbccddeeff), 4096, 0}}}, 3);
   std::vector<uint8_t> Test1Expected(512, 0);
   // order is reversed since we're assuming a little endian system.
@@ -106,7 +125,6 @@ TEST_F(SubprocessMemoryTest, DefinitionEndTruncation) {
   }
   checkSharedMemoryDefinition("/3memdef0", 4096, Test1Expected);
 }
-#endif // __ORDER_LITTLE_ENDIAN__
 
 #endif // __linux__
 


        


More information about the llvm-commits mailing list