From 53a0744ff2eec1d9975343a327d3b70fce61dd66 Mon Sep 17 00:00:00 2001 From: Martin Coufal Date: Tue, 30 Jan 2024 17:21:59 +0100 Subject: [PATCH] CI Tests: add Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc test --- .../Makefile | 64 +++++++++++ .../PURPOSE | 8 ++ .../main.fmf | 23 ++++ .../runtest.sh | 101 ++++++++++++++++++ 4 files changed, 196 insertions(+) create mode 100644 tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/Makefile create mode 100644 tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/PURPOSE create mode 100644 tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/main.fmf create mode 100755 tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/runtest.sh diff --git a/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/Makefile b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/Makefile new file mode 100644 index 0000000..3429bda --- /dev/null +++ b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/glibc/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc +# Description: Test for BZ#1430477 (glibc Missing else branch in __libc_calloc) +# Author: Sergey Kolosov +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 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/bz1430477-glibc-Missing-else-branch-in-libc-calloc +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.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: Sergey Kolosov " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test for BZ#1430477 (glibc Missing else branch in __libc_calloc)" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 2h" >> $(METADATA) + @echo "RunFor: glibc" >> $(METADATA) + @echo "Requires: glibc rpm-build" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1430477" >> $(METADATA) + @echo "Releases: -RHEL4 -RHEL5 -RHEL6" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/PURPOSE b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/PURPOSE new file mode 100644 index 0000000..d31ceb1 --- /dev/null +++ b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/PURPOSE @@ -0,0 +1,8 @@ +PURPOSE of /tools/glibc/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc +Description: Test for BZ#1430477 (glibc Missing else branch in __libc_calloc) +Author: Sergey Kolosov +Bug summary: glibc: Missing else branch in __libc_calloc +Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1430477 + +The test builds glibc, then does malloc.o recompilation and does checking that +there are no missing initializations for oldtop and oldtopsize variables. diff --git a/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/main.fmf b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/main.fmf new file mode 100644 index 0000000..f5ff109 --- /dev/null +++ b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/main.fmf @@ -0,0 +1,23 @@ +summary: Test for BZ#1430477 (glibc Missing else branch in __libc_calloc) +description: | + Bug summary: glibc: Missing else branch in __libc_calloc + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1430477 + + The test builds glibc, then does malloc.o recompilation and does checking + that there are no missing initializations for oldtop and oldtopsize + variables. +contact: Sergey Kolosov +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1430477 +component: + - glibc +test: ./runtest.sh +framework: beakerlib +recommend: + - glibc + - rpm-build +duration: 2h +extra-summary: + /tools/glibc/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc +extra-task: + /tools/glibc/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc diff --git a/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/runtest.sh b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/runtest.sh new file mode 100755 index 0000000..23438b7 --- /dev/null +++ b/tests/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc/runtest.sh @@ -0,0 +1,101 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/glibc/Regression/bz1430477-glibc-Missing-else-branch-in-libc-calloc +# Description: Test for BZ#1430477 (glibc Missing else branch in __libc_calloc) +# Author: Sergey Kolosov +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 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" + +rlJournalStart + rlPhaseStartSetup + PRARCH="$(rlGetPrimaryArch)" + BUILDDIR="$(rpm -E '%{_builddir}')" + SPECDIR="$(rpm -E '%{_specdir}')" + rlAssertRpm $PACKAGE + rlLog "Build directory: $BUILDDIR" + rlLog "Spec directory: $SPECDIR" + rlLog "Architecture : $PRARCH" + + rlLog "Cleaning build and spec directories of glibc files" + rlRun "rm -rf $BUILDDIR/glibc*" 0 "Cleaning $BUILDDIR/glibc*" + rlRun "rm -rf $SPECDIR/glibc*.spec" 0 "Cleaning $SPECDIR/glibc*.spec" + rlRun "rm -rf glibc*.src.rpm" 0 "Removing any present glibc src.rpm" + + rlLog "Installing glibc srpm" + rlFetchSrcForInstalled $PACKAGE + rlRun "rpm -Uhv $PACKAGE*.src.rpm" + rlAssertExists $SPECDIR/$PACKAGE.spec + + rlRun "yum-builddep -y $PACKAGE-*.src.rpm" 0 "Installing dependences" + rlPhaseEnd + + rlPhaseStartTest "Building glibc" + if rlIsRHEL 7; then + rlRun -c "sed -i '/#\ Ensure\ timestamps/i \\touch intl/plural.c' $SPECDIR/glibc.spec" + fi + rlRun "rpmbuild -bc ${SPECDIR}/${PACKAGE}.spec &> glibc_build_log.txt" 0 "Unpacking $PACKAGE" + ISSUCCESS=$? + if [ $ISSUCCESS -ne 0 ] + then + rlFileSubmit glibc_build_log.txt + rlFail "Glibc compilation error" + fi + + BUILDS="$BUILDDIR/glibc*/build*" + rlLog "Found builds at:" + for build in $BUILDS; do + rlLog "$build" + done; unset build + rlPhaseEnd + + rlPhaseStartTest "Check for uninitialized values" + for CURBUILD in $BUILDS + do + rlRun -c "pushd $CURBUILD" + rlRun -c "rm malloc/malloc.o" + rlRun -c "make -r PARALLELMFLAGS="" -C .. -C malloc objdir=`pwd` subdir=malloc &> malloc_build_log.txt" + rlAssertExists malloc_build_log.txt + rlAssertNotGrep "‘oldtop’ may be used uninitialized in this function" malloc_build_log.txt + rlAssertNotGrep "‘oldtopsize’ may be used uninitialized in this function" malloc_build_log.txt + rlFileSubmit malloc_build_log.txt ${CURBUILD}_malloc_build_log + rlRun -c "popd" + done + rlPhaseEnd + + rlPhaseStartCleanup + if [ -n "$KEEP_GLIBC_RESULTS" ]; then + rlLog "$(pwd) contains:" + rlLog "$(ls $(pwd))" + rlLog "Build Directory at: $(ls $BUILDDIR)" + rlLog "Spec File at: $(ls $SPECDIR/glibc*.spec)" + else + rlRun "rm glibc*.src.rpm" + rlRun "rm -rf $BUILDDIR/glibc* $SPECDIR/glibc*.spec" + fi + rlPhaseEnd +rlJournalPrintText +rlJournalEnd