From 64852cd1e4c9dbd41ebf0755419a29ae8bae4c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Thu, 30 Mar 2023 09:30:40 +0200 Subject: [PATCH] Imported from the Fedora annobin repo Copied from: https://src.fedoraproject.org/rpms/annobin/blob/rawhide/f/tests/Sanity/gcc-fedora-flags --- Sanity/gcc-fedora-flags/hello.c | 5 ++++ Sanity/gcc-fedora-flags/hello.cpp | 5 ++++ Sanity/gcc-fedora-flags/main.c | 6 +++++ Sanity/gcc-fedora-flags/main.cpp | 6 +++++ Sanity/gcc-fedora-flags/main.fmf | 22 ++++++++++++++++ Sanity/gcc-fedora-flags/runtest.sh | 40 ++++++++++++++++++++++++++++++ 6 files changed, 84 insertions(+) create mode 100644 Sanity/gcc-fedora-flags/hello.c create mode 100644 Sanity/gcc-fedora-flags/hello.cpp create mode 100644 Sanity/gcc-fedora-flags/main.c create mode 100644 Sanity/gcc-fedora-flags/main.cpp create mode 100644 Sanity/gcc-fedora-flags/main.fmf create mode 100755 Sanity/gcc-fedora-flags/runtest.sh diff --git a/Sanity/gcc-fedora-flags/hello.c b/Sanity/gcc-fedora-flags/hello.c new file mode 100644 index 0000000..51b259b --- /dev/null +++ b/Sanity/gcc-fedora-flags/hello.c @@ -0,0 +1,5 @@ +#include + +void hello() { + printf("Hello World\n"); +} diff --git a/Sanity/gcc-fedora-flags/hello.cpp b/Sanity/gcc-fedora-flags/hello.cpp new file mode 100644 index 0000000..400612b --- /dev/null +++ b/Sanity/gcc-fedora-flags/hello.cpp @@ -0,0 +1,5 @@ +#include + +void hello() { + std::cout << "Hello World\n"; +} diff --git a/Sanity/gcc-fedora-flags/main.c b/Sanity/gcc-fedora-flags/main.c new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/Sanity/gcc-fedora-flags/main.c @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/Sanity/gcc-fedora-flags/main.cpp b/Sanity/gcc-fedora-flags/main.cpp new file mode 100644 index 0000000..1a3455d --- /dev/null +++ b/Sanity/gcc-fedora-flags/main.cpp @@ -0,0 +1,6 @@ +void hello(); + +int main(int argc, char **argv) { + hello(); + return 0; +} diff --git a/Sanity/gcc-fedora-flags/main.fmf b/Sanity/gcc-fedora-flags/main.fmf new file mode 100644 index 0000000..b6c5612 --- /dev/null +++ b/Sanity/gcc-fedora-flags/main.fmf @@ -0,0 +1,22 @@ +summary: gcc-fedora-flags +description: '' +contact: +- Tom Stellard +component: +- annobin +test: ./runtest.sh +framework: beakerlib +recommend: +- gcc +- gcc-c++ +- annobin-plugin-gcc +- annobin +- annobin-annocheck +- redhat-rpm-config +duration: 1h +adjust: + - enabled: false + when: distro != fedora + continue: false +extra-summary: /tools/annobin/Sanity/gcc-fedora-flags +extra-task: /tools/annobin/Sanity/gcc-fedora-flags diff --git a/Sanity/gcc-fedora-flags/runtest.sh b/Sanity/gcc-fedora-flags/runtest.sh new file mode 100755 index 0000000..2031f46 --- /dev/null +++ b/Sanity/gcc-fedora-flags/runtest.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +set -x + +default_cflags=`rpm -E %{build_cflags}` +default_cxxflags=`rpm -E %{build_cxxflags}` +default_ldflags=`rpm -E %{build_ldflags}` + +cflags=`rpm -D '%toolchain gcc' -E %{build_cflags}` +cxxflags=`rpm -D '%toolchain gcc' -E %{build_cxxflags}` +ldflags=`rpm -D '%toolchain gcc' -E %{build_ldflags}` + +set +x + +rlJournalStart +rlPhaseStartTest + rlRun "rpm -qa | grep -F -e redhat-rpm-config -e gcc -e annobin -e binutils | sort" + + rlRun "test \"$default_cflags\" = \"$cflags\"" + rlRun "test \"$default_cxxflags\" = \"$cxxflags\"" + rlRun "test \"$default_ldflags\" = \"$ldflags\"" + + rlRun "gcc $cflags -o hello.o -c hello.c" + rlRun "annocheck hello.o" + rlRun "gcc $cflags -o main.o -c main.c" + rlRun "gcc $ldflags -o hello main.o hello.o" + rlRun "annocheck hello" + rlRun "./hello | grep \"Hello World\"" + + rlRun "g++ $cxxflags -o hello-cpp.o -c hello.cpp" + rlRun "annocheck hello-cpp.o" + rlRun "g++ $cxxflags -o main-cpp.o -c main.cpp" + rlRun "g++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o" + rlRun "annocheck hello-cpp" + rlRun "./hello-cpp | grep \"Hello World\"" +rlPhaseEnd +rlJournalPrintText +rlJournalEnd