diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..16755b7 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,5 @@ +--- !Policy + +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..e6427de --- /dev/null +++ b/plan.fmf @@ -0,0 +1,4 @@ +discover: + how: fmf +execute: + how: tmt diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf new file mode 100644 index 0000000..0331d09 --- /dev/null +++ b/tests/smoke/main.fmf @@ -0,0 +1,12 @@ +summary: Run examples +description: | + Runs simple examples which already caused problems while fixing CVE. + run-parser is taken from the source +component: + - libyaml +test: ./runtest.sh +framework: beakerlib +require: + - libyaml-devel + - gcc +duration: 5m diff --git a/tests/smoke/regression_1033990.yaml b/tests/smoke/regression_1033990.yaml new file mode 100644 index 0000000..6f25454 --- /dev/null +++ b/tests/smoke/regression_1033990.yaml @@ -0,0 +1,4 @@ +%YAML 1.1 +--- +{Backoff: 1} +... diff --git a/tests/smoke/regression_1063866.yaml b/tests/smoke/regression_1063866.yaml new file mode 100644 index 0000000..68f23a0 --- /dev/null +++ b/tests/smoke/regression_1063866.yaml @@ -0,0 +1,6 @@ +%YAML 1.1 +--- # Indented Block + name: John Smith + age: 33 +--- # Inline Block +{name: John Smith, age: 33} diff --git a/tests/smoke/run-parser.c b/tests/smoke/run-parser.c new file mode 100644 index 0000000..1303112 --- /dev/null +++ b/tests/smoke/run-parser.c @@ -0,0 +1,63 @@ +#include + +#include +#include + +#ifdef NDEBUG +#undef NDEBUG +#endif +#include + +int +main(int argc, char *argv[]) +{ + int number; + + if (argc < 2) { + printf("Usage: %s file1.yaml ...\n", argv[0]); + return 0; + } + + for (number = 1; number < argc; number ++) + { + FILE *file; + yaml_parser_t parser; + yaml_event_t event; + int done = 0; + int count = 0; + int error = 0; + + printf("[%d] Parsing '%s': ", number, argv[number]); + fflush(stdout); + + file = fopen(argv[number], "rb"); + assert(file); + + assert(yaml_parser_initialize(&parser)); + + yaml_parser_set_input_file(&parser, file); + + while (!done) + { + if (!yaml_parser_parse(&parser, &event)) { + error = 1; + break; + } + + done = (event.type == YAML_STREAM_END_EVENT); + + yaml_event_delete(&event); + + count ++; + } + + yaml_parser_delete(&parser); + + assert(!fclose(file)); + + printf("%s (%d events)\n", (error ? "FAILURE" : "SUCCESS"), count); + } + + return 0; +} + diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100755 index 0000000..e1540ed --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libyaml/Sanity/smoke +# Description: What the test does +# Author: Lukas Zachar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartTest + rlRun "gcc -O2 -Wall -W -g run-parser.c -lyaml -o run-parser" + rlRun "./run-parser regression_1063866.yaml" + rlRun "./run-parser regression_1033990.yaml" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd