From 2660031756b1ba533809146157796aa95a014c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 26 Oct 2020 17:18:51 +0100 Subject: [PATCH] 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). --- tests/python-entrypoints.spec | 4 ++-- tests/python-isort.spec | 2 +- tests/python-ldap.spec | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/python-entrypoints.spec b/tests/python-entrypoints.spec index bc0a024..aa6d2d9 100644 --- a/tests/python-entrypoints.spec +++ b/tests/python-entrypoints.spec @@ -42,8 +42,8 @@ Summary: %{summary} %check # Internal check: Top level __pycache__ is never owned -grep -vE '/__pycache__$' %{pyproject_files} -grep -vE '/__pycache__/$' %{pyproject_files} +! grep -E '/__pycache__$' %{pyproject_files} +! grep -E '/__pycache__/$' %{pyproject_files} grep -F '/__pycache__/' %{pyproject_files} diff --git a/tests/python-isort.spec b/tests/python-isort.spec index e160b63..684a2fe 100644 --- a/tests/python-isort.spec +++ b/tests/python-isort.spec @@ -47,7 +47,7 @@ test -d %{buildroot}%{python3_sitelib}/%{modname}/ 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 -grep -vF %{buildroot}%{_bindir}/%{modname} %{pyproject_files} +! grep -F %{buildroot}%{_bindir}/%{modname} %{pyproject_files} %files -n python3-%{modname} -f %{pyproject_files} diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index 1aec33e..aafe0e2 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -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} # We'll list them explicitly -grep -vF %{python3_sitearch}/ldif.py %{pyproject_files} -grep -vF %{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 -vF %{python3_sitearch}/slapdtest/ %{pyproject_files} +! grep -F %{python3_sitearch}/ldif.py %{pyproject_files} +! grep -F %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.pyc %{pyproject_files} +! grep -F %{python3_sitearch}/__pycache__/ldif.cpython-%{python3_version_nodots}.opt-1.pyc %{pyproject_files} +! grep -F %{python3_sitearch}/slapdtest %{pyproject_files} # Internal check: Top level __pycache__ is never owned -grep -vE '/__pycache__$' %{pyproject_files} -grep -vE '/__pycache__/$' %{pyproject_files} +! grep -E '/__pycache__$' %{pyproject_files} +! grep -E '/__pycache__/$' %{pyproject_files} %files -n python3-ldap -f %{pyproject_files}