Add gating.yaml and tests

Resolves: rhbz#1938758 (check-gitbz workaround, this bz is unrelated)
This commit is contained in:
Zoltan Fridrich 2021-07-21 14:22:43 +02:00
parent 3c61d74200
commit 3889bc54da
4 changed files with 84 additions and 0 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -0,0 +1,45 @@
// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
#include <iostream>
#include <string>
#include <tao/pegtl.hpp>
namespace pegtl = tao::pegtl;
namespace hello
{
// clang-format off
struct prefix : pegtl::string< 'H', 'e', 'l', 'l', 'o', ',', ' ' > {};
struct name : pegtl::plus< pegtl::alpha > {};
struct grammar : pegtl::must< prefix, name, pegtl::one< '!' >, pegtl::eof > {};
// clang-format on
template< typename Rule >
struct action : pegtl::nothing<Rule>
{};
template<>
struct action< name >
{
template< typename Input >
static void apply( const Input& in, std::string& v )
{
v = in.string();
}
};
} // namespace hello
int main( int argc, char** argv )
{
if( argc > 1 ) {
std::string name;
pegtl::argv_input<> in( argv, 1 );
pegtl::parse< hello::grammar, hello::action >( in, name );
std::cout << "Good bye, " << name << "!" << std::endl;
}
}

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
TEST_SOURCE=hello_world.cpp
TEST_TARGET="${TEST_SOURCE/\.cpp/}"
CXXFLAGS="$(rpm --eval '%{build_cxxflags}')"
LDFLAGS="$(rpm --eval '%{build_ldflags}')"
# build target using distribution-specific flags
g++ -std=c++11 $CXXFLAGS $LDFLAGS -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 "Hello, world!"

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- devel-usability
required_packages:
- gcc-c++
- rpm
- redhat-rpm-config
- PEGTL-devel