Add tests in test_speccheck
This commit contains tests added in the test_speccheck, - test_check_prereq_use - test_check_patch_fuzz_is_changed
This commit is contained in:
parent
e485305ad0
commit
a77923124e
|
@ -0,0 +1,34 @@
|
|||
%define _default_patch_fuzz 2
|
||||
Name: patch-fuzz-is-changed
|
||||
Version: 1.0
|
||||
Release: 0
|
||||
Summary: patch-fuzz-is-changed warning
|
||||
License: MIT
|
||||
URL: https://www.example.com
|
||||
Source: Source.tar.gz
|
||||
BuildRequires: gcc
|
||||
|
||||
%description
|
||||
The internal patch fuzz value was changed, and could hide patchs issues, or
|
||||
could lead to applying a patch at the wrong location. Usually, this is often
|
||||
the sign that someone didn't check if a patch is still needed and do not want
|
||||
to rediff it. It is usually better to rediff the patch and try to send it
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%post
|
||||
%postun
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
%doc ChangeLog README
|
||||
|
||||
%changelog
|
|
@ -0,0 +1,35 @@
|
|||
Name: prereq_use
|
||||
Version: 0
|
||||
Release: 0
|
||||
Summary: prereq_use warning
|
||||
License: GPL-2.0-only
|
||||
Group: Undefined
|
||||
URL: http://rpmlint.zarb.org/#%{name}
|
||||
Source0: Source0.tar.gz
|
||||
Patch0: Patch0.patch
|
||||
PreReq(pre): none
|
||||
PreReq(post): none_other
|
||||
|
||||
%description
|
||||
The use of PreReq is deprecated. In the majority of cases, a plain Requires
|
||||
is enough and the right thing to do. Sometimes Requires(pre), Requires(post),
|
||||
Requires(preun) and/or Requires(postun) can also be used instead of PreReq.
|
||||
|
||||
%prep
|
||||
cd lib
|
||||
|
||||
%autopatch
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
%ifarch
|
||||
# apply patch0
|
||||
%patch0 -p0
|
||||
%endif
|
||||
|
||||
%files
|
||||
%{_libdir}/foo
|
||||
|
||||
%changelog
|
|
@ -496,7 +496,37 @@ def test_check_hardcoded_prefix_tag_not_applied(package, speccheck):
|
|||
assert 'W: hardcoded-prefix-tag' not in out
|
||||
|
||||
|
||||
# TODO: Add test for PreReq check.
|
||||
@pytest.mark.parametrize('package', ['spec/prereq_use'])
|
||||
def test_check_prereq_use(package, speccheck):
|
||||
"""Test if specfile has tags such as PreReq(pre)
|
||||
or PreReq(post).
|
||||
"""
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'E: prereq-use none' in out
|
||||
assert 'E: prereq-use none_other' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/patch-not-applied'])
|
||||
def test_check_prereq_use_not_found(package, speccheck):
|
||||
"""Test if specfile has no PreReq tag value."""
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'E: prereq-use' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/mixed-use-of-spaces-and-tabs'])
|
||||
def test_check_prereq_use_not_applied(package, speccheck):
|
||||
"""Test if specfile has no PreReq tag value."""
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'E: prereq-use' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/buildprereq-use'])
|
||||
|
@ -945,7 +975,34 @@ def test_check_dwdd_not_applied(package, speccheck):
|
|||
assert 'W: depscript-without-disabling-depgen' not in out
|
||||
|
||||
|
||||
# TODO: Add test for patch-fuzz-is-changed
|
||||
@pytest.mark.parametrize('package', ['spec/patch-fuzz-is-changed'])
|
||||
def test_check_patch_fuzz_is_changed(package, speccheck):
|
||||
"""Test if specfile has internal/default patch fuzz value changed as
|
||||
%define _default_patch_fuzz >= 0.
|
||||
"""
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'W: patch-fuzz-is-changed' in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/SpecCheckTemp'])
|
||||
def test_check_patch_fuzz_is_changed_not_found(package, speccheck):
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'W: patch-fuzz-is-changed' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/macro-in-comment'])
|
||||
def test_check_patch_fuzz_is_changed_not_applied(package, speccheck):
|
||||
output, test = speccheck
|
||||
pkg = get_tested_spec_package(package)
|
||||
test.check_spec(pkg)
|
||||
out = output.print_results(output.results)
|
||||
assert 'W: patch-fuzz-is-changed' not in out
|
||||
|
||||
|
||||
@pytest.mark.parametrize('package', ['spec/mixed-use-of-spaces-and-tabs'])
|
||||
|
|
Loading…
Reference in New Issue