CI Tests: add Regression/bz1305132-segfault-in-hesiod-getgrouplist test.

This commit is contained in:
Martin Coufal 2023-06-28 16:03:44 +02:00 committed by codonell
parent eb302655a8
commit 24a378361d
7 changed files with 192 additions and 0 deletions

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist
# Description: What the test does
# Author: Arjun Shankar <ashankar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE named.hesiod zone-entry hesiod.conf
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Arjun Shankar <ashankar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: What the test does" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 20m" >> $(METADATA)
@echo "RunFor: glibc" >> $(METADATA)
@echo "Requires: bind bind-utils glibc nss_hesiod" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Bug: 1305132" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist
Description: What the test does
Author: Arjun Shankar <ashankar@redhat.com>

View File

@ -0,0 +1,2 @@
rhs=.bz1305132
lhs=.ns

View File

@ -0,0 +1,17 @@
summary: Test for bz1305132 (Revisit name server list management in libresolv)
description: ''
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1305132
contact: Arjun Shankar <ashankar@redhat.com>
component:
- glibc
test: ./runtest.sh
framework: beakerlib
recommend:
- bind
- bind-utils
- glibc
- nss_hesiod
duration: 20m
extra-summary: /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist
extra-task: /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist

View File

@ -0,0 +1,17 @@
; SOA and NS records.
@ IN SOA ns.bz1305132. hostmaster.bz1305132. (
20160915 ; serial
3600 ; refresh every hour
1200 ; retry every 20 minutes
604800 ; expire after 1 week
86400 ) ; minimum TTL 1 day
IN NS ns.bz1305132.
ns.bz1305132. A 127.0.0.1
; Actual Hesiod data.
libc.group TXT "libc:*:123:gnu"
123.gid CNAME libc.group
gnu.passwd TXT "gnu:*:4567:123:GNU:/home/gnu:/bin/bash"
4567.uid CNAME gnu.passwd

View File

@ -0,0 +1,83 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/glibc/Regression/bz1305132-segfault-in-hesiod-getgrouplist
# Description: What the test does
# Author: Arjun Shankar <ashankar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="glibc"
REQUIRES="glibc bind"
rlJournalStart
rlPhaseStartSetup
rlFileBackup /etc/hosts
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp named.hesiod zone-entry hesiod.conf $TmpDir"
rlRun "pushd $TmpDir"
# set up hesiod as a query source
rlFileBackup --clean "/etc/nsswitch.conf"
rlRun "sed -i 's/^\(\s*group\s*:.*\)$/# \1/' /etc/nsswitch.conf"
rlRun "echo 'group: files hesiod' >> /etc/nsswitch.conf"
rlRun "sed -i 's/^\(\s*passwd\s*:.*\)$/# \1/' /etc/nsswitch.conf"
rlRun "echo 'passwd: files hesiod' >> /etc/nsswitch.conf"
rlFileBackup --clean "/etc/hesiod.conf"
rlRun "cp hesiod.conf /etc/"
# set up a hesiod server
rlServiceStop "named"
rlRun "sleep 10"
rlFileBackup --clean "/etc/named.conf"
rlRun "cat zone-entry >> /etc/named.conf"
rlFileBackup --clean "/var/named/named.hesiod"
rlRun "cp named.hesiod /var/named"
rlServiceStart "named"
rlRun "sleep 10"
rlPhaseEnd
rlPhaseStartTest
# point the resolver at local hesiod server
# (we want to do this as late as possible since it disables the default
# DNS server from being used)
rlRun "cp /etc/resolv.conf /etc/resolv.conf.bz1305132.bak"
rlRun "echo 'nameserver 127.0.0.1' > /etc/resolv.conf"
rlRun "groups gnu > groups.out"
rlAssertGrep "gnu\s*:\s*libc" groups.out
rlRun "cp /etc/resolv.conf.bz1305132.bak /etc/resolv.conf"
rlPhaseEnd
rlPhaseStartCleanup
rlServiceStop "named"
rlRun "sleep 10"
rlRun "popd"
rlFileRestore
rlServiceRestore "named"
rlRun "sleep 10"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,6 @@
zone "ns.bz1305132" {
type master;
file "named.hesiod";
};