Add a test for compiling with the fedora compiler and linker flags

This commit is contained in:
Tom Stellard 2020-07-29 03:45:26 +00:00
commit 39f92abcf4
6 changed files with 46 additions and 0 deletions

5
fedora-flags/hello.c Normal file
View file

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

5
fedora-flags/hello.cpp Normal file
View file

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

6
fedora-flags/main.c Normal file
View file

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

6
fedora-flags/main.cpp Normal file
View file

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

20
fedora-flags/runtest.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
set -ex pipefail
cflags=`rpm -D '%toolchain clang' -E %{build_cflags}`
cxxflags=`rpm -D '%toolchain clang' -E %{build_cxxflags}`
ldflags=`rpm -D '%toolchain clang' -E %{build_ldflags}`
# Test a c program
clang $cflags -c hello.c -o hello.o
clang $cflags -c main.c -o main.o
clang $ldflags -o hello main.o hello.o
./hello | grep "Hello World"
# Test a cxx program
clang++ $cxxflags -c hello.cpp -o hello-cpp.o
clang++ $cxxflags -c main.cpp -o main-cpp.o
clang++ $ldflags -o hello-cpp main-cpp.o hello-cpp.o
./hello-cpp | grep "Hello World"

View file

@ -20,8 +20,12 @@
- libcxx-devel
- glibc-devel
- gcc
# Required for fedora-flags:
- annobin
- redhat-rpm-config
tests:
- rhbz_1657544
- rhbz_1647130
- rhbz_1794936
- llvm-toolchain
- fedora-flags