Compare commits

..

5 commits

Author SHA1 Message Date
Fedora Release Engineering
866e121716 Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-24 20:38:55 +00:00
Fedora Release Engineering
27ef5073dd Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-17 15:31:22 +00:00
Lumir Balhar
d1c17317af Mark the license in specfile as SPDX 2024-08-01 14:17:17 +02:00
Fedora Release Engineering
8831ece8e3 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-18 15:36:42 +00:00
Lukas Zachar
f1ba5cdc1d Import CI tests from RHEL
This is from RHEL distgit tests/libyaml, directory Sanity/smoke.

The original commit hash: 03647450fb247d1304a8f372c63db2bca5273bb4

Only necessary files were kept (and simplified).

Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2024-05-10 13:51:36 +02:00
8 changed files with 140 additions and 1 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

View file

@ -6,9 +6,10 @@
Name: libyaml
Version: 0.2.5
Release: 14%{?dist}
Release: 17%{?dist}
Summary: YAML 1.1 parser and emitter written in C
# SPDX
License: MIT
URL: https://github.com/yaml/libyaml
Source0: https://github.com/yaml/libyaml/releases/download/%{version}/yaml-%{version}.tar.gz
@ -140,6 +141,15 @@ popd
%changelog
* Thu Jul 24 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.5-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Fri Jan 17 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.5-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.5-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.5-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

4
plan.fmf Normal file
View file

@ -0,0 +1,4 @@
discover:
how: fmf
execute:
how: tmt

12
tests/smoke/main.fmf Normal file
View file

@ -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

View file

@ -0,0 +1,4 @@
%YAML 1.1
---
{Backoff: 1}
...

View file

@ -0,0 +1,6 @@
%YAML 1.1
--- # Indented Block
name: John Smith
age: 33
--- # Inline Block
{name: John Smith, age: 33}

63
tests/smoke/run-parser.c Normal file
View file

@ -0,0 +1,63 @@
#include <yaml.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <assert.h>
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;
}

39
tests/smoke/runtest.sh Executable file
View file

@ -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 <lzachar@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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