From d6a2f172d658927a1f21b6111d490cf2a4fb773d Mon Sep 17 00:00:00 2001 From: Aleksandra Fedorova Date: Sat, 25 Jul 2020 18:34:17 +0200 Subject: [PATCH] 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. --- tests/build_hello_world.sh | 9 +++++++++ tests/data/hello.c | 5 +++++ tests/data/hello.cpp | 5 +++++ tests/tests.yml | 14 ++++++++++++++ 4 files changed, 33 insertions(+) create mode 100755 tests/build_hello_world.sh create mode 100644 tests/data/hello.c create mode 100644 tests/data/hello.cpp create mode 100644 tests/tests.yml diff --git a/tests/build_hello_world.sh b/tests/build_hello_world.sh new file mode 100755 index 0000000..f6aae70 --- /dev/null +++ b/tests/build_hello_world.sh @@ -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" diff --git a/tests/data/hello.c b/tests/data/hello.c new file mode 100644 index 0000000..fe064a2 --- /dev/null +++ b/tests/data/hello.c @@ -0,0 +1,5 @@ +#include +int main() { + printf("Hello World!\n"); + return 0; +} diff --git a/tests/data/hello.cpp b/tests/data/hello.cpp new file mode 100644 index 0000000..2131d8a --- /dev/null +++ b/tests/data/hello.cpp @@ -0,0 +1,5 @@ +#include +int main() { + std::cout << "Hello World!\n"; + return 0; +} diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..dfe09e0 --- /dev/null +++ b/tests/tests.yml @@ -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"