Imported from the Fedora annobin repo

Copied from:
https://src.fedoraproject.org/rpms/annobin/blob/rawhide/f/tests/Sanity/gcc-fedora-flags
This commit is contained in:
Václav Kadlčík 2023-03-30 09:30:40 +02:00
commit 64852cd1e4
6 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#include <stdio.h>
void hello() {
printf("Hello World\n");
}

View file

@ -0,0 +1,5 @@
#include <iostream>
void hello() {
std::cout << "Hello World\n";
}

View file

@ -0,0 +1,6 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

View file

@ -0,0 +1,6 @@
void hello();
int main(int argc, char **argv) {
hello();
return 0;
}

View file

@ -0,0 +1,22 @@
summary: gcc-fedora-flags
description: ''
contact:
- Tom Stellard <tstellar@redhat.com>
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

View file

@ -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