Import gating tests

Relates: rhbz 2024339
This commit is contained in:
Josh Boyer 2023-04-04 14:47:03 -04:00
parent c10d47f4bd
commit 7683fb357e
7 changed files with 125 additions and 2 deletions

19
tests/scripts/correct-elf.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
PATH=/usr/bin
TMUX=/usr/bin/tmux
echo -n "checking to see that ${TMUX} is an ELF executable..."
case "$(file -b --mime-type "${TMUX}")" in
application/x-executable|application/x-pie-executable|application/x-sharedlib)
echo "ok"
RET=0
;;
*)
echo "FAIL"
RET=1
;;
esac
exit ${RET}

16
tests/scripts/exists.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
PATH=/usr/bin
TMUX=/usr/bin/tmux
echo -n "checking to see that ${TMUX} exists..."
if [ -f "${TMUX}" ]; then
echo "ok"
RET=0
else
echo "FAIL"
RET=1
fi
exit ${RET}

View File

@ -0,0 +1,19 @@
#!/bin/sh
PATH=/usr/bin
TMUX=/usr/bin/tmux
echo -n "verifying ${TMUX}'s filename contains all lowercase letters..."
BASETMUX="$(basename $(stat -L -c "%n" ${TMUX}))"
LOWERTMUX="$(echo "${BASETMUX}" | tr [A-Z] [a-z])"
if [ "${BASETMUX}" = "${LOWERTMUX}" ]; then
echo "ok"
RET=0
else
echo "FAIL"
RET=1
fi
exit ${RET}

21
tests/scripts/help-output.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
PATH=/usr/bin
TMUX=/usr/bin/tmux
echo -n "checking for ${TMUX} --help output and exit code..."
STDOUT="$(${TMUX} --help 2>/dev/null)"
STDERR="$(${TMUX} --help 2>&1 | head -n 1 | cut -c-11)"
${TMUX} --help >/dev/null 2>&1
EXITCODE=$?
if [ ${EXITCODE} -eq 1 ] && [ -z "${STDOUT}" ] && [ "${STDERR}" = "usage: tmux" ]; then
echo "ok"
RET=0
else
echo "FAIL"
RET=1
fi
exit ${RET}

23
tests/scripts/launch-top.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
PATH=/usr/bin
TMUX=/usr/bin/tmux
SESSION_NAME="$(basename $0 .sh)"
RET=0
echo -n "checking that ${TMUX} can start a new session with 'top'..."
${TMUX} new-session -d -s ${SESSION_NAME} 'top' || ( echo "FAIL" ; exit 1 )
TOPPID=$(pgrep -x top)
PGREPCODE=$?
if [ -z "${TOPPID}" ] || [ ${PGREPCODE} -ne 0 ]; then
RET=1
elif [ ! -d /proc/${TOPPID} ]; then
RET=1
fi
${TMUX} kill-session -t ${SESSION_NAME} || ( echo "FAIL" ; exit 1 )
[ ${RET} -eq 0 ] && echo "ok" || echo "FAIL"
exit ${RET}

25
tests/tests.yml Normal file
View File

@ -0,0 +1,25 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- tmux
tests:
- exists:
dir: scripts/
run: ./exists.sh
- correct-elf:
dir: scripts/
run: ./correct-elf.sh
- filename-lowercase:
dir: scripts/
run: ./filename-lowercase.sh
- help-output:
dir: scripts/
run: ./help-output.sh
- launch-top:
dir: scripts/
run: ./launch-top.sh

View File

@ -2,7 +2,7 @@
Name: tmux
Version: 2.7
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A terminal multiplexer
Group: Applications/System
@ -65,7 +65,7 @@ fi
%{_datadir}/bash-completion/completions/tmux
%changelog
* Tue Apr 04 2023 Josh Boyer <jwboyer@redhat.com> - 2.7-2
* Tue Apr 04 2023 Josh Boyer <jwboyer@redhat.com> - 2.7-3
- Backport fix for intermittent stalling bug
Resolves: rhbz 2024339