Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/flex.git#8a8070ad74c0fa674f7f2b20a782284f6b69e752
This commit is contained in:
DistroBaker 2021-02-09 18:22:46 +01:00
parent 4b5c6080c2
commit 8245e5a50d
12 changed files with 265 additions and 1 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -3,7 +3,7 @@
Summary: A tool for generating scanners (text pattern recognizers)
Name: flex
Version: 2.6.4
Release: 6%{?dist}
Release: 7%{?dist}
# parse.c and parse.h are under GPLv3+ with exception which allows
# relicensing. Since flex is shipped under BDS-style license,
# let's assume that the relicensing was done.
@ -16,6 +16,7 @@ Patch0: flex-rh1389575.patch
Requires: m4
BuildRequires: gettext gettext-devel bison m4 help2man gcc gcc-c++ automake libtool
BuildRequires: make
%description
The flex program generates scanners. Scanners are programs which can
@ -141,6 +142,9 @@ echo ============END TESTING===========
%{_pkgdocdir}
%changelog
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Aug 21 2020 Arjun Shankar <arjun@redhat.com> - 2.6.4-6
- Re-work flex subpackages and provide shared libraries (#1327851):
- Remove and obsolete the flex-devel subpackage containing static libraries

19
gating.yaml Normal file
View File

@ -0,0 +1,19 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

6
plans/ci.fmf Normal file
View File

@ -0,0 +1,6 @@
summary: CI Gating Plan
discover:
how: fmf
directory: tests
execute:
how: beakerlib

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/flex/Sanity/smoke-check-flex-runs
# Description: Show your version. Build a one-file project.
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/flex/Sanity/smoke-check-flex-runs
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE count_chars_and_lines.l calc-lexer.l calc-grammar.y expected_calc_output.txt
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Vaclav Kadlcik <vkadlcik@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Show your version. Build a one-file project." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: flex" >> $(METADATA)
@echo "Requires: flex bison gcc" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /tools/flex/Sanity/smoke-check-flex-runs
Description: Show your version. Build a one-file project.
Author: Vaclav Kadlcik <vkadlcik@redhat.com>

View File

@ -0,0 +1,36 @@
%{
#include <stdio.h>
%}
%token NUMBER
%token ADD SUB MUL DIV
%token EOL
%%
input:
| input EOL { }
| input expression EOL { printf("%d\n", $2); }
;
expression:
factor
| expression ADD factor { $$ = $1 + $3; }
| expression SUB factor { $$ = $1 - $3; }
;
factor:
NUMBER
| factor MUL NUMBER { $$ = $1 * $3; }
| factor DIV NUMBER { $$ = $1 / $3; }
;
%%
int main(int argc, char ** argv) {
yyparse();
}
yyerror(char *s) {
fprintf(stderr, "ERROR: %s\n", s);
}

View File

@ -0,0 +1,15 @@
%option noyywrap
%{
#include "calc-grammar.tab.h"
%}
%%
"+" { return ADD; }
"-" { return SUB; }
"*" { return MUL; }
"/" { return DIV; }
[0-9]+ { yylval = atoi(yytext); return NUMBER; }
\n { return EOL; }
[ \t] { /* ignore whitespaces */ }
. { yyerror("unexpected character %c", *yytext); }
%%

View File

@ -0,0 +1,21 @@
%option noyywrap
%{
#include <stdio.h>
int chars = 0;
int lines = 0;
%}
%%
\n { lines++; chars++; }
. { chars++; }
%%
int main(int argc, char ** argv) {
yylex();
printf("chars: %d\n", chars);
printf("lines: %d\n", lines);
return 0;
}

View File

@ -0,0 +1,3 @@
STDOUT: 7
STDOUT: -221
STDOUT: 42

View File

@ -0,0 +1,15 @@
summary: Show your version. Build a one-file project.
description: ''
contact:
- Vaclav Kadlcik <vkadlcik@redhat.com>
component:
- flex
test: ./runtest.sh
framework: beakerlib
recommend:
- flex
- bison
- gcc
duration: 15m
extra-summary: /tools/flex/Sanity/smoke-check-flex-runs
extra-task: /tools/flex/Sanity/smoke-check-flex-runs

View File

@ -0,0 +1,78 @@
#!/usr/bin/env bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/flex/Sanity/smoke-check-flex-runs
# Description: Show your version. Build a one-file project.
# Author: Vaclav Kadlcik <vkadlcik@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="flex"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
yum -y install bison gcc
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp count_chars_and_lines.l calc-lexer.l calc-grammar.y expected_calc_output.txt $TmpDir"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest 'Show version'
rlRun -t -s 'flex -V'
rlAssertNotGrep '^STDERR:' $rlRun_LOG
rlAssertGrep '^STDOUT: flex [0-9]' $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest 'Flex works standalone'
rlRun 'flex -o count_chars_and_lines.c count_chars_and_lines.l'
rlRun 'gcc -o count_chars_and_lines count_chars_and_lines.c'
rlAssertExists 'count_chars_and_lines'
rlRun -t -s 'echo -e "nazdar\nbazar" | ./count_chars_and_lines'
rlAssertNotGrep '^STDERR:' $rlRun_LOG
rlAssertGrep '^STDOUT: chars: 13$' $rlRun_LOG
rlAssertGrep '^STDOUT: lines: 2$' $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest 'Flex works with Bison'
rlRun 'bison -d calc-grammar.y'
rlRun 'flex calc-lexer.l'
rlRun 'gcc -o calc calc-grammar.tab.c lex.yy.c'
rlAssertExists 'calc'
rlRun -t -s 'echo -e "1 + 2 * 3\n1 - 666 / 3\n42" | ./calc'
rlAssertNotDiffer expected_calc_output.txt $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd