From 4ecebdaf37ff45e226463ad64cd6ec724e54d902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Tue, 26 Jan 2021 16:48:46 +0100 Subject: [PATCH] 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. --- .../Makefile | 2 +- .../client.py | 10 ++++++++- .../client3.py | 11 ---------- .../main.fmf | 1 + .../runtest.sh | 22 ++++++------------- 5 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 Regression/bz1306504-lwresd-segfault-at-start-lookup/client3.py diff --git a/Regression/bz1306504-lwresd-segfault-at-start-lookup/Makefile b/Regression/bz1306504-lwresd-segfault-at-start-lookup/Makefile index f1bffda..b37881e 100644 --- a/Regression/bz1306504-lwresd-segfault-at-start-lookup/Makefile +++ b/Regression/bz1306504-lwresd-segfault-at-start-lookup/Makefile @@ -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 diff --git a/Regression/bz1306504-lwresd-segfault-at-start-lookup/client.py b/Regression/bz1306504-lwresd-segfault-at-start-lookup/client.py index cf15256..cc45200 100644 --- a/Regression/bz1306504-lwresd-segfault-at-start-lookup/client.py +++ b/Regression/bz1306504-lwresd-segfault-at-start-lookup/client.py @@ -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) diff --git a/Regression/bz1306504-lwresd-segfault-at-start-lookup/client3.py b/Regression/bz1306504-lwresd-segfault-at-start-lookup/client3.py deleted file mode 100644 index e553c53..0000000 --- a/Regression/bz1306504-lwresd-segfault-at-start-lookup/client3.py +++ /dev/null @@ -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) diff --git a/Regression/bz1306504-lwresd-segfault-at-start-lookup/main.fmf b/Regression/bz1306504-lwresd-segfault-at-start-lookup/main.fmf index fe5b9b2..58aa4c6 100644 --- a/Regression/bz1306504-lwresd-segfault-at-start-lookup/main.fmf +++ b/Regression/bz1306504-lwresd-segfault-at-start-lookup/main.fmf @@ -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 diff --git a/Regression/bz1306504-lwresd-segfault-at-start-lookup/runtest.sh b/Regression/bz1306504-lwresd-segfault-at-start-lookup/runtest.sh index 0f322d7..03d5297 100755 --- a/Regression/bz1306504-lwresd-segfault-at-start-lookup/runtest.sh +++ b/Regression/bz1306504-lwresd-segfault-at-start-lookup/runtest.sh @@ -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