Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AlmaLinux support #98

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ if [ -e skipped-tests.list ] ;then
fi

# process our test scripts

t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' )
if [ $# -gt 0 ]; then
t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' )
t_Process <(/usr/bin/find ./tests/$1/ -type f|sort -t'/' )
else
t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' )
t_Process <(/usr/bin/find ./tests/p_*/ -type f|sort -t'/' )
t_Process <(/usr/bin/find ./tests/r_*/ -type f|sort -t'/' )
t_Process <(/usr/bin/find ./tests/z_*/ -type f|sort -t'/' )
if [ -z "$skip_r_tests" ]; then
t_Process <(/usr/bin/find ./tests/r_*/ -type f|sort -t'/' )
fi
# For now we skipping these tests on AlmaLinux
if [ -z "$skip_z_tests" ]; then
t_Process <(/usr/bin/find ./tests/z_*/ -type f|sort -t'/' )
fi
fi

# and, we're done.
Expand Down
4 changes: 2 additions & 2 deletions tests/0_common/01_dist_release_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Just a check to determine full version (example 5.8) or just dist (example 6)

export qa_dist=$(rpm -q --queryformat '%{version}\n' centos-release)
export qa_releasever=$(rpm -q --queryformat '%{version}.' centos-release ; rpm -q --queryformat '%{release}\n' centos-release|cut -f 1 -d '.')
export qa_dist=$(rpm -q --queryformat '%{version}\n' $vendor-release)
export qa_releasever=$(rpm -q --queryformat '%{version}.' $vendor-release ; rpm -q --queryformat '%{release}\n' $vendor-release|cut -f 1 -d '.')
55 changes: 55 additions & 0 deletions tests/0_lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ function t_StreamCheck
# set stream variable
centos_stream=$(t_StreamCheck)

function t_GetMinorVer
{
rpm -q $(rpm -qf /etc/redhat-release) --queryformat '%{version}\n'|cut -f 2 -d '.'
}

# Description: skip test on a particular release
# Arguments: release, reason
function t_SkipRelease {
Expand Down Expand Up @@ -221,6 +226,7 @@ function t_Assert_Equals
[ $1 -eq $2 ]
t_CheckExitStatus $?
}

function t_Select_Alternative
{
name=$1
Expand All @@ -233,6 +239,46 @@ function t_Select_Alternative
t_Log "Selecing alternative $option for $name--$search"
/bin/echo "$option"|/usr/sbin/alternatives --config "$name" >/dev/null 2>&1
}

if [[ "$centos_ver" -eq 8 ]] ; then
key_ver="201"
elif [[ "$centos_ver" -eq 9 ]] ; then
key_ver="201"
fi

os_id=$(source /etc/os-release; echo $ID)
skip_z_tests=0
skip_r_tests=0

case $os_id in
almalinux)
# AlmaLinux variables
vendor="almalinux"
os_name="AlmaLinux"
grub_sb_token='AlmaLinux OS Foundation'
kernel_sb_token=$grub_sb_token
key_template="AlmaLinux %s signing key"
firefox_start_page="www.almalinux.org"
minor_ver=$(t_GetMinorVer)
skip_z_tests=1
export minor_ver
;;
centos)
# CentOS variables
vendor="centos"
os_name="CentOS"
grub_sb_token='CentOS Secure Boot Signing 202'
kernel_sb_token="CentOS Secure Boot Signing 201"
key_template="CentOS \(Linux \)\?%s signing key"
firefox_start_page="www.centos.org"
;;
*)
# Exit in default case
t_Log "Unknown OS ID: $os_id"
exit 1
;;
esac

export -f t_Log
export -f t_CheckExitStatus
export -f t_InstallPackage
Expand All @@ -258,6 +304,15 @@ export -f t_Select_Alternative
export centos_ver
export centos_stream
export arch
export vendor
export os_name
export grub_sb_token
export firefox_start_page
export key_template
export kernel_sb_token
export skip_z_tests
export skip_r_tests

if [ -z "$CONTAINERTEST" ]; then
export CONTAINERTEST=0
fi
2 changes: 1 addition & 1 deletion tests/p_centos-release/centos-release_centos-base_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
t_Log "Running $0 - CentOS Base repos sanity test."

# grep "name=CentOS" /etc/yum.repos.d/CentOS*-Base*.repo >/dev/null 2>&1
grep "name=CentOS" /etc/yum.repos.d/*.repo >/dev/null 2>&1
grep "name=$os_name" /etc/yum.repos.d/*.repo >/dev/null 2>&1

t_CheckExitStatus $?
5 changes: 2 additions & 3 deletions tests/p_centos-release/centos-release_centos_gpg.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/sh
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - CentOS RPM GPG Keys exist."
t_Log "Running $0 - $os_name RPM GPG Keys exist."

file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS* >/dev/null 2>&1 && \
file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Security* >/dev/null 2>&1
file "/etc/pki/rpm-gpg/RPM-GPG-KEY-$os_name*" >/dev/null 2>&1

t_CheckExitStatus $?
1 change: 1 addition & 0 deletions tests/p_centos-release/centos-release_issue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - /etc/issue* has correct branding"

if [ "$centos_ver" -ge 7 ] ; then
t_Log "CentOS $centos_ver -> SKIP"
exit 0
Expand Down
9 changes: 5 additions & 4 deletions tests/p_centos-release/centos-release_os-release.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
# Author: Fabian Arrotin <[email protected]>

t_Log "Running $0 - /etc/os-release has correct ABRT string for CentOS $centos_ver"
t_Log "Running $0 - /etc/os-release has correct ABRT string for $os_name $centos_ver"

lines_to_check="${os_name^^}_MANTISBT_PROJECT=\"$os_name-$centos_ver\" ${os_name^^}_MANTISBT_PROJECT_VERSION=\"$centos_ver.$minor_ver\""

if [ "$centos_ver" -ge 7 ];then
if [[ $centos_stream == "no" ]]; then
for string in CENTOS_MANTISBT_PROJECT=\"CentOS-$centos_ver\" CENTOS_MANTISBT_PROJECT_VERSION=\"$centos_ver\"
for string in $lines_to_check
do
grep -q $string /etc/os-release
if [ $? -ne "0" ];then
Expand All @@ -28,8 +30,7 @@ if [ "$centos_ver" -ge 7 ];then
done
fi
else
echo "Skipping for CentOS 5 and 6 ..." ; exit 0

echo "Skipping for CentOS 5 and 6 ..." ; exit 0
fi

t_CheckExitStatus $?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - /etc/centos-release compatibility symbolic links test."
t_Log "Running $0 - /etc/$vendor-release compatibility symbolic links test."

if [ "$centos_ver" -ge 6 ]
then
grep "CentOS" /etc/centos-release >/dev/null 2>&1
(file /etc/redhat-release | grep -E "symbolic link to .?centos-release.?" >/dev/null 2>&1) &&\
(file /etc/system-release | grep -E "symbolic link to .?centos-release.?" >/dev/null 2>&1)
grep $os_name /etc/$vendor-release >/dev/null 2>&1
(file /etc/redhat-release | grep -E "symbolic link to .?$vendor-release.?" >/dev/null 2>&1) &&\
(file /etc/system-release | grep -E "symbolic link to .?$vendor-release.?" >/dev/null 2>&1)
else
echo "This test is not comptatible with CentOS <= 5"
fi
Expand Down
4 changes: 2 additions & 2 deletions tests/p_centos-release/centos-release_system_release.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/sh
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - /etc/centos-release has correct branding"
t_Log "Running $0 - /etc/$vendor-release has correct branding"

if [ "$centos_ver" = "5" ] ; then
grep "CentOS" /etc/redhat-release >/dev/null 2>&1
else
grep "CentOS" /etc/centos-release >/dev/null 2>&1
grep $os_name /etc/$vendor-release >/dev/null 2>&1
fi

t_CheckExitStatus $?
Expand Down
7 changes: 4 additions & 3 deletions tests/p_firefox/10-check_default_startpage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Author: Christoph Galuschka <[email protected]>

# Check for centos.org in preferences.js
t_Log "Running $0 - firefox has www.centos.org as default page."

t_Log "Running $0 - firefox has $firefox_start_page as default page."

if (t_GetArch firefox | grep -q 'x86_64')
then
Expand All @@ -11,9 +12,9 @@ if (t_GetArch firefox | grep -q 'x86_64')
path='/usr/lib/firefox/defaults/preferences/all-redhat.js'
fi

count=$(grep -c www.centos.org $path)
count=$(grep -c $firefox_start_page $path)

if [ $count=2 ]
if [ $count -eq 2 ]
eabdullin1 marked this conversation as resolved.
Show resolved Hide resolved
then
t_CheckExitStatus 0
else
Expand Down
3 changes: 2 additions & 1 deletion tests/p_grub2/01_grub2_secureboot_signed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ t_Log "Running $0 - Verifying that grub2-efi is correctly signed with correct c

arch=$(uname -m)


if [[ "$centos_ver" -ge 7 && "$arch" = "x86_64" ]] ; then
t_InstallPackage pesign grub2-efi-x64
pesign --show-signature --in /boot/efi/EFI/centos/grubx64.efi|egrep -q 'CentOS Secure Boot Signing 202'
pesign --show-signature --in /boot/efi/EFI/$vendor/grubx64.efi|egrep -q "$grub_sb_token"
t_CheckExitStatus $?
else
t_Log "previous versions than CentOS 7 - or not x86_64 arch - aren't using secureboot ... skipping"
Expand Down
4 changes: 2 additions & 2 deletions tests/p_httpd/httpd_centos_brand_server_tokens.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - httpd: centos branding / Server tokens value "
t_Log "Running $0 - httpd: $os_name branding / Server tokens value "

curl -sI http://localhost/ | grep -i "Server:\ Apache.*\ (CentOS" > /dev/null 2>&1
curl -sI http://localhost/ | grep -i "Server:\ Apache.*\ ($os_name" > /dev/null 2>&1

t_CheckExitStatus $?
4 changes: 2 additions & 2 deletions tests/p_httpd/httpd_centos_brand_welcome.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# Author: Athmane Madjoudj <[email protected]>

t_Log "Running $0 - httpd: Welcome page has CentOS Branding."
t_Log "Running $0 - httpd: Welcome page has $os_name Branding."

curl -s http://localhost/ | grep 'CentOS' > /dev/null 2>&1
curl -s http://localhost/ | grep "$os_name" > /dev/null 2>&1

t_CheckExitStatus $?
2 changes: 1 addition & 1 deletion tests/p_java-openjdk/p_java-openjdk-common
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[ ${centos_ver} -lt 7 ] && { t_Log "Multiple java versions test is only available since el7, skipping tests..." ; exit ; }

if [ ${centos_ver} -eq 8 ];then
JAVA_VERSIONS="1.8.0 11"
JAVA_VERSIONS="1.8.0 11 17"
elif [ ${centos_ver} -eq 9 ];then
JAVA_VERSIONS="1.8.0 11 17"
else
Expand Down
11 changes: 7 additions & 4 deletions tests/p_kernel/01_kernel_centos_keyring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Author: Athmane Madjoudj <[email protected]>
# Note: This was a known issue with CentOS 6.0 GA kernel

t_Log "Running $0 - check CentOS' Kernel Module GPG key."
t_Log "Running $0 - check $os_name Kernel Module GPG key."

uname_arch=$(uname -m)
uname_kernel=$(uname -r)
Expand All @@ -27,12 +27,15 @@ if [ "$centos_ver" -ge 7 ] ; then
fi
for id in kpatch "Driver update" kernel
do
t_Log "Verifying x.509 CentOS ${id}"
keyctl list %:$ring | grep -i "CentOS \(Linux \)\?${id} signing key" > /dev/null 2>&1
t_Log "Verifying x.509 $os_name ${id}"
key=$(printf "$key_template" "$id")
keyctl list %:$ring | grep -i "$key" > /dev/null 2>&1
t_CheckExitStatus $?
done
else
grep 'User ID: CentOS (Kernel Module GPG key)' /var/log/dmesg > /dev/null 2>&1
user_id="User ID: $os_name (Kernel Module GPG key)"
grep "$user_id" /var/log/dmesg > /dev/null 2>&1

t_CheckExitStatus $?
fi

11 changes: 1 addition & 10 deletions tests/p_kernel/02_kernel_secureboot_signed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ if [[ "$centos_ver" -ge 7 && "$arch" = "x86_64" ]] ; then
for kernel in $(rpm -q kernel --queryformat '%{version}-%{release}.%{arch}\n')
do
t_Log "Validating kernel $kernel ..."
if [[ "$centos_ver" -eq 8 ]] ; then
key_ver="201"
elif [[ "$centos_ver" -eq 9 ]] ; then
key_ver="201"
fi
if [[ "$centos_ver" -ge 8 && "$kernel" > "4.18.0-480.el8" ]] ; then
pesign --show-signature --in /boot/vmlinuz-${kernel}|egrep -q "Red Hat Inc.|CentOS Secure Boot Signing $key_ver"
else
pesign --show-signature --in /boot/vmlinuz-${kernel}|egrep -q 'Red Hat Inc.|CentOS Secure Boot \(key 1\)'
fi
pesign --show-signature --in /boot/vmlinuz-${kernel}|egrep -q "$kernel_sb_token"
t_CheckExitStatus $?
done
else
Expand Down
6 changes: 3 additions & 3 deletions tests/p_lsb/lsb_release_brand_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ then
exit $PASS
fi

t_Log "Running $0 - LSB CentOS branding check."
t_Log "Running $0 - LSB $os_name branding check."

lsb_release -i | grep -q "CentOS" && \
lsb_release -d | grep -q "CentOS"
lsb_release -i | grep -q "$os_name" && \
lsb_release -d | grep -q "$os_name"

t_CheckExitStatus $?
4 changes: 2 additions & 2 deletions tests/p_shim/01_shim_secureboot_signed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ t_Log "Running $0 - Verifying that shim.efi is correctly signed with correct ce

if [[ "$centos_ver" = "7" && "$arch" = "x86_64" ]] ; then
t_InstallPackage pesign shim
pesign --show-signature --in /boot/efi/EFI/centos/shim.efi|grep -q 'Microsoft Windows UEFI Driver Publisher'
pesign --show-signature --in /boot/efi/EFI/$vendor/shim.efi|grep -q 'Microsoft Windows UEFI Driver Publisher'
t_CheckExitStatus $?
elif [[ "$centos_ver" -ge "8" && "$arch" = "x86_64" ]] ; then
t_InstallPackage pesign shim
pesign --show-signature --in /boot/efi/EFI/centos/shimx64.efi |grep -q 'Microsoft Windows UEFI Driver Publisher'
pesign --show-signature --in /boot/efi/EFI/$vendor/shimx64.efi |grep -q 'Microsoft Windows UEFI Driver Publisher'
t_CheckExitStatus $?
else
t_Log "previous versions than CentOS 7 - or not x86_64 arch - aren't using shim/secureboot ... skipping"
Expand Down
4 changes: 2 additions & 2 deletions tests/r_pdf/01_pdf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ t_Log "Running $0 - Create PDF from postscript from text, and convert PDF back t
if [ "$centos_ver" = "5" ] ;then
FILE=/etc/redhat-release
else
FILE=/etc/centos-release
FILE=/etc/$vendor-release
fi
FIND='CentOS'
FIND="$os_name"
PS_FILE=/var/tmp/test.ps
PDF_FILE=/var/tmp/test.pdf
TEST_FILE=/var/tmp/result
Expand Down
Loading