Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cce36b93f | ||
|
|
2b6d2f1ad2 |
25 changed files with 130 additions and 224 deletions
|
|
@ -12,10 +12,3 @@ repos:
|
|||
rev: 1.32.2
|
||||
hooks:
|
||||
- id: tmt-lint
|
||||
|
||||
- repo: https://github.com/koalaman/shellcheck-precommit
|
||||
rev: v0.10.0
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
require_serial: true # Podman has trouble running concurrently
|
||||
args: ["--exclude=SC1091"] # Ignore "Not following" sourced scripts
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ extra-nitrate: TC#0614126
|
|||
adjust+:
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- clang-tools-extra
|
||||
- clang18-tools-extra
|
||||
when: "collection is not defined"
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
set -ex pipefail
|
||||
|
||||
cflags=$(rpm -D '%toolchain clang' -E '%{build_cflags}')
|
||||
cxxflags=$(rpm -D '%toolchain clang' -E '%{build_cxxflags}')
|
||||
ldflags=$(rpm -D '%toolchain clang' -E '%{build_ldflags}')
|
||||
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
||||
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
||||
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
||||
|
||||
|
||||
# Test a c program
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -eux
|
||||
#!/bin/sh -eux
|
||||
|
||||
tmp=$(mktemp -d)
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ tmp=$(mktemp -d)
|
|||
# gcc-toolset-XX, in such case we need to test the compatibility with that one.
|
||||
# We can get that from `clang -v` output.
|
||||
TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||:
|
||||
if [[ "" = "${TOOLSET}" ]]; then
|
||||
if [[ "x" = "x${TOOLSET}" ]]; then
|
||||
GCC="g++"
|
||||
else
|
||||
GCC="scl enable ${TOOLSET} -- g++"
|
||||
|
|
@ -14,13 +14,13 @@ else
|
|||
fi
|
||||
|
||||
# Build the source with GCC, link it with clang
|
||||
${GCC} -c hello.cpp -o "${tmp}/hello.o"
|
||||
clang++ -o "${tmp}"/hello "${tmp}/hello.o"
|
||||
"${tmp}/hello" | grep "Hello world"
|
||||
rm -rf "${tmp:?}"/*
|
||||
${GCC} -c hello.cpp -o ${tmp}/hello.o
|
||||
clang++ -o ${tmp}/hello ${tmp}/hello.o
|
||||
${tmp}/hello | grep "Hello world"
|
||||
rm -rf ${tmp}/*
|
||||
|
||||
# Build the source with clang, link it with GCC
|
||||
clang++ -c hello.cpp -o "${tmp}/hello.o"
|
||||
${GCC} -o "${tmp}"/hello "${tmp}/hello.o"
|
||||
"${tmp}/hello" | grep "Hello world"
|
||||
rm -rf "${tmp:?}"/*
|
||||
clang++ -c hello.cpp -o ${tmp}/hello.o
|
||||
${GCC} -o ${tmp}/hello ${tmp}/hello.o
|
||||
${tmp}/hello | grep "Hello world"
|
||||
rm -rf ${tmp}/*
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ component+:
|
|||
duration: 4h
|
||||
tier: 1
|
||||
require+:
|
||||
- llvm-devel
|
||||
- lld
|
||||
- llvm18-devel
|
||||
- lld18
|
||||
- git
|
||||
- make
|
||||
- gcc
|
||||
|
|
|
|||
|
|
@ -2,17 +2,11 @@
|
|||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
## General configuration variables. Can be overridden via environment
|
||||
## General configuration variables. Can be overriden via environment
|
||||
# Kernel branch to build. Typically ark-latest or os-build.
|
||||
KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"}
|
||||
KERNEL_GIT_URL=${KERNEL_GIT_URL:-"https://gitlab.com/cki-project/kernel-ark.git"}
|
||||
|
||||
## Helper variables to handle cached/generated SRPM
|
||||
CACHE_DIR_BASE="/var/tmp/kernel-"
|
||||
KERNEL_SRPM_PATTERN="kernel-*.src.rpm"
|
||||
# Path to the kernel SRPM to build.
|
||||
KERNEL_SRPM=""
|
||||
|
||||
# Environment variables to configure the kernel build:
|
||||
# * ENABLE_LTO: If set, it will build kernel-ark with clang_lto.
|
||||
# * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode.
|
||||
|
|
@ -22,8 +16,8 @@ CLANG_MODE=${CLANG_MODE:-"--with clang"}
|
|||
BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"}
|
||||
BUILD_MODE=${BUILD_MODE:-"--with base --without debug"}
|
||||
|
||||
# Log installed packages required by TMT
|
||||
logTmtRequiredPackages() {
|
||||
function logTmtRequiredPackages(){
|
||||
# Get the expected packages from TMT metadata requires
|
||||
if [[ ! -e $TMT_TEST_METADATA ]]; then
|
||||
rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt"
|
||||
return
|
||||
|
|
@ -32,123 +26,19 @@ logTmtRequiredPackages() {
|
|||
rlLog "# Installed packages:"
|
||||
rlLog "#----------------------------#"
|
||||
for pkg in $TMT_REQUIRES; do
|
||||
rlAssertRpm "$pkg"
|
||||
done
|
||||
rlAssertRpm $pkg
|
||||
done;
|
||||
rlLog "#----------------------------#"
|
||||
}
|
||||
|
||||
# Check if a previous test run created a kernel SRPM for the latest commit
|
||||
# If found, the abspath is stored in KERNEL_SRPM global variable
|
||||
# Returns 0 if srpm found, 1 otherwise.
|
||||
checkCache() {
|
||||
local commit_hash
|
||||
local cache_dir
|
||||
local cached_srpm
|
||||
|
||||
commit_hash=$(git ls-remote "${KERNEL_GIT_URL}" "${KERNEL_BRANCH}" | awk '{print $1}')
|
||||
rlLog "Latest commit for ${KERNEL_BRANCH} branch: $commit_hash"
|
||||
|
||||
cache_dir="${CACHE_DIR_BASE}${commit_hash}/"
|
||||
if [[ -d "$cache_dir" ]]; then
|
||||
cached_srpm=$(find "$cache_dir" -name "${KERNEL_SRPM_PATTERN}")
|
||||
if [[ -n "$cached_srpm" ]]; then
|
||||
rlLog "Found cached SRPM: $cached_srpm"
|
||||
rlRun "dnf builddep -y $cached_srpm > install-buildreqs.log 2>&1"
|
||||
rlFileSubmit install-buildreqs.log
|
||||
KERNEL_SRPM="$cached_srpm"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
rlLog "Cached kernel SRPM not found"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Attempts to clone the kernel-ark tree in the CWD, at most 3 times.
|
||||
# Returns 0 on success, 1 otherwise
|
||||
cloneKernelTree() {
|
||||
local retries=3
|
||||
local delay=10
|
||||
|
||||
rlLog "Cloning kernel"
|
||||
while [[ $retries -gt 0 ]]; do
|
||||
rlRun "git clone -q --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}" 0-255
|
||||
retcode=$?
|
||||
if [[ $retcode -eq 0 ]]; then
|
||||
return 0
|
||||
else
|
||||
retries=$((retries - 1))
|
||||
rlLog "Clone failed, wait ${delay}s and retry ($retries retries left)"
|
||||
sleep $delay
|
||||
fi
|
||||
done
|
||||
return "$retcode"
|
||||
}
|
||||
|
||||
# In a kernel-ark repository, do all the operations needed to generate an SRPM
|
||||
# If the kernel is generated return the abspath in KERNEL_SRPM global variable
|
||||
# Returns 0 on success, 1 otherwise
|
||||
generateSRPM() {
|
||||
local generated_srpm
|
||||
local commit_hash
|
||||
local cache_dir
|
||||
|
||||
if ! cloneKernelTree; then
|
||||
rlFail "Failed to clone kernel tree"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rlRun "pushd kernel-ark"
|
||||
rlLog "Gathering and installing missing build requirements"
|
||||
rlRun "make dist-get-buildreqs > make-buildreqs.log 2>&1"
|
||||
rlFileSubmit make-buildreqs.log
|
||||
if grep -q 'Missing dependencies:' make-buildreqs.log; then
|
||||
# Getting the build requirements is quite tricky as it might contain
|
||||
# not only package names but also "provides" perl(ExtUtils::Embed) which
|
||||
# can break the dnf command if not escaped properly. The safest way is
|
||||
# to create an array which contains each req as argument, then pass the
|
||||
# array to dnf. Bash will later pass each element properly quoted.
|
||||
# rlRun can also easily break the command due to special characters
|
||||
# so we don't use it here.
|
||||
read -ra KERNEL_BUILDREQS <<< "$(sed -n 's/Missing dependencies://p' make-buildreqs.log)"
|
||||
rlLog "Installing dependencies: ${KERNEL_BUILDREQS[*]}"
|
||||
dnf install -y "${KERNEL_BUILDREQS[@]}" > install-buildreqs.log 2>&1 || \
|
||||
rlFail "$(cat install-buildreqs.log)"
|
||||
rlFileSubmit install-buildreqs.log
|
||||
elif grep 'PASS:' make-buildreqs.log; then
|
||||
rlLog "All dependencies were already installed"
|
||||
else
|
||||
rlLogWarning "Error getting dependencies, the build might fail"
|
||||
rlRun "cat make-buildreqs.log"
|
||||
fi
|
||||
|
||||
rlLog "Generating SRPM"
|
||||
rlRun "make dist-srpm > dist-srpm.log 2>&1"
|
||||
rlFileSubmit dist-srpm.log
|
||||
|
||||
generated_srpm=$(find "$(pwd)" -name "$KERNEL_SRPM_PATTERN")
|
||||
if [[ -e "$generated_srpm" ]]; then
|
||||
rlLog "Caching generated SRPM"
|
||||
commit_hash=$(git rev-parse HEAD)
|
||||
cache_dir="${CACHE_DIR_BASE}${commit_hash}/"
|
||||
rlRun "mkdir -p $cache_dir"
|
||||
rlRun "cp $generated_srpm $cache_dir"
|
||||
KERNEL_SRPM="$generated_srpm"
|
||||
rlRun "popd"
|
||||
return 0
|
||||
else
|
||||
rlLogWarning "Failed to generate SRPM"
|
||||
rlRun "popd"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
# Log system mem/cpus and packages installed by tmt
|
||||
rlRun "nproc"
|
||||
rlRun "free -h"
|
||||
logTmtRequiredPackages
|
||||
|
||||
declare tmp
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlRun "set -o pipefail"
|
||||
|
|
@ -159,28 +49,42 @@ rlJournalStart
|
|||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
# Check if kernel package was generated by a previous test run
|
||||
# and generate a new one if it wasn't
|
||||
checkCache
|
||||
if [[ -e "$KERNEL_SRPM" ]]; then
|
||||
rlLog "Using cached kernel SRPM: $KERNEL_SRPM"
|
||||
# TODO It would be fantastic to find out a way to shallow clone without
|
||||
# breaking the dist-get-buildreqs and dist-srpm make targets, because
|
||||
# a complete clone takes about 5GiB and a LOT of time...
|
||||
rlLog "Cloning kernel"
|
||||
rlRun "git clone --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}"
|
||||
rlRun 'cd kernel-ark'
|
||||
|
||||
rlLog "Gathering and installing missing build requirements"
|
||||
rlRun "make dist-get-buildreqs > make-buildreqs.log"
|
||||
rlFileSubmit make-buildreqs.log
|
||||
if grep 'Missing dependencies:' make-buildreqs.log; then
|
||||
rlRun "KERNEL_BUILDREQS=\"$(sed -n 's/Missing dependencies://p' make-buildreqs.log)\""
|
||||
rlRun 'dnf install -y ${KERNEL_BUILDREQS} > install-buildreqs.log 2>&1'
|
||||
rlFileSubmit install-buildreqs.log
|
||||
elif grep 'PASS:' make-buildreqs.log; then
|
||||
rlLog "All dependencies were already installed"
|
||||
else
|
||||
rlLog "No kernel SRPM found, generating new SRPM"
|
||||
generateSRPM
|
||||
rlLogWarning "Error getting dependencies, the build might fail"
|
||||
rlRun "cat make-buildreqs.log"
|
||||
fi
|
||||
|
||||
if [[ -e "$KERNEL_SRPM" ]]; then
|
||||
BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang "
|
||||
BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k "
|
||||
BUILD_FLAGS+="--without realtime --without zfcpdump "
|
||||
BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}"
|
||||
rlLog "Generating srpm"
|
||||
rlRun 'make dist-srpm > dist-srpm.log 2>&1'
|
||||
rlRun 'KERNEL_SRPM=$(find . -name kernel-*.src.rpm)'
|
||||
rlFileSubmit dist-srpm.log
|
||||
|
||||
# Prepare the flags to be passed to rpmbuild depending on the configuration
|
||||
BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang "
|
||||
BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k "
|
||||
BUILD_FLAGS+="--without realtime --without zfcpdump "
|
||||
BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}"
|
||||
|
||||
rlLog "Building kernel (branch $KERNEL_BRANCH)"
|
||||
rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1"
|
||||
rlFileSubmit build.log
|
||||
|
||||
rlLog "Building kernel (branch $KERNEL_BRANCH)"
|
||||
rlRun "rpmbuild ${BUILD_FLAGS} --rebuild ${KERNEL_SRPM} > build.log 2>&1"
|
||||
rlFileSubmit build.log
|
||||
else
|
||||
rlFail "Kernel SRPM not found, finishing test"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ component+:
|
|||
- libomp
|
||||
|
||||
require+:
|
||||
- clang-libs
|
||||
- libomp
|
||||
- libomp-devel
|
||||
- clang18-libs
|
||||
- libomp18
|
||||
- libomp18-devel
|
||||
|
||||
adjust+:
|
||||
# Right now libomp in s390x is supported only in LLVM >= 18 in Fedora
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
set -exo pipefail
|
||||
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))
|
||||
|
||||
# For compat packages, we want to check if there's a package suffix: clang17 instead clang for example
|
||||
PKG_SUFFIX=${CLANG_PKG#clang}
|
||||
CLANG_NVR=$(rpm -q "$CLANG_PKG")
|
||||
CLANG_VERSION=$(rpm --queryformat="%{version}" -q "$CLANG_NVR")
|
||||
CLANG_NVR=$(rpm -q $CLANG_PKG)
|
||||
CLANG_VERSION=$(rpm --queryformat="%{version}" -q $CLANG_NVR)
|
||||
LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel"
|
||||
|
||||
# Ensure clang depends on the correct clang-libs version
|
||||
rpm -q --requires "$CLANG_NVR" | grep "${CLANG_PKG}-libs.* = ${CLANG_VERSION}"
|
||||
rpm -q --requires ${CLANG_NVR} | grep "${CLANG_PKG}-libs.* = ${CLANG_VERSION}"
|
||||
|
||||
# Check that weak dependencies are correct. The versions of these should be the same
|
||||
# as clang's to guarantee the ABI compatibility, and that version should be actually
|
||||
# installed as well.
|
||||
for lomp_dep in $LIBOMP_DEPENDENCIES; do
|
||||
rpm -q --recommends "clang${PKG_SUFFIX}-libs" | grep "${lomp_dep}.* = ${CLANG_VERSION}"
|
||||
[[ "$(rpm --queryformat="%{version}" -q "${lomp_dep}"."$(uname -m)")" == "${CLANG_VERSION}" ]]
|
||||
rpm -q --recommends clang${PKG_SUFFIX}-libs | grep "${lomp_dep}.* = ${CLANG_VERSION}"
|
||||
[[ "$(rpm --queryformat="%{version}" -q ${lomp_dep}.$(uname -m))" == "${CLANG_VERSION}" ]]
|
||||
done
|
||||
|
||||
# Perform a sanity test to ensure everything works as expected
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ adjust+:
|
|||
|
||||
require+:
|
||||
- git
|
||||
- clang
|
||||
- clang18
|
||||
- ninja-build
|
||||
- llvm-test-suite
|
||||
duration: 1h
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
set -e
|
||||
|
||||
# Use __LDBL_MANT_DIG__ as a way to distinguish between long double formats.
|
||||
# While this is not guaranteed to change for all formats, it provides a
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ framework: shell
|
|||
|
||||
# Always define "test" key and override in adjust or in each specific test
|
||||
# metadata if needed.
|
||||
test: ./runtest.sh
|
||||
test: "PATH=/usr/lib64/llvm18/bin:$PATH ./runtest.sh"
|
||||
|
||||
# Commonly used keys are initialized to empty.
|
||||
require: []
|
||||
|
|
@ -24,7 +24,7 @@ tag: []
|
|||
adjust+:
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- clang
|
||||
- clang18
|
||||
when: collection is not defined
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ extra-summary: /tools/clang/openmp-rpm
|
|||
extra-task: /tools/clang/openmp-rpm
|
||||
extra-nitrate: TC#0614128
|
||||
component+:
|
||||
- libomp
|
||||
- libomp18
|
||||
|
||||
adjust+:
|
||||
# Right now libomp in s390x is supported only in LLVM >= 18 in Fedora
|
||||
|
|
@ -21,7 +21,7 @@ adjust+:
|
|||
continue: false
|
||||
|
||||
- require+:
|
||||
- libomp
|
||||
- libomp18
|
||||
when: collection is not defined
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@ summary: Check that we build rpms with -pie
|
|||
tier: 1
|
||||
|
||||
require+:
|
||||
- clang-libs
|
||||
- clang18-libs
|
||||
- rpm-build
|
||||
- glibc-static
|
||||
|
||||
# TODO: Untag this test when redhat-rpm-config is modified.
|
||||
# See: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/291
|
||||
tag: not-in-default
|
||||
|
||||
adjust+:
|
||||
- enabled: false
|
||||
when: distro != fedora or distro < fedora-40
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ adjust+:
|
|||
require+:
|
||||
- qemu-user-static
|
||||
- mock
|
||||
test: ./runtest-fedora.sh
|
||||
test: "PATH=/usr/lib64/llvm18/bin:$PATH ./runtest-fedora.sh"
|
||||
when: distro == fedora and arch == x86_64 and snapshot is not defined
|
||||
continue: false
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash -e
|
||||
set -e
|
||||
|
||||
fedora_release=$(rpm -E "%{fedora}")
|
||||
fedora_release=`rpm -E %{fedora}`
|
||||
mock_root=fedora-$fedora_release-ppc64le
|
||||
triple=ppc64le-redhat-linux
|
||||
|
||||
mock_cmd="mock -r $mock_root --isolation=simple"
|
||||
|
||||
|
|
@ -11,10 +12,10 @@ run_test () {
|
|||
|
||||
echo "Running $test_name"
|
||||
echo "Expected output: $expected"
|
||||
actual=$($mock_cmd -q --shell "./$test_name")
|
||||
actual=$($mock_cmd -q --shell ./$test_name)
|
||||
echo "Actual output: $actual"
|
||||
|
||||
if [[ "$expected" == "$actual" ]]; then
|
||||
if [[ x$expected == x$actual ]]; then
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
set -e
|
||||
|
||||
triple=ppc64le-redhat-linux
|
||||
|
||||
|
||||
run_test () {
|
||||
test_name=$1
|
||||
|
|
@ -6,10 +9,10 @@ run_test () {
|
|||
|
||||
echo "Running $test_name"
|
||||
echo "Expected output: $expected"
|
||||
actual=$("./$test_name")
|
||||
actual=$(./$test_name)
|
||||
echo "Actual output: $actual"
|
||||
|
||||
if [[ "$expected" == "$actual" ]]; then
|
||||
if [[ x$expected == x$actual ]]; then
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ extra-nitrate: TC#0614130
|
|||
adjust+:
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- clang-analyzer
|
||||
- clang18-analyzer
|
||||
when: "collection is not defined"
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/bash -ex
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
|
||||
tmp_cpp=$(mktemp -t XXXXX.cpp)
|
||||
tmp_dir=$(mktemp -d)
|
||||
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > "$tmp_cpp"
|
||||
scan-build -o "$tmp_dir" clang++ -c "$tmp_cpp" -o /dev/null
|
||||
(scan-view --no-browser "$tmp_dir"/* & WPID=$! && sleep 10s && kill $WPID)
|
||||
rm -rf "$tmp_cpp" "$tmp_dir"
|
||||
tmp_cpp=`mktemp -t XXXXX.cpp`
|
||||
tmp_dir=`mktemp -d`
|
||||
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp
|
||||
scan-build -o $tmp_dir clang++ -c $tmp_cpp -o /dev/null
|
||||
(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
summary: Test if RPM macros are properly set
|
||||
tier: 1
|
||||
require+:
|
||||
- clang-devel
|
||||
- clang18-devel
|
||||
extra-summary: /tools/clang/rpmmacros
|
||||
extra-task: /tools/clang/rpmmacros
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#!/bin/bash -eux
|
||||
#!/bin/sh -eux
|
||||
|
||||
clang_pkg=${1:-"$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")"}
|
||||
clang_pkg=${1:-"$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))"}
|
||||
macros_path="/usr/lib/rpm/macros.d/macros.clang"
|
||||
|
||||
set pipefail
|
||||
|
||||
if ! rpm -q "$clang_pkg" > /dev/null; then
|
||||
if ! rpm -q $clang_pkg > /dev/null; then
|
||||
echo "Could not find package $clang_pkg"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -23,7 +23,7 @@ echo
|
|||
# suffix ~rcN. Meanwhile, the macro won't include it in order to allow packages
|
||||
# built with an RC package to be fully supported later.
|
||||
# In that case, we need to remove that prefix.
|
||||
rpm_version=$(rpm -q "$clang_pkg" --qf "%{version}" | sed 's/~.*//')
|
||||
rpm_version=$(rpm -q $clang_pkg --qf "%{version}" | sed 's/~.*//')
|
||||
macro_version=$(rpm --eval "%{clang_version}")
|
||||
|
||||
if [[ "$rpm_version" != "$macro_version" ]]; then
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ extra-nitrate: TC#0614133
|
|||
adjust+:
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- compiler-rt
|
||||
- lld
|
||||
- compiler-rt18
|
||||
- lld18
|
||||
when: "collection is not defined"
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
@ -36,7 +36,7 @@ adjust+:
|
|||
# lld not supported in s390x (LLVM<18) or ppc64. If any lld package was added to
|
||||
# requirements, remove it.
|
||||
- require-:
|
||||
- lld
|
||||
- lld18
|
||||
- llvm-toolset-13.0-lld
|
||||
- llvm-toolset-14.0-lld
|
||||
- llvm-toolset-15.0-lld
|
||||
|
|
@ -49,7 +49,7 @@ adjust+:
|
|||
# if not. The test will (correctly) fail if we lld is missing in LLVM 18.
|
||||
# TODO once LLVM 18 is in the default module stream we can set this a require:
|
||||
- recommend+:
|
||||
- lld
|
||||
- lld18
|
||||
when: arch == s390x and distro == rhel-8.10
|
||||
|
||||
- environment+:
|
||||
|
|
@ -82,7 +82,7 @@ adjust+:
|
|||
require+:
|
||||
- libstdc++
|
||||
# All archs support lld in snapshots, ensure it's required
|
||||
- lld
|
||||
- lld18
|
||||
when: snapshot is defined
|
||||
because: llvm-snapshots adjustments
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -eu
|
||||
#!/bin/sh -eux
|
||||
|
||||
set pipefail
|
||||
|
||||
|
|
@ -12,40 +12,41 @@ status=0
|
|||
|
||||
test_toolchain() {
|
||||
|
||||
toolchain=("$@")
|
||||
toolchain=$@
|
||||
args=""
|
||||
|
||||
for arg in "${toolchain[@]}"; do
|
||||
case "$arg" in
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
clang)
|
||||
compiler=$arg
|
||||
compiler=$1
|
||||
src=hello.c
|
||||
;;
|
||||
clang++)
|
||||
compiler=$arg
|
||||
compiler=$1
|
||||
src=hello.cpp
|
||||
;;
|
||||
compiler-rt)
|
||||
args="$args -rtlib=$arg"
|
||||
args="$args -rtlib=$1"
|
||||
;;
|
||||
libc++)
|
||||
args="$args -stdlib=$arg"
|
||||
args="$args -stdlib=$1"
|
||||
;;
|
||||
libstdc++)
|
||||
args="$args -stdlib=$arg"
|
||||
args="$args -stdlib=$1"
|
||||
;;
|
||||
lld)
|
||||
args="$args -fuse-ld=$arg"
|
||||
args="$args -fuse-ld=$1"
|
||||
;;
|
||||
*)
|
||||
args="$args $arg"
|
||||
args="$args $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cmd="$compiler $args $src"
|
||||
rm -f a.out
|
||||
echo "* ${toolchain[*]}"
|
||||
echo "* $toolchain"
|
||||
echo " command: $cmd"
|
||||
if $cmd && ./a.out | grep -q 'Hello World'; then
|
||||
echo " PASS"
|
||||
|
|
@ -56,17 +57,17 @@ test_toolchain() {
|
|||
}
|
||||
|
||||
clang --version
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))
|
||||
# Repoquery is needed instead yum info for compatibility with RHEL-7
|
||||
repoquery -i --installed "$CLANG_PKG" | grep ^Source
|
||||
clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+")
|
||||
repoquery -i --installed $CLANG_PKG | grep ^Source
|
||||
clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+")
|
||||
echo ""
|
||||
|
||||
for compiler in clang clang++; do
|
||||
for rtlib in "" compiler-rt; do
|
||||
for linker in "" lld; do
|
||||
for cxxlib in "" $CXXLIBS; do
|
||||
if [[ "$compiler" = "clang" && -n "$cxxlib" ]]; then
|
||||
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
|
||||
continue
|
||||
fi
|
||||
for args in "" -static; do
|
||||
|
|
@ -99,7 +100,7 @@ for compiler in clang clang++; do
|
|||
continue
|
||||
fi
|
||||
|
||||
test_toolchain "$compiler" "$rtlib" "$linker" "$cxxlib" "$args"
|
||||
test_toolchain $compiler $rtlib $linker $cxxlib $args
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -eux
|
||||
set -eux
|
||||
|
||||
clang++ --target=x86_64-windows-gnu test.cpp
|
||||
file a.exe | grep "PE32+ executable.*x86-64"
|
||||
file a.exe | grep "PE32+ executable (console) x86-64, for MS Windows"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ extra-nitrate: TC#0614134
|
|||
adjust+:
|
||||
# Common requirements when LLVM is not SCL-ized
|
||||
- require+:
|
||||
- llvm
|
||||
- llvm18
|
||||
when: "collection is not defined"
|
||||
|
||||
# Requirements for SCL-ized LLVM
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -eux
|
||||
#!/bin/sh -eux
|
||||
|
||||
# Determine correct DWARF version to use. Defaults to version 5, but older
|
||||
# distros might need to use version 4, which can be configured using the
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
required_dwarf_version=${DWARF_VERSION:-5}
|
||||
|
||||
# Get clang version
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")
|
||||
clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+")
|
||||
if [ "$clang_version" -lt 18 ]; then
|
||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))
|
||||
clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+")
|
||||
if [ $clang_version -lt 18 ]; then
|
||||
>&2 echo "clang is older than version 18";
|
||||
required_dwarf_version=4
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue