From 8490da5aab46c759e2fda733677444b994d4cb7b Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Mon, 22 May 2023 10:47:29 +0200 Subject: [PATCH] Adding new test --- Sanity/smoke-test/hello.tk | 5 +++ Sanity/smoke-test/main.fmf | 31 ++++++++++++++++++ Sanity/smoke-test/runtest.sh | 63 ++++++++++++++++++++++++++++++++++++ Sanity/smoke-test/test.md | 3 ++ 4 files changed, 102 insertions(+) create mode 100755 Sanity/smoke-test/hello.tk create mode 100644 Sanity/smoke-test/main.fmf create mode 100755 Sanity/smoke-test/runtest.sh create mode 100644 Sanity/smoke-test/test.md diff --git a/Sanity/smoke-test/hello.tk b/Sanity/smoke-test/hello.tk new file mode 100755 index 0000000..7fc0dd0 --- /dev/null +++ b/Sanity/smoke-test/hello.tk @@ -0,0 +1,5 @@ +#!/usr/bin/wish + +label .t -text "Hello world!" +button .b -text "Close" -command {destroy .} +pack .t .b diff --git a/Sanity/smoke-test/main.fmf b/Sanity/smoke-test/main.fmf new file mode 100644 index 0000000..3c53263 --- /dev/null +++ b/Sanity/smoke-test/main.fmf @@ -0,0 +1,31 @@ +summary: smoke test +description: '' +contact: Petr Sklenar +component: + - tk +test: ./runtest.sh +framework: beakerlib +recommend: + - tk + - xwininfo + - xorg-x11-server-Xvfb + - xorg-x11-utils +duration: 5m +enabled: true +tag: + - NoRHEL4 + - NoRHEL5 + - TIPfail_infra + - TIPfail_samba + - TIPfail_systemd + - TIPpass + - Tier1 +tier: '1' +adjust: + - enabled: false + when: distro == rhel-4, rhel-5 + continue: false +extra-nitrate: TC#0598798 +extra-summary: /CoreOS/tk/Sanity/smoke-test +extra-task: /CoreOS/tk/Sanity/smoke-test +id: ea51d113-c9c2-46f7-a37b-c6329cb2b337 diff --git a/Sanity/smoke-test/runtest.sh b/Sanity/smoke-test/runtest.sh new file mode 100755 index 0000000..4d21e30 --- /dev/null +++ b/Sanity/smoke-test/runtest.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tk/Sanity/smoke-test +# Description: smoke test +# Author: Jaroslav Škarvada +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="tk" + +# in seconds +SLEEP_TIME="15" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp ./hello.tk $TmpDir/" 0 "Copy Tk script" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlVirtualXStart "tk" + export DISPLAY="$( rlVirtualXGetDisplay \"tk\" )" + rlRun "./hello.tk &" 0 "Running Tk script" + PS_TK="$!" + rlRun "sleep $SLEEP_TIME" 0 "Sleeping for $SLEEP_TIME s" + rlRun "xwininfo -name \"hello.tk\"" 0 "Looking for Tk window" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "kill $PS_TK" 0,1 "Killing Tk" + rlVirtualXStop "tk" + rlRun "sleep $SLEEP_TIME" 0 "Sleeping for $SLEEP_TIME s" + rlRun "kill -9 $PS_TK" 0,1 "Hard killing possible leftover processes" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/smoke-test/test.md b/Sanity/smoke-test/test.md new file mode 100644 index 0000000..e613283 --- /dev/null +++ b/Sanity/smoke-test/test.md @@ -0,0 +1,3 @@ +# Setup +Unreliable test case, rerun in beaker if fails. +