- add a %check script to catch problems like #249210

This commit is contained in:
Nalin Dahyabhai 2007-07-23 18:33:36 +00:00
parent a351732e1d
commit f82e1deb9d

View File

@ -150,6 +150,29 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libcrack.la
%find_lang %{name}
%check
# We want to check that the new library is able to open the new dictionaries,
# using the new python module.
LD_LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir} %{__python} 2>&1 << EOF
import string, sys
# Prepend buildroot-specific variations of the python path to the python path.
syspath2=[]
for element in sys.path:
syspath2.append("$RPM_BUILD_ROOT/" + element)
syspath2.reverse()
for element in syspath2:
sys.path.insert(0,element)
# Now actually do the test. If we get a different result, or throw an
# exception, the script will end with the error.
import cracklib
s = cracklib.FascistCheck("cracklib", "$RPM_BUILD_ROOT/%{dictpath}")
expected = "it is based on a dictionary word"
if s != expected:
print "Got unexpected result \"%s\"," % s,
print "instead of expected value of \"%s\"." % expected
sys.exit(1)
EOF
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
@ -185,6 +208,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libcrack.la
%{_libdir}/python*/site-packages/cracklibmodule.so
%changelog
* Mon Jul 23 2007 Nalin Dahyabhai <nalin@redhat.com>
- add a %%check script to catch things like #249210
* Mon Jul 23 2007 Nalin Dahyabhai <nalin@redhat.com> - 2.8.10-2
- work around non-executable util/cracklib-format giving us empty/garbage
dictionaries (#249210)