Merge #22 Import gcc-fedora-flags test from redhat-rpm-config
This commit is contained in:
commit
d7e191c777
5
tests/fedora-flags/hello.c
Normal file
5
tests/fedora-flags/hello.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void hello() {
|
||||
printf("Hello World\n");
|
||||
}
|
5
tests/fedora-flags/hello.cpp
Normal file
5
tests/fedora-flags/hello.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <iostream>
|
||||
|
||||
void hello() {
|
||||
std::cout << "Hello World\n";
|
||||
}
|
6
tests/fedora-flags/main.c
Normal file
6
tests/fedora-flags/main.c
Normal file
@ -0,0 +1,6 @@
|
||||
void hello();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
hello();
|
||||
return 0;
|
||||
}
|
6
tests/fedora-flags/main.cpp
Normal file
6
tests/fedora-flags/main.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
void hello();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
hello();
|
||||
return 0;
|
||||
}
|
10
tests/fedora-flags/main.fmf
Normal file
10
tests/fedora-flags/main.fmf
Normal file
@ -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
|
29
tests/fedora-flags/runtest.sh
Executable file
29
tests/fedora-flags/runtest.sh
Executable file
@ -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"
|
Loading…
Reference in New Issue
Block a user