Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3de6a2aad5 | ||
|
|
c140bdf103 | ||
|
|
cda9761d2e | ||
|
|
71a2b1c3bf | ||
|
|
bf7e2faa36 | ||
|
|
9080b2716a |
16 changed files with 216 additions and 109 deletions
|
|
@ -12,3 +12,10 @@ repos:
|
||||||
rev: 1.32.2
|
rev: 1.32.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: tmt-lint
|
- 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
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
|
||||||
set -ex pipefail
|
set -ex pipefail
|
||||||
|
|
||||||
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
|
cflags=$(rpm -D '%toolchain clang' -E '%{build_cflags}')
|
||||||
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
|
cxxflags=$(rpm -D '%toolchain clang' -E '%{build_cxxflags}')
|
||||||
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
|
ldflags=$(rpm -D '%toolchain clang' -E '%{build_ldflags}')
|
||||||
|
|
||||||
|
|
||||||
# Test a c program
|
# Test a c program
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh -eux
|
#!/bin/bash -eux
|
||||||
|
|
||||||
tmp=$(mktemp -d)
|
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.
|
# gcc-toolset-XX, in such case we need to test the compatibility with that one.
|
||||||
# We can get that from `clang -v` output.
|
# We can get that from `clang -v` output.
|
||||||
TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||:
|
TOOLSET=$(clang -v |& grep "Selected GCC installation" | grep -P -o '(dev|gcc-)toolset-[0-9]*') ||:
|
||||||
if [[ "x" = "x${TOOLSET}" ]]; then
|
if [[ "" = "${TOOLSET}" ]]; then
|
||||||
GCC="g++"
|
GCC="g++"
|
||||||
else
|
else
|
||||||
GCC="scl enable ${TOOLSET} -- g++"
|
GCC="scl enable ${TOOLSET} -- g++"
|
||||||
|
|
@ -14,13 +14,13 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the source with GCC, link it with clang
|
# Build the source with GCC, link it with clang
|
||||||
${GCC} -c hello.cpp -o ${tmp}/hello.o
|
${GCC} -c hello.cpp -o "${tmp}/hello.o"
|
||||||
clang++ -o ${tmp}/hello ${tmp}/hello.o
|
clang++ -o "${tmp}"/hello "${tmp}/hello.o"
|
||||||
${tmp}/hello | grep "Hello world"
|
"${tmp}/hello" | grep "Hello world"
|
||||||
rm -rf ${tmp}/*
|
rm -rf "${tmp:?}"/*
|
||||||
|
|
||||||
# Build the source with clang, link it with GCC
|
# Build the source with clang, link it with GCC
|
||||||
clang++ -c hello.cpp -o ${tmp}/hello.o
|
clang++ -c hello.cpp -o "${tmp}/hello.o"
|
||||||
${GCC} -o ${tmp}/hello ${tmp}/hello.o
|
${GCC} -o "${tmp}"/hello "${tmp}/hello.o"
|
||||||
${tmp}/hello | grep "Hello world"
|
"${tmp}/hello" | grep "Hello world"
|
||||||
rm -rf ${tmp}/*
|
rm -rf "${tmp:?}"/*
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,17 @@
|
||||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
## General configuration variables. Can be overriden via environment
|
## General configuration variables. Can be overridden via environment
|
||||||
# Kernel branch to build. Typically ark-latest or os-build.
|
# Kernel branch to build. Typically ark-latest or os-build.
|
||||||
KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"}
|
KERNEL_BRANCH=${KERNEL_BRANCH:-"ark-latest"}
|
||||||
KERNEL_GIT_URL=${KERNEL_GIT_URL:-"https://gitlab.com/cki-project/kernel-ark.git"}
|
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:
|
# Environment variables to configure the kernel build:
|
||||||
# * ENABLE_LTO: If set, it will build kernel-ark with clang_lto.
|
# * ENABLE_LTO: If set, it will build kernel-ark with clang_lto.
|
||||||
# * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode.
|
# * ENABLE_DEBUG: If set, it will build kernel-ark in debug mode.
|
||||||
|
|
@ -16,8 +22,8 @@ CLANG_MODE=${CLANG_MODE:-"--with clang"}
|
||||||
BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"}
|
BUILD_MODE=${ENABLE_DEBUG:+"--with debug --without base"}
|
||||||
BUILD_MODE=${BUILD_MODE:-"--with base --without debug"}
|
BUILD_MODE=${BUILD_MODE:-"--with base --without debug"}
|
||||||
|
|
||||||
function logTmtRequiredPackages(){
|
# Log installed packages required by TMT
|
||||||
# Get the expected packages from TMT metadata requires
|
logTmtRequiredPackages() {
|
||||||
if [[ ! -e $TMT_TEST_METADATA ]]; then
|
if [[ ! -e $TMT_TEST_METADATA ]]; then
|
||||||
rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt"
|
rlLogWarning "${FUNCNAME[0]}: No TMT_TEST_METADATA file found. Run the test from tmt"
|
||||||
return
|
return
|
||||||
|
|
@ -26,19 +32,123 @@ function logTmtRequiredPackages(){
|
||||||
rlLog "# Installed packages:"
|
rlLog "# Installed packages:"
|
||||||
rlLog "#----------------------------#"
|
rlLog "#----------------------------#"
|
||||||
for pkg in $TMT_REQUIRES; do
|
for pkg in $TMT_REQUIRES; do
|
||||||
rlAssertRpm $pkg
|
rlAssertRpm "$pkg"
|
||||||
done;
|
done
|
||||||
rlLog "#----------------------------#"
|
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
|
rlJournalStart
|
||||||
rlPhaseStartSetup
|
rlPhaseStartSetup
|
||||||
# Log system mem/cpus and packages installed by tmt
|
|
||||||
rlRun "nproc"
|
rlRun "nproc"
|
||||||
rlRun "free -h"
|
rlRun "free -h"
|
||||||
logTmtRequiredPackages
|
logTmtRequiredPackages
|
||||||
|
|
||||||
|
declare tmp
|
||||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||||
rlRun "pushd $tmp"
|
rlRun "pushd $tmp"
|
||||||
rlRun "set -o pipefail"
|
rlRun "set -o pipefail"
|
||||||
|
|
@ -49,42 +159,28 @@ rlJournalStart
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest
|
rlPhaseStartTest
|
||||||
# TODO It would be fantastic to find out a way to shallow clone without
|
# Check if kernel package was generated by a previous test run
|
||||||
# breaking the dist-get-buildreqs and dist-srpm make targets, because
|
# and generate a new one if it wasn't
|
||||||
# a complete clone takes about 5GiB and a LOT of time...
|
checkCache
|
||||||
rlLog "Cloning kernel"
|
if [[ -e "$KERNEL_SRPM" ]]; then
|
||||||
rlRun "git clone --branch ${KERNEL_BRANCH} ${KERNEL_GIT_URL}"
|
rlLog "Using cached kernel SRPM: $KERNEL_SRPM"
|
||||||
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
|
else
|
||||||
rlLogWarning "Error getting dependencies, the build might fail"
|
rlLog "No kernel SRPM found, generating new SRPM"
|
||||||
rlRun "cat make-buildreqs.log"
|
generateSRPM
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rlLog "Generating srpm"
|
if [[ -e "$KERNEL_SRPM" ]]; then
|
||||||
rlRun 'make dist-srpm > dist-srpm.log 2>&1'
|
BUILD_FLAGS="--target $(uname -m) --with up --with toolchain_clang "
|
||||||
rlRun 'KERNEL_SRPM=$(find . -name kernel-*.src.rpm)'
|
BUILD_FLAGS+="--without trace --without arm64_16k --without arm64_64k "
|
||||||
rlFileSubmit dist-srpm.log
|
BUILD_FLAGS+="--without realtime --without zfcpdump "
|
||||||
|
BUILD_FLAGS+="${CLANG_MODE} ${BUILD_MODE}"
|
||||||
# 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
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartCleanup
|
rlPhaseStartCleanup
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,23 @@
|
||||||
|
|
||||||
set -exo pipefail
|
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
|
# For compat packages, we want to check if there's a package suffix: clang17 instead clang for example
|
||||||
PKG_SUFFIX=${CLANG_PKG#clang}
|
PKG_SUFFIX=${CLANG_PKG#clang}
|
||||||
CLANG_NVR=$(rpm -q $CLANG_PKG)
|
CLANG_NVR=$(rpm -q "$CLANG_PKG")
|
||||||
CLANG_VERSION=$(rpm --queryformat="%{version}" -q $CLANG_NVR)
|
CLANG_VERSION=$(rpm --queryformat="%{version}" -q "$CLANG_NVR")
|
||||||
LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel"
|
LIBOMP_DEPENDENCIES="libomp${PKG_SUFFIX} libomp${PKG_SUFFIX}-devel"
|
||||||
|
|
||||||
# Ensure clang depends on the correct clang-libs version
|
# 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
|
# 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
|
# as clang's to guarantee the ABI compatibility, and that version should be actually
|
||||||
# installed as well.
|
# installed as well.
|
||||||
for lomp_dep in $LIBOMP_DEPENDENCIES; do
|
for lomp_dep in $LIBOMP_DEPENDENCIES; do
|
||||||
rpm -q --recommends clang${PKG_SUFFIX}-libs | grep "${lomp_dep}.* = ${CLANG_VERSION}"
|
rpm -q --recommends "clang${PKG_SUFFIX}-libs" | grep "${lomp_dep}.* = ${CLANG_VERSION}"
|
||||||
[[ "$(rpm --queryformat="%{version}" -q ${lomp_dep}.$(uname -m))" == "${CLANG_VERSION}" ]]
|
[[ "$(rpm --queryformat="%{version}" -q "${lomp_dep}"."$(uname -m)")" == "${CLANG_VERSION}" ]]
|
||||||
done
|
done
|
||||||
|
|
||||||
# Perform a sanity test to ensure everything works as expected
|
# Perform a sanity test to ensure everything works as expected
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ adjust+:
|
||||||
or distro == centos
|
or distro == centos
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
- because: "llvm test suite not built for compat packages"
|
||||||
|
enabled: false
|
||||||
|
when: compat is defined
|
||||||
|
|
||||||
require+:
|
require+:
|
||||||
- git
|
- git
|
||||||
- clang
|
- clang
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
set -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
# Use __LDBL_MANT_DIG__ as a way to distinguish between long double formats.
|
# 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
|
# While this is not guaranteed to change for all formats, it provides a
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ require+:
|
||||||
- rpm-build
|
- rpm-build
|
||||||
- glibc-static
|
- 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+:
|
adjust+:
|
||||||
- enabled: false
|
- enabled: false
|
||||||
when: distro != fedora or distro < fedora-40
|
when: distro != fedora or distro < fedora-40
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
set -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
fedora_release=`rpm -E %{fedora}`
|
fedora_release=$(rpm -E "%{fedora}")
|
||||||
mock_root=fedora-$fedora_release-ppc64le
|
mock_root=fedora-$fedora_release-ppc64le
|
||||||
triple=ppc64le-redhat-linux
|
|
||||||
|
|
||||||
mock_cmd="mock -r $mock_root --isolation=simple"
|
mock_cmd="mock -r $mock_root --isolation=simple"
|
||||||
|
|
||||||
|
|
@ -12,10 +11,10 @@ run_test () {
|
||||||
|
|
||||||
echo "Running $test_name"
|
echo "Running $test_name"
|
||||||
echo "Expected output: $expected"
|
echo "Expected output: $expected"
|
||||||
actual=$($mock_cmd -q --shell ./$test_name)
|
actual=$($mock_cmd -q --shell "./$test_name")
|
||||||
echo "Actual output: $actual"
|
echo "Actual output: $actual"
|
||||||
|
|
||||||
if [[ x$expected == x$actual ]]; then
|
if [[ "$expected" == "$actual" ]]; then
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
set -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
triple=ppc64le-redhat-linux
|
|
||||||
|
|
||||||
|
|
||||||
run_test () {
|
run_test () {
|
||||||
test_name=$1
|
test_name=$1
|
||||||
|
|
@ -9,10 +6,10 @@ run_test () {
|
||||||
|
|
||||||
echo "Running $test_name"
|
echo "Running $test_name"
|
||||||
echo "Expected output: $expected"
|
echo "Expected output: $expected"
|
||||||
actual=$(./$test_name)
|
actual=$("./$test_name")
|
||||||
echo "Actual output: $actual"
|
echo "Actual output: $actual"
|
||||||
|
|
||||||
if [[ x$expected == x$actual ]]; then
|
if [[ "$expected" == "$actual" ]]; then
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/bash -ex
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
tmp_cpp=`mktemp -t XXXXX.cpp`
|
tmp_cpp=$(mktemp -t XXXXX.cpp)
|
||||||
tmp_dir=`mktemp -d`
|
tmp_dir=$(mktemp -d)
|
||||||
echo 'int main(int argc, char*argv[]) { while(argc--) new int(); return 0; }' > $tmp_cpp
|
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-build -o "$tmp_dir" clang++ -c "$tmp_cpp" -o /dev/null
|
||||||
(scan-view --no-browser $tmp_dir/* & WPID=$! && sleep 10s && kill $WPID)
|
(scan-view --no-browser "$tmp_dir"/* & WPID=$! && sleep 10s && kill $WPID)
|
||||||
|
rm -rf "$tmp_cpp" "$tmp_dir"
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,12 @@ require+:
|
||||||
- clang-devel
|
- clang-devel
|
||||||
extra-summary: /tools/clang/rpmmacros
|
extra-summary: /tools/clang/rpmmacros
|
||||||
extra-task: /tools/clang/rpmmacros
|
extra-task: /tools/clang/rpmmacros
|
||||||
|
|
||||||
|
adjust+:
|
||||||
|
# From spec file:
|
||||||
|
# File in the macros file for other packages to use. We are not doing this
|
||||||
|
# in the compat package, because the version macros would conflict with
|
||||||
|
# eachother if both clang and the clang compat package were installed together.
|
||||||
|
- because: "macros.clang is not added to compat packages"
|
||||||
|
enabled: false
|
||||||
|
when: compat is defined
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh -eux
|
#!/bin/bash -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"
|
macros_path="/usr/lib/rpm/macros.d/macros.clang"
|
||||||
|
|
||||||
set pipefail
|
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"
|
echo "Could not find package $clang_pkg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -23,7 +23,7 @@ echo
|
||||||
# suffix ~rcN. Meanwhile, the macro won't include it in order to allow packages
|
# suffix ~rcN. Meanwhile, the macro won't include it in order to allow packages
|
||||||
# built with an RC package to be fully supported later.
|
# built with an RC package to be fully supported later.
|
||||||
# In that case, we need to remove that prefix.
|
# 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}")
|
macro_version=$(rpm --eval "%{clang_version}")
|
||||||
|
|
||||||
if [[ "$rpm_version" != "$macro_version" ]]; then
|
if [[ "$rpm_version" != "$macro_version" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh -eux
|
#!/bin/bash -eu
|
||||||
|
|
||||||
set pipefail
|
set pipefail
|
||||||
|
|
||||||
|
|
@ -12,41 +12,40 @@ status=0
|
||||||
|
|
||||||
test_toolchain() {
|
test_toolchain() {
|
||||||
|
|
||||||
toolchain=$@
|
toolchain=("$@")
|
||||||
args=""
|
args=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
for arg in "${toolchain[@]}"; do
|
||||||
case $1 in
|
case "$arg" in
|
||||||
clang)
|
clang)
|
||||||
compiler=$1
|
compiler=$arg
|
||||||
src=hello.c
|
src=hello.c
|
||||||
;;
|
;;
|
||||||
clang++)
|
clang++)
|
||||||
compiler=$1
|
compiler=$arg
|
||||||
src=hello.cpp
|
src=hello.cpp
|
||||||
;;
|
;;
|
||||||
compiler-rt)
|
compiler-rt)
|
||||||
args="$args -rtlib=$1"
|
args="$args -rtlib=$arg"
|
||||||
;;
|
;;
|
||||||
libc++)
|
libc++)
|
||||||
args="$args -stdlib=$1"
|
args="$args -stdlib=$arg"
|
||||||
;;
|
;;
|
||||||
libstdc++)
|
libstdc++)
|
||||||
args="$args -stdlib=$1"
|
args="$args -stdlib=$arg"
|
||||||
;;
|
;;
|
||||||
lld)
|
lld)
|
||||||
args="$args -fuse-ld=$1"
|
args="$args -fuse-ld=$arg"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
args="$args $1"
|
args="$args $arg"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cmd="$compiler $args $src"
|
cmd="$compiler $args $src"
|
||||||
rm -f a.out
|
rm -f a.out
|
||||||
echo "* $toolchain"
|
echo "* ${toolchain[*]}"
|
||||||
echo " command: $cmd"
|
echo " command: $cmd"
|
||||||
if $cmd && ./a.out | grep -q 'Hello World'; then
|
if $cmd && ./a.out | grep -q 'Hello World'; then
|
||||||
echo " PASS"
|
echo " PASS"
|
||||||
|
|
@ -57,17 +56,17 @@ test_toolchain() {
|
||||||
}
|
}
|
||||||
|
|
||||||
clang --version
|
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 is needed instead yum info for compatibility with RHEL-7
|
||||||
repoquery -i --installed $CLANG_PKG | grep ^Source
|
repoquery -i --installed "$CLANG_PKG" | grep ^Source
|
||||||
clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+")
|
clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+")
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
for compiler in clang clang++; do
|
for compiler in clang clang++; do
|
||||||
for rtlib in "" compiler-rt; do
|
for rtlib in "" compiler-rt; do
|
||||||
for linker in "" lld; do
|
for linker in "" lld; do
|
||||||
for cxxlib in "" $CXXLIBS; do
|
for cxxlib in "" $CXXLIBS; do
|
||||||
if [ "$compiler" = "clang" -a -n "$cxxlib" ]; then
|
if [[ "$compiler" = "clang" && -n "$cxxlib" ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
for args in "" -static; do
|
for args in "" -static; do
|
||||||
|
|
@ -100,7 +99,7 @@ for compiler in clang clang++; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test_toolchain $compiler $rtlib $linker $cxxlib $args
|
test_toolchain "$compiler" "$rtlib" "$linker" "$cxxlib" "$args"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
set -eux
|
#!/bin/bash -eux
|
||||||
|
|
||||||
clang++ --target=x86_64-windows-gnu test.cpp
|
clang++ --target=x86_64-windows-gnu test.cpp
|
||||||
file a.exe | grep "PE32+ executable (console) x86-64, for MS Windows"
|
file a.exe | grep "PE32+ executable.*x86-64"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh -eux
|
#!/bin/bash -eux
|
||||||
|
|
||||||
# Determine correct DWARF version to use. Defaults to version 5, but older
|
# 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
|
# distros might need to use version 4, which can be configured using the
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
required_dwarf_version=${DWARF_VERSION:-5}
|
required_dwarf_version=${DWARF_VERSION:-5}
|
||||||
|
|
||||||
# Get clang version
|
# Get clang version
|
||||||
CLANG_PKG=$(rpm -qf --queryformat '%{name}' $(readlink -f $(type -p clang)))
|
CLANG_PKG=$(rpm -qf --queryformat '%{name}' "$(readlink -f "$(type -p clang)")")
|
||||||
clang_version=$(rpm -q --queryformat "%{version}" $CLANG_PKG | grep -ioP "^[0-9]+")
|
clang_version=$(rpm -q --queryformat "%{version}" "$CLANG_PKG" | grep -ioP "^[0-9]+")
|
||||||
if [ $clang_version -lt 18 ]; then
|
if [ "$clang_version" -lt 18 ]; then
|
||||||
>&2 echo "clang is older than version 18";
|
>&2 echo "clang is older than version 18";
|
||||||
required_dwarf_version=4
|
required_dwarf_version=4
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue