From 9bc730b132d310f3ea1097b4c5c374090be5856b Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Tue, 16 Jul 2024 13:59:35 +0200 Subject: [PATCH 1/2] Create compat18 branch --- tests/cross-compile-i686/main.fmf | 4 ++++ tests/main.fmf | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/cross-compile-i686/main.fmf b/tests/cross-compile-i686/main.fmf index 3863a8c..7ec7948 100644 --- a/tests/cross-compile-i686/main.fmf +++ b/tests/cross-compile-i686/main.fmf @@ -20,3 +20,7 @@ adjust+: - enabled: false because: "compiler-rt.i686 may not be available in snapshot builds when x86_64 tests are executed" when: snapshot is defined + + - enabled: false + because: "i686 packages not available for compat" + when: compat is defined diff --git a/tests/main.fmf b/tests/main.fmf index 4efc1fb..5d76639 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -14,7 +14,7 @@ framework: shell # Always define "test" key and override in adjust or in each specific test # metadata if needed. -test: ./test.sh +test: "PATH=/usr/lib64/llvm18/bin:$PATH ./test.sh" # Commonly used keys are initialized to empty. require: [] @@ -24,8 +24,8 @@ tag: [] adjust+: # Common requirements when LLVM is not SCL-ized - require+: - - clang - - compiler-rt + - clang18 + - compiler-rt18 when: collection is not defined # Requirements for SCL-ized LLVM From 85fc2de3962b64fecbf60a3eaf931cd5de1ae7c0 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 5 Aug 2024 09:16:47 +0200 Subject: [PATCH 2/2] Shell static analysis Add pre-commit hook for static analysis on shell scripts (shellcheck) Fixed issues flagged by shellcheck. --- .pre-commit-config.yaml | 7 +++++++ tests/broken-symlinks/test.sh | 11 ++++++----- tests/fp16-abi/test.sh | 8 ++++---- 3 files changed, 17 insertions(+), 9 deletions(-) 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/broken-symlinks/test.sh b/tests/broken-symlinks/test.sh index b74d8aa..be1b66c 100755 --- a/tests/broken-symlinks/test.sh +++ b/tests/broken-symlinks/test.sh @@ -4,13 +4,14 @@ rlJournalStart rlPhaseStartSetup + declare tmp rlRun "tmp=$(mktemp -d)" 0 "Create a temp dir" # Get the compiler-rt package name from the tmt required packages, which should # address the issue of getting the correct name regardless it's a compat package # or not. The package can be named either compiler-rt or compiler-rt[0-9]+ rlRun "COMPILER_RT=$(rlGetYAMLdeps | tr ' ' '\n' | grep -E "compiler-rt[[:digit:]]*$")" # Make sure to get only the main arch, so we can deal with multilib issues. - rlRun "COMPILER_RT_NVR=$(rpm -q ${COMPILER_RT} | grep $(uname -m))" + rlRun "COMPILER_RT_NVR=$(rpm -q "${COMPILER_RT}" | grep "$(uname -m)")" # Use dnf repoquery --installed so we *don't* query any repos but the # local rpm database instead. That should handle packages installed # using rpm, that are not in repos, and avoid timeouts if repo connection @@ -23,7 +24,7 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - for file in $(rpm -ql $COMPILER_RT_NVR); do + for file in $(rpm -ql "$COMPILER_RT_NVR"); do # Skip iteration if the file is not a symlink [[ -L $file ]] || continue @@ -36,13 +37,13 @@ rlJournalStart # Up to this point, the linked file exists. # If the owner of the target compiler-rt package itself that's # correct and we can skip to the next file. - target=$(readlink -f $file) - OWNER_NVR=$(rpm -qf $target) + target=$(readlink -f "$file") + OWNER_NVR=$(rpm -qf "$target") [[ "$OWNER_NVR" == "$COMPILER_RT_NVR" ]] && continue # The target exists but it's not owned by compiler-rt. It must be # owned by one of its dependencies, else flag a failure. - if ! cat $tmp/dependencies.log | grep $OWNER_NVR; then + if ! grep "$OWNER_NVR" "$tmp/dependencies.log"; then rlFail "$file pointing to $target is a dangling symlink owned by $OWNER_NVR" fi done diff --git a/tests/fp16-abi/test.sh b/tests/fp16-abi/test.sh index 35b99e8..9079123 100755 --- a/tests/fp16-abi/test.sh +++ b/tests/fp16-abi/test.sh @@ -1,15 +1,15 @@ -#!/bin/sh -ux +#!/bin/bash -ux # Do NOT set exit after error flag (set -e). Let all the optimizations to be run tmp=$(mktemp -d) result=0 # Test the reproducer with all the optimization levels for opt_level in 0 1 2 3; do - clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o $tmp/test_O$opt_level - $tmp/test_O$opt_level | grep '0.122986' || result=1 + clang++ --rtlib=compiler-rt -O$opt_level test.cpp -o "${tmp}/test_O${opt_level}" + "${tmp}/test_O${opt_level}" | grep '0.122986' || result=1 done -rm -rf $tmp +rm -rf "$tmp" if [[ "$result" == 1 ]]; then exit 1 fi