Skip to content

Commit

Permalink
[libc++][AIX] Add OS version to target triple
Browse files Browse the repository at this point in the history
This will allow for configuring tests according to AIX version.

Reviewed By: daltenty, #libc, Mordante

Differential Revision: https://reviews.llvm.org/D149660
  • Loading branch information
jakeegan committed Oct 31, 2023
1 parent 2260ebf commit 4fc7019
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
6 changes: 6 additions & 0 deletions libcxx/test/configs/ibm-libc++-shared.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

import lit.util
if lit.util.isAIXTriple(config.target_triple):
# Add the AIX version to the triple here because there currently isn't a good
# way to retrieve the AIX version in the driver.
config.target_triple = lit.util.addAIXVersion(config.target_triple)

config.substitutions.append(('%{flags}', '-pthread'))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -D__LIBC_NO_CPP_MATH_OVERLOADS__ -I %{include} -I %{libcxx}/test/support'
Expand Down
6 changes: 6 additions & 0 deletions libcxxabi/test/configs/ibm-libc++abi-shared.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

import lit.util
if lit.util.isAIXTriple(config.target_triple):
# Add the AIX version to the triple here because there currently isn't a good
# way to retrieve the AIX version in the driver.
config.target_triple = lit.util.addAIXVersion(config.target_triple)

config.substitutions.append(('%{flags}',''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} ' +
Expand Down
6 changes: 6 additions & 0 deletions libunwind/test/configs/ibm-libunwind-shared.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

import lit.util
if lit.util.isAIXTriple(config.target_triple):
# Add the AIX version to the triple here because there currently isn't a good
# way to retrieve the AIX version in the driver.
config.target_triple = lit.util.addAIXVersion(config.target_triple)

config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -I %{include}'
Expand Down
2 changes: 1 addition & 1 deletion libunwind/test/signal_frame.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

// The AIX assembler does not support CFI directives, which
// are necessary to run this test.
// UNSUPPORTED: target=powerpc{{(64)?}}-ibm-aix
// UNSUPPORTED: target={{.*}}-aix{{.*}}

// Windows doesn't generally use CFI directives. However, i686
// mingw targets do use DWARF (where CFI directives are supported).
Expand Down
17 changes: 17 additions & 0 deletions llvm/utils/lit/lit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numbers
import os
import platform
import re
import signal
import subprocess
import sys
Expand Down Expand Up @@ -429,6 +430,22 @@ def killProcess():
return out, err, exitCode


def isAIXTriple(target_triple):
"""Whether the given target triple is for AIX,
e.g. powerpc64-ibm-aix
"""
return "aix" in target_triple


def addAIXVersion(target_triple):
"""Add the AIX version to the given target triple,
e.g. powerpc64-ibm-aix7.2.5.6
"""
os_cmd = "oslevel -s | awk -F\'-\' \'{printf \"%.1f.%d.%d\", $1/1000, $2, $3}\'"
os_version = subprocess.run(os_cmd, capture_output=True, shell=True).stdout.decode()
return re.sub("aix", "aix" + os_version, target_triple)


def isMacOSTriple(target_triple):
"""Whether the given target triple is for macOS,
e.g. x86_64-apple-darwin, arm64-apple-macos
Expand Down

3 comments on commit 4fc7019

@JOE1994
Copy link
Member

@JOE1994 JOE1994 commented on 4fc7019 Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you take a look at the following buildbot failure?

Same tests have been failing since build 8852 up to the latest build 8895.

@jakeegan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JOE1994
Did you verify that my commit caused this? I don't think it's likely because my commit should only affect AIX. It seems more likely that this commit is the cause:
b799080

@JOE1994
Copy link
Member

@JOE1994 JOE1994 commented on 4fc7019 Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the first failing buildbot build (8852), this is the one and only commit listed in the blame list.

I didn't do an isolation myself, but merely read the buildbot failure report.

Please disregard if it's obvious that this is not the offending commit.

Please sign in to comment.