Build both C an C++ hello world programs as integration test

Add simple test which builds Hello World programs for both C and C++.
Build options provided by default rpm macro.

Based on

https://github.com/CentOS/sig-core-t_functional/tree/master/tests/p_annobin

Gating is not enabled yet, so the test will not be blocking.
This commit is contained in:
Aleksandra Fedorova 2020-07-25 18:34:17 +02:00 committed by churchyard
parent 9186451072
commit d6a2f172d6
4 changed files with 33 additions and 0 deletions

9
tests/build_hello_world.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -ex
gcc -x c $(rpm --eval %build_cflags) data/hello.c -o hello_c.out
./hello_c.out | grep -q "Hello World"
g++ -x c++ $(rpm --eval %build_cxxflags) data/hello.cpp -o hello_cpp.out
./hello_cpp.out | grep -q "Hello World"

5
tests/data/hello.c Normal file
View File

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

5
tests/data/hello.cpp Normal file
View File

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

14
tests/tests.yml Normal file
View File

@ -0,0 +1,14 @@
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- redhat-rpm-config
- annobin
tests:
- build_hello_world:
dir: .
run: "./build_hello_world.sh"