diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5388a6..2e27e78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/tests/ld-alternative/test.sh b/tests/ld-alternative/test.sh index 6202f88..b244ad1 100755 --- a/tests/ld-alternative/test.sh +++ b/tests/ld-alternative/test.sh @@ -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'