Compare commits

..

2 commits

Author SHA1 Message Date
Jesus Checa Hidalgo
a2b93f39c8 ld-alternative: Update check on alternatives/ld symlink
Before LLD 19 /usr/bin/ld.lld was a file, and now it's a symlink to /usr/bin/lld.
Hence, /etc/alternative/ld symlink now resolves to /usr/bin/lld,
breaking our check and raising false positives.

Updating the expression to match "lld" only fixes the issue.
2024-10-14 10:06:13 +02:00
Jesus Checa Hidalgo
a9a9883a60 Shell static analysis
Add pre-commit hook for static analysis on shell scripts (shellcheck)
Fixed issues flagged by shellcheck.
2024-08-05 09:34:31 +02:00
5 changed files with 14 additions and 11 deletions

View file

@ -12,3 +12,10 @@ 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

View file

@ -7,7 +7,7 @@ extra-nitrate: TC#0614058
adjust+:
# Common requirements when LLVM is not SCL-ized
- require+:
- clang18
- clang
when: collection is not defined
# Requirements for SCL-ized LLVM

View file

@ -13,7 +13,3 @@ adjust+:
- because: lld is not installed as ld alternative in rhel < 9
enabled: false
when: distro < rhel-9
- because: lld not installed as alternative in compat packages
enabled: false
when: compat is defined

View file

@ -1,11 +1,11 @@
#!/bin/sh -eux
#!/bin/bash -eux
# This test assumes lld is already installed.
function verify_ld_bfd {
verify_ld_bfd (){
# Verify that /usr/bin/ld points to ld.bfd.
ls -l /etc/alternatives/ld | grep ld.bfd
[[ $(readlink -f /etc/alternatives/ld) == *"ld.bfd" ]]
# Run ld and verify it invokes ld.bfd
/usr/bin/ld --version | grep 'GNU ld'
@ -19,7 +19,7 @@ verify_ld_bfd
update-alternatives --set ld /usr/bin/ld.lld
# Verify that /usr/bin/ld points to lld
ls -l /etc/alternatives/ld | grep ld.lld
[[ $(readlink -f /etc/alternatives/ld) == *"lld" ]]
# Run ld and verify it invokes lld
/usr/bin/ld --version | grep 'LLD'

View file

@ -14,7 +14,7 @@ framework: shell
# Always define "test" key and override in adjust or in each specific test
# metadata if needed.
test: "PATH=/usr/lib64/llvm18/bin:$PATH ./test.sh"
test: ./test.sh
# Commonly used keys are initialized to empty.
require: []
@ -34,7 +34,7 @@ adjust+:
# Common requirements when LLVM is not SCL-ized
- require+:
- lld18
- lld
when: collection is not defined
# Requirements for SCL-ized LLVM