| |
@@ -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
|
| |
Adds tests according to the CI wiki [0] specifically the standard test interface in the spec [1].
The playbook includes Tier1 level test cases that have been tested in the following contexts and is passing reliably: Docker, and Classic.
Test logs are stored in the Artifacts directory. Currently tests are not suitable for Atomic but may be updated later to support it.
The following steps are used to execute the tests using the standard test interface:
Atomic
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=../atomic.qcow2 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags atomic tests.yml
Docker
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_DEBUG=1 TEST_SUBJECTS=docker:docker.io/library/fedora:26 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags container tests.yml
Classic
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS="" TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags classic tests.yml
Test Logs: (If you would like a pointer to the complete log, I can include that as well)
Docker
<snip>
13:46:35 TASK [standard-test-beakerlib : Execute beakerlib tests]
13:46:38 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=libstdc++-v3-locale-collate-and-time-swapped)
13:46:40 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=g-fails-to-compile-a-program-that-has-a-template)
13:46:47 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=smoke-test)
13:46:49 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=OpenMP-segv)
13:46:49
13:46:49 TASK [standard-test-beakerlib : Make the master test summary log artifact]
13:46:50 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=libstdc++-v3-locale-collate-and-time-swapped)
13:46:51 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=g-fails-to-compile-a-program-that-has-a-template)
13:46:52 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=smoke-test)
13:46:52 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23] => (item=OpenMP-segv)
13:46:52
13:46:52 TASK [standard-test-beakerlib : Pull out the logs]
13:46:53 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23]
13:46:53
13:46:53 TASK [standard-test-beakerlib : Check the results]
13:46:53 changed: [528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23]
13:46:53
13:46:53 PLAY RECAP
13:46:53 528d874f8c54392005798c2361ca21716d47a593323b1f5191a00e0786812d23 : ok=15 changed=11 unreachable=0 failed=0
13:46:53
13:46:53 ###################################
13:46:53 Test results:
13:46:53 ###################################
13:46:53 PASS libstdc++-v3-locale-collate-and-time-swapped
13:46:53 PASS g-fails-to-compile-a-program-that-has-a-template
13:46:53 PASS smoke-test
13:46:53 PASS OpenMP-segv
Classic
<snip>
13:42:31 ==> default: TASK [standard-test-beakerlib : Execute beakerlib tests]
13:42:35 ==> default: changed: [localhost] => (item=libstdc++-v3-locale-collate-and-time-swapped)
13:42:37 ==> default: changed: [localhost] => (item=g-fails-to-compile-a-program-that-has-a-template)
13:42:42 ==> default: changed: [localhost] => (item=smoke-test)
13:42:45 ==> default: changed: [localhost] => (item=OpenMP-segv)
13:42:45 ==> default:
13:42:45 ==> default: TASK [standard-test-beakerlib : Make the master test summary log artifact]
13:42:45 ==> default: changed: [localhost] => (item=libstdc++-v3-locale-collate-and-time-swapped)
13:42:45 ==> default: changed: [localhost] => (item=g-fails-to-compile-a-program-that-has-a-template)
13:42:45 ==> default: changed: [localhost] => (item=smoke-test)
13:42:45 ==> default: changed: [localhost] => (item=OpenMP-segv)
13:42:45 ==> default:
13:42:45 ==> default: TASK [standard-test-beakerlib : Pull out the logs]
13:42:46 ==> default: changed: [localhost]
13:42:46 ==> default:
13:42:46 ==> default: TASK [standard-test-beakerlib : Check the results]
13:42:46 ==> default: changed: [localhost]
13:42:46 ==> default:
13:42:46 ==> default: PLAY RECAP
13:42:46 ==> default: localhost : ok=15 changed=12 unreachable=0 failed=0
13:42:46 ==> default: ++ '[' 0 -ne 0 ']'
13:42:46 ==> default: ++ cat /root/gcc/artifacts/test.log
13:42:46 ==> default: PASS libstdc++-v3-locale-collate-and-time-swapped
13:42:46 ==> default: PASS g-fails-to-compile-a-program-that-has-a-template
13:42:46 ==> default: PASS smoke-test
13:42:46 ==> default: PASS OpenMP-segv
13:42:46 ==> default: ++ grep -ve '^PASS' /root/gcc/artifacts/test.log
13:42:46 ==> default: PASS: all tests passed.
13:42:46 ==> default: ++ '[' 1 -eq 1 ']'
13:42:46 ==> default: ++ echo 'PASS: all tests passed.'
Tests will be enabled in CI, yet gating is currently disabled, so nothing will change. However eventually gating will be enabled. Tests will run on each dist-git commit, they are not triggered on koji builds and if you are using FMN, it should notify you of failures normally.
The RH QE maintainer contact in case you have questions: mpetlan@redhat.com
The idea is that these tests become yours just as you're maintaining the package, there will of course be people around if you have questions or troubles.
[0] https://fedoraproject.org/wiki/CI
[1] https://fedoraproject.org/wiki/Changes/InvokingTests