From 56730f1d141be0c840cb5c71173347aa94f47831 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Tue, 11 Jul 2023 10:45:41 +0200 Subject: [PATCH] re-import sources as agreed with the maintainer --- .gitignore | 2 ++ gating.yaml | 6 ++++ tests/devel-usability/hello_world.cpp | 45 +++++++++++++++++++++++++++ tests/devel-usability/runtest.sh | 20 ++++++++++++ tests/tests.yml | 13 ++++++++ 5 files changed, 86 insertions(+) create mode 100644 gating.yaml create mode 100644 tests/devel-usability/hello_world.cpp create mode 100755 tests/devel-usability/runtest.sh create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index ce31a13..6f09460 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +/1.3.1.tar.gz +/2.6.0.tar.gz /2.7.0.tar.gz diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/devel-usability/hello_world.cpp b/tests/devel-usability/hello_world.cpp new file mode 100644 index 0000000..58b9706 --- /dev/null +++ b/tests/devel-usability/hello_world.cpp @@ -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 +#include + +#include + +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 + {}; + + 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; + } +} diff --git a/tests/devel-usability/runtest.sh b/tests/devel-usability/runtest.sh new file mode 100755 index 0000000..746571b --- /dev/null +++ b/tests/devel-usability/runtest.sh @@ -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!" diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..87392fa --- /dev/null +++ b/tests/tests.yml @@ -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