public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gcc] rhel-f41-base: Import gcc-fedora-flags test from redhat-rpm-config
@ 2026-06-29 12:29 Tom Stellard
  0 siblings, 0 replies; only message in thread
From: Tom Stellard @ 2026-06-29 12:29 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/gcc
            Branch : rhel-f41-base
            Commit : d4fb9f8ed8cd9780656b2d1533f9da2cc4bc155f
            Author : Tom Stellard <tstellar@redhat.com>
            Date   : 2022-04-19T12:01:29-07:00
            Stats  : +61/-0 in 6 file(s)
            URL    : https://src.fedoraproject.org/rpms/gcc/c/d4fb9f8ed8cd9780656b2d1533f9da2cc4bc155f?branch=rhel-f41-base

            Log:
            Import gcc-fedora-flags test from redhat-rpm-config

Once this is committed, the version in redhat-rpm-config will be removed
and redhat-rpm-config will use this test.

---
diff --git a/tests/fedora-flags/hello.c b/tests/fedora-flags/hello.c
new file mode 100644
index 0000000..51b259b
--- /dev/null
+++ b/tests/fedora-flags/hello.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+void hello() {
+  printf("Hello World\n");
+}

diff --git a/tests/fedora-flags/hello.cpp b/tests/fedora-flags/hello.cpp
new file mode 100644
index 0000000..400612b
--- /dev/null
+++ b/tests/fedora-flags/hello.cpp
@@ -0,0 +1,5 @@
+#include <iostream>
+
+void hello() {
+  std::cout << "Hello World\n";
+}

diff --git a/tests/fedora-flags/main.c b/tests/fedora-flags/main.c
new file mode 100644
index 0000000..1a3455d
--- /dev/null
+++ b/tests/fedora-flags/main.c
@@ -0,0 +1,6 @@
+void hello();
+
+int main(int argc, char **argv) {
+  hello();
+  return 0;
+}

diff --git a/tests/fedora-flags/main.cpp b/tests/fedora-flags/main.cpp
new file mode 100644
index 0000000..1a3455d
--- /dev/null
+++ b/tests/fedora-flags/main.cpp
@@ -0,0 +1,6 @@
+void hello();
+
+int main(int argc, char **argv) {
+  hello();
+  return 0;
+}

diff --git a/tests/fedora-flags/main.fmf b/tests/fedora-flags/main.fmf
new file mode 100644
index 0000000..43934a7
--- /dev/null
+++ b/tests/fedora-flags/main.fmf
@@ -0,0 +1,10 @@
+summary: Test compiling with the Fedora C/CXX flags.
+description: ''
+component:
+  - gcc
+test: ./runtest.sh
+require:
+  - annobin-annocheck
+  - gcc
+  - gcc-c++
+  - redhat-rpm-config

diff --git a/tests/fedora-flags/runtest.sh b/tests/fedora-flags/runtest.sh
new file mode 100755
index 0000000..01b656b
--- /dev/null
+++ b/tests/fedora-flags/runtest.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -ex
+
+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}')
+
+test "$default_cflags" = "$cflags"
+test "$default_cxxflags" = "$cxxflags"
+test "$default_ldflags" = "$ldflags"
+
+gcc $cflags -o hello.o -c hello.c
+annocheck hello.o
+gcc $cflags -o main.o -c main.c
+gcc $ldflags -o hello main.o hello.o
+annocheck hello
+./hello | grep "Hello World"
+
+g++ $cxxflags -o hello-cpp.o -c hello.cpp
+annocheck hello-cpp.o
+g++ $cxxflags -o main-cpp.o -c main.cpp
+g++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
+annocheck hello-cpp
+./hello-cpp | grep "Hello World"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-29 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-29 12:29 [rpms/gcc] rhel-f41-base: Import gcc-fedora-flags test from redhat-rpm-config Tom Stellard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox