CI tests: Use ! grep to assert something is missing

Previously, we have used `grep -v` to assert something is *not* there.
However, that doesn't work. See for example this file:

    $ cat TEST
    line1
    line2
    line3

    $ grep -v line4 TEST
    line1
    line2
    line3
    $ echo $?
    0

This gives a false sense of correctness, however it exits will 0 with anything:

    $ grep -v line3 TEST
    line1
    line2
    $ echo $?
    0

Instead, we use `! grep` now:

    $ ! grep line4 TEST
    $ echo $?
    0

    $ ! grep line3 TEST
    line3
    $ echo $?
    1

Additionally, remove a trailing slash from one of the checks to match both cases
(with or without the slash).
This commit is contained in:
Miro Hrončok 2020-10-26 17:18:51 +01:00
parent e9281281f6
commit 2660031756
3 changed files with 9 additions and 9 deletions

View File

@ -42,8 +42,8 @@ Summary: %{summary}
%check %check
# Internal check: Top level __pycache__ is never owned # Internal check: Top level __pycache__ is never owned
grep -vE '/__pycache__$' %{pyproject_files} ! grep -E '/__pycache__$' %{pyproject_files}
grep -vE '/__pycache__/$' %{pyproject_files} ! grep -E '/__pycache__/$' %{pyproject_files}
grep -F '/__pycache__/' %{pyproject_files} grep -F '/__pycache__/' %{pyproject_files}

View File

@ -47,7 +47,7 @@ test -d %{buildroot}%{python3_sitelib}/%{modname}/
test -d %{buildroot}%{python3_sitelib}/%{modname}-%{version}.dist-info/ test -d %{buildroot}%{python3_sitelib}/%{modname}-%{version}.dist-info/
# Internal check that executables are not present when +auto was not used with %%pyproject_save_files # Internal check that executables are not present when +auto was not used with %%pyproject_save_files
grep -vF %{buildroot}%{_bindir}/%{modname} %{pyproject_files} ! grep -F %{buildroot}%{_bindir}/%{modname} %{pyproject_files}
%files -n python3-%{modname} -f %{pyproject_files} %files -n python3-%{modname} -f %{pyproject_files}

View File

@ -64,14 +64,14 @@ test -f %{buildroot}%{python3_sitearch}/_ldap.cpython-*.so
# Internal check: Unmatched modules are not supposed to be listed in %%{pyproject_files} # Internal check: Unmatched modules are not supposed to be listed in %%{pyproject_files}
# We'll list them explicitly # We'll list them explicitly
grep -vF %{python3_sitearch}/ldif.py %{pyproject_files} ! grep -F %{python3_sitearch}/ldif.py %{pyproject_files}
grep -vF %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.pyc %{pyproject_files} ! grep -F %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.pyc %{pyproject_files}
grep -vF %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.opt-1.pyc %{pyproject_files} ! grep -F %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.opt-1.pyc %{pyproject_files}
grep -vF %{python3_sitearch}/slapdtest/ %{pyproject_files} ! grep -F %{python3_sitearch}/slapdtest %{pyproject_files}
# Internal check: Top level __pycache__ is never owned # Internal check: Top level __pycache__ is never owned
grep -vE '/__pycache__$' %{pyproject_files} ! grep -E '/__pycache__$' %{pyproject_files}
grep -vE '/__pycache__/$' %{pyproject_files} ! grep -E '/__pycache__/$' %{pyproject_files}
%files -n python3-ldap -f %{pyproject_files} %files -n python3-ldap -f %{pyproject_files}