Initial commit for downstream tests using standard test interface

This commit is contained in:
Rachel Sibley 2017-10-09 16:19:04 -04:00
parent 553b93f777
commit b29ed9af2b
24 changed files with 821 additions and 0 deletions

View File

@ -0,0 +1,60 @@
# Copyright (c) 2008, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# Marek Polacek <polacek@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=gcc
RELATIVE_PATH=Regression/OpenMP/445666-OpenMP-segv
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.f90
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Marek Polacek <mpolacek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: Optimized Fortran code segfaults with multidimensional private common block in thread" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: gcc-gfortran libgomp" >> $(METADATA)
@echo "Architectures: x86_64 i386" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,5 @@
It simplifies down to the enclosed program. It can only be reproduced if:
* The program is compiled Optimized (-O or better)
* The program is compiled with OpenMP (-fopenmp)
* The array that's in the thread private common block is multidimensional.

View File

@ -0,0 +1,16 @@
program foo
implicit none
common /bobcom/ bob(2)
!$omp threadprivate (/bobcom/)
integer i
real*8 bob
do i=1,2
write(*,*) i
bob(i)=0.0d0
enddo
end program

55
tests/OpenMP-segv/runtest.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
# Copyright (c) 2008 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# Marek Polacek <polacek@redhat.com>
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGES=(gcc libgomp gcc-gfortran)
# Choose the compiler.
GFORTRAN=${GFORTRAN:-gfortran}
rlJournalStart
rlPhaseStartSetup
rlLog "GFORTRAN = $GFORTRAN"
rlLog "Installed within `rpmquery -f $(which $GFORTRAN)`"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "cp -v reproducer.f90 $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "Testing the executable"
for opt in 0 1 2 3; do
rlRun "$GFORTRAN -o reproducer_$opt reproducer.f90 -O$opt -fopenmp" 0 "Compile the testcase (-O$opt)"
rlRun "./reproducer_$opt" 0 "Checking we have a working executable (-O$opt)"
done
rlPhaseEnd
rlPhaseStartTest "Testing the assembly"
rlRun "$GFORTRAN -S -c reproducer.f90" 0 "Create assembly"
rlRun "grep movabsq reproducer.s" 1 "movabsq must *not* be present"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of g-fails-to-compile-a-program-that-has-a-template
# Description: Try to compile a program that has a template parameter with a boolean expression involving a templated static constant
# Author: Marek Polacek <mpolacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011, 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/gcc/Regression/g-fails-to-compile-a-program-that-has-a-template
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE f.cc
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Marek Polacek <mpolacek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Try to compile a program that has a template parameter with a boolean expression involving a templated static constant" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: gcc" >> $(METADATA)
@echo "Requires: gcc gcc-c++" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/gcc/Regression/g-fails-to-compile-a-program-that-has-a-template
Description: Try to compile a program that has a template parameter with a boolean expression involving a templated static constant
Author: Marek Polacek <mpolacek@redhat.com>

View File

@ -0,0 +1,15 @@
template <bool C> int func (void);
template <class T> struct Foo
{
static const unsigned int a = sizeof (T);
//enum { b = a };
enum
{
c = sizeof (func < (a == 0) > ())
};
};
Foo <int> x;

View File

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/gcc/Regression/g-fails-to-compile-a-program-that-has-a-template
# Description: Try to compile a program that has a template parameter with a boolean expression involving a templated static constant
# Author: Marek Polacek <mpolacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011, 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGES=(gcc gcc-c++)
# Choose the compiler.
GXX=${GXX:-g++}
rlJournalStart
rlPhaseStartSetup
for p in "${PACKAGES[@]}"; do
rlAssertRpm "$p" || yum -y install "$p"
done; unset p
rlLog "GXX = $GXX"
rlLog "Installed within `rpmquery -f $(which $GXX)`"
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "cp -v f.cc $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
# Just try to compile the reproducer.
rlRun "$GXX -c f.cc" 0 "Compiling the reproducer"
rlAssertExists "f.o"
rlRun "file f.o | grep ELF" 0 "Basic obj file sanity check"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,59 @@
# Copyright (c) 2008, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# Marek Polacek <polacek@redhat.com>
TOPLEVEL_NAMESPACE=/tools
PACKAGE_NAME=gcc
RELATIVE_PATH=Regression/g++/441639-libstdc++-v3-locale-collate-and-time-swapped
export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE reproducer.cpp
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Marek Polacek <mpolacek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: locale confusion with time-collate categories" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
@echo "Requires: $(PACKAGE_NAME)-c++" >> $(METADATA)
@echo "License: GPLv3+" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,25 @@
Actual results:
(generated from RHEL5 w/ latest gcc errata)
Time in default locale: Wed Apr 9 04:59:41 2008
Old locale name: C
New locale name:
LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
Time in hybrid locale: Wed 09 Apr 2008 04:59:41 AM EDT
Note that only std::locale::collate was set, and NOT std::locale::time . In the
resulting locale name, LC_TIME has been changed to en_US.UTF-8 instead of
LC_COLLATE. The current time display lines show that this is not just a name
string output bug, but affects locale handling of dates as well.
Expected results:
(generated from patched system)
Time in default locale: Wed Apr 9 04:55:50 2008
Old locale name: C
New locale name:
LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
Time in hybrid locale: Wed Apr 9 04:55:50 2008

View File

@ -0,0 +1,43 @@
#include <iostream>
#include <string>
#include <ctime>
#include <sstream>
using namespace std;
locale SetCppLocale()
{
locale loc;
locale temp(std::locale::classic(), "en_US.UTF-8", std::locale::collate );
locale oldLoc = std::locale::global(temp);
return oldLoc;
}
string DoDateTimeString()
{
time_t utcTime;
time(&utcTime);
struct tm *time = localtime(&utcTime);
char buffer[300];
strftime(buffer, 300, "%c", time);
return string(buffer);
}
int main()
{
string time = DoDateTimeString();
cout << "Time in default locale: " << time << endl;
locale oldLoc = SetCppLocale();
cout << "Old locale name: " << oldLoc.name() << endl;
locale newLoc;
cout << "New locale name: " << newLoc.name() << endl;
time = DoDateTimeString();
cout << "Time in hybrid locale: " << time << endl;
return 0;
}

View File

@ -0,0 +1,56 @@
#!/bin/bash
# Copyright (c) 2008, 2012 Red Hat, Inc. All rights reserved.
#
# 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 3 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/>.
#
# Author: Michal Nowak <mnowak@redhat.com>
# Marek Polacek <polacek@redhat.com>
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGES=(gcc gcc-c++)
# Choose the compiler.
GXX=${GXX:-g++}
rlJournalStart
rlPhaseStartSetup
for p in "${PACKAGES[@]}"; do
rlAssertRpm "$p"
done; unset p
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
# We need the reproducer.
rlRun "cp -v reproducer.cpp $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest "Testing the executable"
# Compile
rlRun "$GXX -g reproducer.cpp -o reproducer" 0 "Compiling the test case"
# Exec-Test
rlRun "./reproducer" 0 "Checking whether we have an working executable"
# Test
rlRun "./reproducer | grep 'LC_TIME=C'" 0 "Do we have 'LC_TIME=C'?"
rlRun "./reproducer | grep 'LC_COLLATE=en_US.UTF-8'" 0 "Do we have 'LC_COLLATE=en_US.UTF-8'?"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

65
tests/smoke-test/Makefile Normal file
View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/gcc/Sanity/smoke-test
# Description: Basic smoke test.
# Author: Marek Polacek <polacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/gcc/Sanity/smoke-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE hello.c hello.f90 hello.cpp tm.c quad.c omphello.c thr-init-2.c clear_cache.c
.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: Marek Polacek <mpolacek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Basic smoke test." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: gcc" >> $(METADATA)
@echo "RunFor: devtoolset-1.0-gcc" >> $(METADATA)
@echo "Requires: gcc gcc-c++ gcc-gfortran glibc-common glibc-devel" >> $(METADATA)
@echo "Requires: libquadmath libquadmath-devel libgomp libgcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/smoke-test/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /tools/gcc/Sanity/smoke-test
Description: Basic smoke test.
Author: Marek Polacek <polacek@redhat.com>

View File

@ -0,0 +1,7 @@
int
main (void)
{
char *mem = __builtin_alloca (40);
__builtin___clear_cache (mem, mem + 40);
return 0;
}

7
tests/smoke-test/hello.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int
main (void)
{
puts ("Hello World!");
}

View File

@ -0,0 +1,7 @@
#include <iostream>
int
main (void)
{
std::cout << "Hello, world!\n";
}

View File

@ -0,0 +1,3 @@
program hello
print *, "Hello World!"
end program hello

View File

@ -0,0 +1,24 @@
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
int th_id;
int nthreads;
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num ();
printf ("Hello World from thread %d\n", th_id);
#pragma omp barrier
if (th_id == 0)
{
nthreads = omp_get_num_threads ();
printf ("There are %d threads\n", nthreads);
}
}
return EXIT_SUCCESS;
}

38
tests/smoke-test/quad.c Normal file
View File

@ -0,0 +1,38 @@
#include <quadmath.h>
#include <stdlib.h>
#include <stdio.h>
int
main (void)
{
__float128 r = strtoflt128 ("1.23456789", NULL);
int prec = 20;
int width = 46;
char buf[128];
r = 2.0q;
r = sqrtq (r);
int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r);
if ((size_t) n < sizeof buf)
/* Prints: +1.41421356237309504880e+00 */
printf ("%s\n", buf);
quadmath_snprintf (buf, sizeof buf, "%Qa", r);
if ((size_t) n < sizeof buf)
/* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */
printf ("%s\n", buf);
n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r);
if (n > -1)
{
char *str = malloc (n + 1);
if (str)
{
quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r);
/* Prints: +1.41421356237309504880e+00 */
printf ("%s\n", str);
}
free (str);
}
return 0;
}

122
tests/smoke-test/runtest.sh Executable file
View File

@ -0,0 +1,122 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/gcc/Sanity/smoke-test
# Description: Basic smoke test.
# Author: Marek Polacek <polacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGES=(gcc gcc-c++ gcc-gfortran glibc-common libgomp libgcc glibc-devel)
# Choose the compiler.
GCC=${GCC:-gcc}
GXX=${GXX:-g++}
GFORTRAN=${GFORTRAN:-gfortran}
PACKAGE=gcc
rlJournalStart
rlPhaseStartSetup
# don't assert anything under devtoolset
if type gcc | grep -q -v devtoolset
then
for p in "${PACKAGES[@]}"; do
rpm -q "$p" || yum install -y "$p"
rlAssertRpm "$p"
done; unset p
fi
rlLog "GCC = $GCC"
rlLog "Installed within `rpmquery -f $(which $GCC)`"
rlLog "GXX = $GXX"
rlLog "Installed within `rpmquery -f $(which $GXX)`"
rlLog "GFORTRAN = $GFORTRAN"
rlLog "Installed within `rpmquery -f $(which $GFORTRAN)`"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
# We need some files.
rlRun "cp -v hello.{c,cpp,f90} tm.c quad.c thr-init-2.c clear_cache.c omphello.c $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartSetup "Showing compiler versions"
for compiler in $GCC $GXX $GFORTRAN
do
rlLog "Version of compiler: $compiler"
eval "$compiler --version 2>&1" | while read line
do
rlLog " $line"
done
done
rlPhaseEnd
rlPhaseStartTest "Compile"
rlRun "$GCC hello.c -o hello_c"
rlRun "$GXX hello.cpp -o hello_cpp"
rlRun "$GFORTRAN hello.f90 -o hello_fortran"
# TM support is GCC >=4.7 only.
$GCC -xc -O2 -std=gnu99 -fgnu-tm - <<< "int main(){}"
if test $? -eq 0; then
rlRun "$GCC -O2 -std=gnu99 -fgnu-tm tm.c -o tm"
rlRun "./tm"
fi
# Test OpenMP.
rlRun "$GCC omphello.c -O2 -std=gnu99 -fopenmp -o omp"
rlRun "./omp"
# Test __thread.
rlRun "$GCC thr-init-2.c -O2 -std=gnu99 -ftls-model=initial-exec -o thr"
rlRun "./thr"
# Now test some libquadmath stuff (__float128 support).
# libquadmath is mising on RHEL machines, usually.
rpm -q libquadmath
if test $? -eq 0 -a "$GCC" = "gcc"; then
rlRun "$GCC quad.c -O2 -std=gnu99 -lquadmath -lm -o quad"
rlRun "./quad"
fi
# And now something from libgcc, e.g. __builtin___clear_cache.
# But not on RHEL5.
if ! rlIsRHEL 5; then
rlRun "$GCC clear_cache.c -O2 -std=gnu99 -o cache"
rlRun "./cache"
fi
rlPhaseEnd
rlPhaseStartTest "Check dependant libraries"
rlRun "ldd hello_{c,cpp,fortran} &> ldd.out"
# Nothing should be linked against anything in /opt.
rlAssertNotGrep "/opt" ldd.out
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,24 @@
/* { dg-do run } */
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */
extern void abort() ;
static __thread int fstat ;
static __thread int fstat = 1;
int test_code(int b)
{
fstat += b ;
return fstat;
}
int main (int ac, char *av[])
{
int a = test_code(1);
if ((a != 2) || (fstat != 2))
abort () ;
return 0;
}

34
tests/smoke-test/tm.c Normal file
View File

@ -0,0 +1,34 @@
extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe));
static int __attribute__((transaction_safe))
something (void)
{
return 0;
}
struct large { int foo[500]; };
int
main (void)
{
int *p;
struct large *lp;
__transaction_atomic {
p = malloc (sizeof (*p) * 100);
lp = malloc (sizeof (*lp) * 100);
/* No instrumentation necessary; P and LP are transaction local. */
p[5] = 123;
lp->foo[66] = 123;
if (something ())
__transaction_cancel;
}
__transaction_relaxed {
++p[5];
}
return ( (p[5] == 124) ? 0 : 1 );
}

25
tests/tests.yml Normal file
View File

@ -0,0 +1,25 @@
---
# Tests for classic and container
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
tests:
- libstdc++-v3-locale-collate-and-time-swapped
- g-fails-to-compile-a-program-that-has-a-template
- smoke-test
- OpenMP-segv
required_packages:
- gcc-c++
- gcc-gfortran
- libgomp
- gcc
- glibc-common
- glibc-devel
- libquadmath
- libquadmath-devel
- libgomp
- libgcc
- file