Merge two clients versions into single version

Pass variable library name as parameter.
Do not try running on f34, where bind 9.16 no longer supports lwres.
This commit is contained in:
Petr Menšík 2021-01-26 16:48:46 +01:00
commit 4ecebdaf37
5 changed files with 18 additions and 28 deletions

View file

@ -29,7 +29,7 @@ export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE client.py client3.py server.sh
FILES=$(METADATA) runtest.sh Makefile PURPOSE client.py server.sh
.PHONY: all install download clean

View file

@ -1,13 +1,21 @@
#!/usr/bin/python
# Needed by python2, but won't hurt python3
from __future__ import print_function
import sys
from ctypes import *
lwres = CDLL("liblwres.so")
libname = "liblwres.so"
if len(sys.argv)>1:
libname = sys.argv[1]
lwres = CDLL(libname)
lwres.lwres_getrrsetbyname.argtypes = (c_char_p, c_int, c_int, c_int, c_void_p)
name = 3 * ("a" * 63 + ".") + "a" * 61
print("{0} ({1})".format(name, len(name)))
if sys.version_info[0] > 2:
name = str.encode(name)
result = lwres.lwres_getrrsetbyname(name, 1, 1, 0, None)
print(result)

View file

@ -1,11 +0,0 @@
#!/usr/bin/python
from ctypes import *
lwres = CDLL("liblwres.so")
lwres.lwres_getrrsetbyname.argtypes = (c_char_p, c_int, c_int, c_int, c_void_p)
name = 3 * ("a" * 63 + ".") + "a" * 61
print("{0} ({1})".format(name, len(name)))
result = lwres.lwres_getrrsetbyname(str.encode(name), 1, 1, 0, None)
print(result)

View file

@ -23,6 +23,7 @@ tag:
tier: '1'
relevancy: |
distro = rhel-4, rhel-5: False
distro > f33: False
extra-summary: /CoreOS/bind/Regression/bz1306504-lwresd-segfault-at-start-lookup
extra-task: /CoreOS/bind/Regression/bz1306504-lwresd-segfault-at-start-lookup
extra-nitrate: TC#0529313

View file

@ -37,19 +37,16 @@ DNS1=$(cat /etc/resolv.conf | grep -v '^#' | grep nameserver | awk '{print $2}'
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlAssertExists "$(which lwresd)"
#stop testing if DSN1 is wrong:
rlRun "ping $DNS1 -w2" || rlDie
#rhel6 uses liblwres.so.80 ; rhel7 liblwres.so.90; F24beta uses liblwres.so.141;
LIBLWRES=$(rpm -ql bind-libs | grep liblwres.so|head -n1)
LIBLWRESNEW=$(dirname $LIBLWRES)/liblwres.so
ln -s $LIBLWRES $LIBLWRESNEW
rlRun "ls -la $LIBLWRESNEW"
# bind-devel provides liblwres.so, but not needed
rlRun "LIBLWRES=$(rpm -ql bind-libs | grep liblwres.so|head -n1)"
#it shouldn't traceback
if rlIsRHEL '<=7'; then
rlRun "python client.py &>/dev/null" || rlDie
else
rlRun "python3 client3.py &>/dev/null" || rlDie
fi
PYTHON=python
python3 --version 2>/dev/null && PYTHON=python3
rlRun "$PYTHON client.py $LIBLWRES" || rlDie
rlPhaseEnd
rlPhaseStartSetup "start server"
@ -61,11 +58,7 @@ rlJournalStart
rlPhaseStartTest "client part"
#only run, if there is segfault client.py hangs and test fails
if rlIsRHEL '<=7'; then
rlRun "timeout 1m python client.py"
else
rlRun "timeout 1m python3 client3.py"
fi
rlRun "timeout 1m $PYTHON client.py $LIBLWRES"
sleep 5
rlPhaseEnd
@ -78,7 +71,6 @@ rlJournalStart
kill -9 $PIDSERVER
sleep 5
rlFileSubmit $SERVERLOG
rm -rf $LIBLWRESNEW
rlRun "rm -r $SERVERLOG" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText