From 2b4c66e2fdd7b05d78e180e7f50dee0907098d5a Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Mon, 2 Nov 2020 16:57:35 +0100 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/spausedd.git#282f830b23e8d4b32c542800de005310b1d30c21 --- .gitignore | 3 + README.md | 3 + gating.yaml | 15 +++++ sources | 1 + spausedd.rpmlintrc | 2 + spausedd.spec | 130 ++++++++++++++++++++++++++++++++++++++++ tests/.gitignore | 3 + tests/smoke/runtest.sh | 133 +++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 9 +++ 9 files changed, 299 insertions(+) create mode 100644 README.md create mode 100644 gating.yaml create mode 100644 sources create mode 100644 spausedd.rpmlintrc create mode 100644 spausedd.spec create mode 100644 tests/.gitignore create mode 100644 tests/smoke/runtest.sh create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index e69de29..8444873 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,3 @@ +/spausedd-20190320.tar.gz +/spausedd-20190807.tar.gz +/spausedd-20200323.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..97b9868 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# spausedd + +Scheduler Pause Detection Daemon \ No newline at end of file diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..f075ad7 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,15 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_testing +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/sources b/sources new file mode 100644 index 0000000..5a12702 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (spausedd-20200323.tar.gz) = 5c3f8bce63f5a05305d2d51f1108b72c8a3755a6121fd1ae7a5499efae2d46a81df16b43bcec56abdb88a8cdac21a0568d6f70bbeaae6490e2b288a1fc21e671 diff --git a/spausedd.rpmlintrc b/spausedd.rpmlintrc new file mode 100644 index 0000000..6cefe62 --- /dev/null +++ b/spausedd.rpmlintrc @@ -0,0 +1,2 @@ +# Empty %postun +addFilter(r'W: empty-%postun') diff --git a/spausedd.spec b/spausedd.spec new file mode 100644 index 0000000..78e3edb --- /dev/null +++ b/spausedd.spec @@ -0,0 +1,130 @@ +%bcond_without vmguestlib + +Name: spausedd +Summary: Utility to detect and log scheduler pause +Version: 20200323 +Release: 4%{?dist} +License: ISC +URL: https://github.com/jfriesse/spausedd +Source0: https://github.com/jfriesse/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz + +# VMGuestLib exists only for x86 architectures (for Fedora) and x86_64 (for RHEL) +%if %{with vmguestlib} +%if 0%{?rhel} >= 6 +%ifarch x86_64 +%global use_vmguestlib 1 +%endif +%else +%ifarch %{ix86} x86_64 +%global use_vmguestlib 1 +%endif +%endif +%endif + +BuildRequires: gcc +%{?systemd_requires} +BuildRequires: systemd + +%if %{defined use_vmguestlib} +BuildRequires: pkgconfig(vmguestlib) +%endif + +%description +Utility to detect and log scheduler pause + +%prep +%setup -q -n %{name}-%{version} + +%build +%set_build_flags +%make_build \ +%if %{defined use_vmguestlib} + WITH_VMGUESTLIB=1 \ +%else + WITH_VMGUESTLIB=0 \ +%endif + +%install +%make_install PREFIX="%{_prefix}" + +mkdir -p %{buildroot}/%{_unitdir} +install -m 644 -p init/%{name}.service %{buildroot}/%{_unitdir} + +%clean + +%files +%doc AUTHORS +%license COPYING +%{_bindir}/%{name} +%{_mandir}/man8/* +%{_unitdir}/spausedd.service + +%post +%systemd_post spausedd.service + +%preun +%systemd_preun spausedd.service + +%postun +%systemd_postun spausedd.service + +%changelog +* Tue Sep 22 2020 Jan Friesse - 20200323-4 +- Fix build for ELN + +* Wed Jul 29 2020 Fedora Release Engineering - 20200323-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 22 2020 Jan Friesse - 20200323-2 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + +* Mon Mar 23 2020 Jan Friesse - 20200323-1 +- Enhance man page +- Add CI tests +- Enable gating +- Rebase to new version + +* Thu Jan 30 2020 Fedora Release Engineering - 20190807-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Aug 07 2019 Jan Friesse - 20190807-1 +- Enhance makefile +- Rebase to new version + +* Tue Aug 06 2019 Jan Friesse - 20190320-3 +- Do not set exec permission for service file + +* Fri Jul 26 2019 Fedora Release Engineering - 20190320-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Mar 20 2019 Jan Friesse - 20190320-1 +- Use license macro in spec file + +* Tue Mar 19 2019 Jan Friesse - 20190319-1 +- Add AUTHORS and COPYING +- Fix version number in specfile +- Use install -p to preserve timestamps +- Use set_build_flags macro +- Rebase to new version + +* Mon Mar 18 2019 Jan Friesse - 20190318-2 +- Initial version for Fedora + +* Mon Mar 18 2019 Jan Friesse - 20190318-1 +- Require VMGuestLib only on x86 and x86_64 + +* Wed Mar 21 2018 Jan Friesse - 20180321-1 +- Remove exlusivearch for VMGuestLib. +- Add copr branch with enhanced spec file which tries to automatically + detect what build options should be used (systemd/vmguestlib). + +* Tue Mar 20 2018 Jan Friesse - 20180320-1 +- Add support for VMGuestLib +- Add more examples + +* Mon Feb 19 2018 Jan Friesse - 20180219-1 +- Add support for steal time + +* Fri Feb 9 2018 Jan Friesse - 20180209-1 +- Initial version diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..e6c79fd --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,3 @@ +# Ignore tests runs/artefacts. +artifacts/** +**/*.retry diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100644 index 0000000..fba378d --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +# Copyright (c) 2019, Red Hat, Inc. +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND RED HAT, INC. DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RED HAT, INC. BE LIABLE +# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# +# Author: Jan Friesse + +# Home https://github.com/jfriesse/csts/tree/master/smoke + +# -e is really important +set -xe +set -o pipefail + +# Variables changing test behavior +MAX_REPEATS=60 +SLEEP=5 + +# Start of the test (for journalctl) +JOURNAL_DATE_SINCE=$(date +"%F %T") + +#################### +# Helper functions # +#################### + +# service_start service +service_start() { + # service service must be inactive + systemctl is-active "$1" && exit 1 || true + + systemctl start "$1" + + systemctl is-active "$1" +} + +# service_stop service +service_stop() { + systemctl is-active "$1" || exit 1 + + systemctl stop "$1" + + systemctl is-active "$1" && exit 1 || true +} + +# wait_for_log_msg message +wait_for_log_msg() { + local cont=true + local repeats=0 + + journalctl --since "$JOURNAL_DATE_SINCE" | cat + + while $cont;do + if journalctl _SYSTEMD_UNIT=spausedd.service -o cat --since "$JOURNAL_DATE_SINCE" | grep "$1";then + cont=false + else + sleep 1 + repeats=$((repeats+1)) + [ "$repeats" -le "$MAX_REPEATS" ] || return 1 + fi + done +} + +################## +# Test functions # +################## + +test_spausedd_h() { + # Check that spausedd binary exists and -h returns help text + res=`spausedd -h || true` + [ "$res" != "${res/usage/}" ] +} + +test_spausedd_start() { + service_start "spausedd" + + wait_for_log_msg 'Running main poll loop with maximum timeout .* and steal threshold .*%' +} + +test_spausedd_stop() { + service_stop "spausedd" + + wait_for_log_msg 'During .*s runtime spausedd was .*x not scheduled on time' +} + +test_sig_stop() { + local cont=true + local repeats=0 + + spausedd_pid=$(systemctl show spausedd -p "MainPID") + spausedd_pid=${spausedd_pid##*=} + + while $cont;do + # Wait a while for full start + sleep $SLEEP + + kill -STOP "$spausedd_pid" + sleep $SLEEP + kill -CONT "$spausedd_pid" + + if wait_for_log_msg 'Not scheduled for .*s (threshold is .*s), steal time is ';then + cont=false + else + repeats=$((repeats+1)) + [ "$repeats" -le "$MAX_REPEATS" ] + fi + done +} + +test_man_page() { + man -w "spausedd" +} + +######## +# main # +######## +test_spausedd_h +test_man_page + +test_spausedd_start + +test_sig_stop + +test_spausedd_stop diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..2dbaeec --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,9 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - smoke + required_packages: + - spausedd