Skip to content

Commit

Permalink
[AIX] Enable tests relating to 64-bit XCOFF object files (#71814)
Browse files Browse the repository at this point in the history
We now have 64-bit XCOFF object file support, so these tests can be
enabled again. However, some tests still fail due to unsupported debug
sections, so I cleaned up their comments.
  • Loading branch information
jakeegan committed Nov 10, 2023
1 parent a1e1c24 commit fe83acc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 262 deletions.
37 changes: 0 additions & 37 deletions clang/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,43 +332,6 @@ def calculate_arch_features(arch_string):
config.available_features.add("llvm-driver")


def exclude_unsupported_files_for_aix(dirname):
for filename in os.listdir(dirname):
source_path = os.path.join(dirname, filename)
if os.path.isdir(source_path):
continue
f = open(source_path, "r", encoding="ISO-8859-1")
try:
data = f.read()
# 64-bit object files are not supported on AIX, so exclude the tests.
if (
any(
option in data
for option in (
"-emit-obj",
"-fmodule-format=obj",
"-fintegrated-as",
)
)
and "64" in config.target_triple
):
config.excludes += [filename]
finally:
f.close()


if "aix" in config.target_triple:
for directory in (
"/CodeGenCXX",
"/Misc",
"/Modules",
"/PCH",
"/Driver",
"/ASTMerge/anonymous-fields",
"/ASTMerge/injected-class-name-decl",
):
exclude_unsupported_files_for_aix(config.test_source_root + directory)

# Some tests perform deep recursion, which requires a larger pthread stack size
# than the relatively low default of 192 KiB for 64-bit processes on AIX. The
# `AIXTHREAD_STK` environment variable provides a non-intrusive way to request
Expand Down
28 changes: 0 additions & 28 deletions llvm/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,34 +601,6 @@ def have_ld64_plugin_support():
config.available_features.add("use_msan_with_origins")


def exclude_unsupported_files_for_aix(dirname):
for filename in os.listdir(dirname):
source_path = os.path.join(dirname, filename)
if os.path.isdir(source_path):
continue
f = open(source_path, "r")
try:
data = f.read()
# 64-bit object files are not supported on AIX, so exclude the tests.
if (
"-emit-obj" in data or "-filetype=obj" in data
) and "64" in config.target_triple:
config.excludes += [filename]
finally:
f.close()


if "aix" in config.target_triple:
for directory in (
"/CodeGen/X86",
"/DebugInfo",
"/DebugInfo/X86",
"/DebugInfo/Generic",
"/LTO/X86",
"/Linker",
):
exclude_unsupported_files_for_aix(config.test_source_root + directory)

# Some tools support an environment variable "OBJECT_MODE" on AIX OS, which
# controls the kind of objects they will support. If there is no "OBJECT_MODE"
# environment variable specified, the default behaviour is to support 32-bit
Expand Down
70 changes: 13 additions & 57 deletions llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
#include "gtest/gtest.h"
#include <string>

// AIX doesn't support debug_str_offsets or debug_addr sections
#ifdef _AIX
#define NO_SUPPORT_DEBUG_STR_OFFSETS
#define NO_SUPPORT_DEBUG_ADDR
#endif

using namespace llvm;
using namespace dwarf;
using namespace utils;
Expand Down Expand Up @@ -435,11 +441,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version2Addr4AllForms) {
TestAllForms<2, AddrType, RefAddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version2Addr8AllForms) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version2Addr8AllForms) {
#endif
// Test that we can decode all forms for DWARF32, version 2, with 4 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -457,11 +459,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version3Addr4AllForms) {
TestAllForms<3, AddrType, RefAddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version3Addr8AllForms) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version3Addr8AllForms) {
#endif
// Test that we can decode all forms for DWARF32, version 3, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -479,11 +477,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version4Addr4AllForms) {
TestAllForms<4, AddrType, RefAddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version4Addr8AllForms) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version4Addr8AllForms) {
#endif
// Test that we can decode all forms for DWARF32, version 4, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -492,8 +486,8 @@ TEST(DWARFDebugInfo, TestDWARF32Version4Addr8AllForms) {
TestAllForms<4, AddrType, RefAddrType>();
}

#ifdef _AIX
TEST(DWARFDebigInfo, DISABLED_TestDWARF32Version5Addr4AllForms) {
#ifdef NO_SUPPORT_DEBUG_STR_OFFSETS
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version5Addr4AllForms) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version5Addr4AllForms) {
#endif
Expand All @@ -505,8 +499,8 @@ TEST(DWARFDebugInfo, TestDWARF32Version5Addr4AllForms) {
TestAllForms<5, AddrType, RefAddrType>();
}

#ifdef _AIX
TEST(DWARFDebigInfo, DISABLED_TestDWARF32Version5Addr8AllForms) {
#ifdef NO_SUPPORT_DEBUG_STR_OFFSETS
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version5Addr8AllForms) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version5Addr8AllForms) {
#endif
Expand Down Expand Up @@ -613,11 +607,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version2Addr4Children) {
TestChildren<2, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version2Addr8Children) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version2Addr8Children) {
#endif
// Test that we can decode all forms for DWARF32, version 2, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -631,11 +621,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version3Addr4Children) {
TestChildren<3, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version3Addr8Children) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version3Addr8Children) {
#endif
// Test that we can decode all forms for DWARF32, version 3, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -649,11 +635,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version4Addr4Children) {
TestChildren<4, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version4Addr8Children) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version4Addr8Children) {
#endif
// Test that we can decode all forms for DWARF32, version 4, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand Down Expand Up @@ -875,11 +857,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version2Addr4References) {
TestReferences<2, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version2Addr8References) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version2Addr8References) {
#endif
// Test that we can decode all forms for DWARF32, version 2, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -893,11 +871,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version3Addr4References) {
TestReferences<3, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version3Addr8References) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version3Addr8References) {
#endif
// Test that we can decode all forms for DWARF32, version 3, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -911,11 +885,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version4Addr4References) {
TestReferences<4, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version4Addr8References) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version4Addr8References) {
#endif
// Test that we can decode all forms for DWARF32, version 4, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand Down Expand Up @@ -1059,11 +1029,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version2Addr4Addresses) {
TestAddresses<2, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version2Addr8Addresses) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version2Addr8Addresses) {
#endif
// Test that we can decode address values in DWARF32, version 2, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -1077,11 +1043,7 @@ TEST(DWARFDebugInfo, TestDWARF32Version3Addr4Addresses) {
TestAddresses<3, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version3Addr8Addresses) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version3Addr8Addresses) {
#endif
// Test that we can decode address values in DWARF32, version 3, with 8 byte
// addresses.
typedef uint64_t AddrType;
Expand All @@ -1095,18 +1057,14 @@ TEST(DWARFDebugInfo, TestDWARF32Version4Addr4Addresses) {
TestAddresses<4, AddrType>();
}

#ifdef _AIX
TEST(DWARFDebugInfo, DISABLED_TestDWARF32Version4Addr8Addresses) {
#else
TEST(DWARFDebugInfo, TestDWARF32Version4Addr8Addresses) {
#endif
// Test that we can decode address values in DWARF32, version 4, with 8 byte
// addresses.
typedef uint64_t AddrType;
TestAddresses<4, AddrType>();
}

#ifdef _AIX
#ifdef NO_SUPPORT_DEBUG_STR_OFFSETS
TEST(DWARFDebugInfo, DISABLED_TestStringOffsets) {
#else
TEST(DWARFDebugInfo, TestStringOffsets) {
Expand Down Expand Up @@ -1175,8 +1133,7 @@ TEST(DWARFDebugInfo, TestStringOffsets) {
EXPECT_STREQ(String1, *Extracted3);
}

// AIX does not support string offset section.
#if defined(_AIX)
#ifdef NO_SUPPORT_DEBUG_ADDR
TEST(DWARFDebugInfo, DISABLED_TestEmptyStringOffsets) {
#else
TEST(DWARFDebugInfo, TestEmptyStringOffsets) {
Expand Down Expand Up @@ -1845,8 +1802,7 @@ TEST(DWARFDebugInfo, TestFindAttrs) {
EXPECT_EQ(DieMangled, toString(NameOpt, ""));
}

// AIX does not support debug_addr section.
#if defined(_AIX)
#ifdef NO_SUPPORT_DEBUG_ADDR
TEST(DWARFDebugInfo, DISABLED_TestImplicitConstAbbrevs) {
#else
TEST(DWARFDebugInfo, TestImplicitConstAbbrevs) {
Expand Down

0 comments on commit fe83acc

Please sign in to comment.