Add a test for checking that compiler-rt don't ship broken symlinks

This commit is contained in:
Jesus Checa Hidalgo 2023-10-20 13:59:44 +02:00
commit 082c661c48
2 changed files with 32 additions and 0 deletions

16
broken-symlinks/main.fmf Normal file
View file

@ -0,0 +1,16 @@
summary: Test that compiler-rt does not contain broken symlinks
test: ./test.sh
framework: shell
tier: 1
component:
- llvm-toolset
- compiler-rt
require:
- compiler-rt
link:
verifies: https://issues.redhat.com/browse/RHEL-7375
adjust:
- enabled: false
when: rhel < rhel-8

16
broken-symlinks/test.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh -u
tmp=$(mktemp -d)
# Install compiler-rt in a new root to ensure possible broken links are
# not resolved with packages installed by other tests
dnf install --quiet --installroot=${tmp} -y compiler-rt
result=0
for file in $(rpm -ql compiler-rt); do
[[ -L ${tmp}/$file ]] || continue
if [[ ! -e ${tmp}/$file ]]; then
echo "FAIL: $file is a dangling symlink"
result=1
fi
done
rm -rf $tmp
exit $result