From 950019dfcd8e29685c079ffb818354be3892221c Mon Sep 17 00:00:00 2001 From: Zoltan Fridrich Date: Fri, 23 Jul 2021 13:49:02 +0200 Subject: [PATCH] Add gating.yaml and tests Resolves: rhbz#1938758 (check-gitbz workaround, this bz is unrelated) --- gating.yaml | 6 ++++++ tests/devel-usability/runtest.sh | 22 ++++++++++++++++++++++ tests/devel-usability/test.c | 9 +++++++++ tests/tests.yml | 14 ++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 gating.yaml create mode 100755 tests/devel-usability/runtest.sh create mode 100644 tests/devel-usability/test.c create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..648918d --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/devel-usability/runtest.sh b/tests/devel-usability/runtest.sh new file mode 100755 index 0000000..831b2a1 --- /dev/null +++ b/tests/devel-usability/runtest.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e +set -x + +TEST_SOURCE=test.c +TEST_TARGET="${TEST_SOURCE/\.c/}" + +CXXFLAGS="$(rpm --eval '%{build_cxxflags}')" +LDFLAGS="$(rpm --eval '%{build_ldflags}')" +PKGFLAGS="$(pkg-config libseccomp --cflags --libs)" + +# build target using distribution-specific flags +gcc -Werror $CXXFLAGS $LDFLAGS $PKGFLAGS -o $TEST_TARGET $TEST_SOURCE + +# test that target exists +test -f ./$TEST_TARGET + +# test that target is executable +test -x ./$TEST_TARGET + +# test that target runs successfully +./$TEST_TARGET diff --git a/tests/devel-usability/test.c b/tests/devel-usability/test.c new file mode 100644 index 0000000..964eba7 --- /dev/null +++ b/tests/devel-usability/test.c @@ -0,0 +1,9 @@ +#include +#include + +int main(void) +{ + const struct scmp_version *version = seccomp_version(); + printf("Version: %d.%d.%d\n", version->major, version->minor, version->micro); + return 0; +} diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b5072de --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,14 @@ +--- +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-basic + tests: + - devel-usability + required_packages: + - gcc + - rpm + - redhat-rpm-config + - pkgconf-pkg-config + - libseccomp-devel