From b26f672937dc6c3ec63582686c07e4146f11d1a8 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Sat, 11 May 2024 12:43:44 +0900 Subject: [PATCH] Add CI --- .fmf/version | 1 + libdbusmenu.spec | 8 +++++++- plans/test.fmf | 5 +++++ tests/test-glib-simple-items/main.fmf | 8 ++++++++ tests/test-glib-simple-items/test.sh | 26 ++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 plans/test.fmf create mode 100644 tests/test-glib-simple-items/main.fmf create mode 100755 tests/test-glib-simple-items/test.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/libdbusmenu.spec b/libdbusmenu.spec index e9de3dd..7e5a8f7 100644 --- a/libdbusmenu.spec +++ b/libdbusmenu.spec @@ -16,7 +16,7 @@ Name: libdbusmenu Version: %{ubuntu_release}.0 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Library for passing menus over DBus # All files installed in final rpms use C sources with dual licensing headers. @@ -52,6 +52,9 @@ BuildRequires: pkgconfig(gtk+-3.0) >= 2.91 BuildRequires: pkgconfig(json-glib-1.0) >= 0.13.4 BuildRequires: pkgconfig(x11) >= 1.3 BuildRequires: vala +%if 0%{?rhel} > 9 +BuildRequires: xorg-x11-server-Xvfb +%endif # pkgconfig file is checked for valgrind, but is actually only used for tests # https://bugzilla.redhat.com/show_bug.cgi?id=1262274 @@ -281,6 +284,9 @@ done %{_datadir}/%{name}/json/test-gtk-label.json %changelog +* Sat May 11 2024 Takao Fujiwara - 16.04.0-28 +- Add CI + * Thu Jan 25 2024 Fedora Release Engineering - 16.04.0-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/plans/test.fmf b/plans/test.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/test.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/test-glib-simple-items/main.fmf b/tests/test-glib-simple-items/main.fmf new file mode 100644 index 0000000..d1cb924 --- /dev/null +++ b/tests/test-glib-simple-items/main.fmf @@ -0,0 +1,8 @@ +summary: libdbusmenu-gtk3-tests tests +test: ./test.sh +framework: beakerlib +require: + - tmt + - git + - libdbusmenu-gtk3-tests + - xorg-x11-server-Xvfb diff --git a/tests/test-glib-simple-items/test.sh b/tests/test-glib-simple-items/test.sh new file mode 100755 index 0000000..411595b --- /dev/null +++ b/tests/test-glib-simple-items/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "pushd $tmp" + rlRun "export DISPLAY=:99.0" + rlRun "/usr/bin/Xvfb $DISPLAY -noreset +extension GLX +extension RANDR +extension RENDER -screen 0 1280x1024x24 &" + rlRun "echo $! > X_PID" + rlRun "sleep 5" + rlRun "set -o pipefail" + rlPhaseEnd + + rlPhaseStartTest + rlRun "export DISPLAY=:99.0" + rlRun "/usr/libexec/libdbusmenu-gtk3/test-glib-simple-items >output 2>&1" 0 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "kill -9 $(cat X_PID)" + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd