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/.gitignore b/.gitignore index 12b6e72..c4e4516 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ /spausedd-20190320.tar.gz +/spausedd-20190807.tar.gz +/spausedd-20200323.tar.gz +/spausedd-20201110.tar.gz +/spausedd-20201112.tar.gz +/spausedd-20210326.tar.gz +/spausedd-20210511.tar.gz +/spausedd-20210520.tar.gz +/spausedd-20210719.tar.gz 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 index 012ba75..a4d0712 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (spausedd-20190320.tar.gz) = a7f9863355a3106ea61c8b7e512c2bc895c8b5b07fb3d26f8feec8f963abb7a95230f83f9d27c6ac3aedaa9d91c6fb700bacc1ca59adfa769876168296241599 +SHA512 (spausedd-20210719.tar.gz) = e2a05fd0d9ff4620848fe51d2d06e9c81b9f1553bb092a5e5ac229dc96d3bbd73b9aa2e1c6832e1625cfa8e033844701cdf3c3b7c053213fea167d33bd2bfc90 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 index 1effaf8..29d3b2a 100644 --- a/spausedd.spec +++ b/spausedd.spec @@ -2,20 +2,28 @@ Name: spausedd Summary: Utility to detect and log scheduler pause -Version: 20190320 -Release: 1%{?dist} +Version: 20210719 +Release: 11%{?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 +# 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 +BuildRequires: make +BuildRequires: git %{?systemd_requires} BuildRequires: systemd @@ -27,23 +35,22 @@ BuildRequires: pkgconfig(vmguestlib) Utility to detect and log scheduler pause %prep -%setup -q -n %{name}-%{version} +%autosetup -S git_am %build %set_build_flags -make \ +%make_build \ %if %{defined use_vmguestlib} WITH_VMGUESTLIB=1 \ %else WITH_VMGUESTLIB=0 \ %endif - %{?_smp_mflags} %install -make DESTDIR="%{buildroot}" PREFIX="%{_prefix}" install +%make_install PREFIX="%{_prefix}" mkdir -p %{buildroot}/%{_unitdir} -install -m 755 -p init/%{name}.service %{buildroot}/%{_unitdir} +install -m 644 -p init/%{name}.service %{buildroot}/%{_unitdir} %clean @@ -64,6 +71,89 @@ install -m 755 -p init/%{name}.service %{buildroot}/%{_unitdir} %systemd_postun spausedd.service %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 20210719-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Sun Jan 19 2025 Fedora Release Engineering - 20210719-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Sat Jul 20 2024 Fedora Release Engineering - 20210719-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Sat Jan 27 2024 Fedora Release Engineering - 20210719-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 20210719-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Jun 06 2023 Jan Friesse - 20210719-6 +- migrated to SPDX license + +* Sat Jan 21 2023 Fedora Release Engineering - 20210719-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 20210719-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sat Jan 22 2022 Fedora Release Engineering - 20210719-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 20210719-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jul 19 2021 Jan Friesse - 20210719-1 +- Add mode option for moving to root cgroup functionality + +* Thu May 20 2021 Jan Friesse - 20210520-1 +- Document cgroup v2 problems + +* Tue May 11 2021 Jan Friesse - 20210511-1 +- Support for cgroup v2 + +* Fri Mar 26 2021 Jan Friesse - 20210326-1 +- Fix possible memory leak +- Check memlock rlimit + +* Wed Jan 27 2021 Fedora Release Engineering - 20201112-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Nov 12 2020 Jan Friesse - 20201112-1 +- Add ability to move process into root cgroup +- Rebase to new version + +* Tue Nov 10 2020 Jan Friesse - 20201110-1 +- Fix log_perror +- Rebase to new version + +* 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 diff --git a/tests/plan.fmf b/tests/plan.fmf new file mode 100644 index 0000000..c9c6610 --- /dev/null +++ b/tests/plan.fmf @@ -0,0 +1,9 @@ +summary: Run all smoke tests +discover: + how: fmf +execute: + how: tmt +prepare: + how: install + package: + - spausedd diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..c431594 --- /dev/null +++ b/tests/smoke/main.fmf @@ -0,0 +1,2 @@ +summary: Basic smoke test +test: ./runtest.sh diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100755 index 0000000..9b81cac --- /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 -t "spausedd" -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