Introduce CI gating
This commit is contained in:
parent
d13f0a5806
commit
8a8070ad74
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
19
gating.yaml
Normal file
19
gating.yaml
Normal 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
6
plans/ci.fmf
Normal file
@ -0,0 +1,6 @@
|
||||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
directory: tests
|
||||
execute:
|
||||
how: beakerlib
|
63
tests/Sanity/smoke-check-flex-runs/Makefile
Normal file
63
tests/Sanity/smoke-check-flex-runs/Makefile
Normal 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)
|
3
tests/Sanity/smoke-check-flex-runs/PURPOSE
Normal file
3
tests/Sanity/smoke-check-flex-runs/PURPOSE
Normal 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>
|
36
tests/Sanity/smoke-check-flex-runs/calc-grammar.y
Normal file
36
tests/Sanity/smoke-check-flex-runs/calc-grammar.y
Normal 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);
|
||||
}
|
15
tests/Sanity/smoke-check-flex-runs/calc-lexer.l
Normal file
15
tests/Sanity/smoke-check-flex-runs/calc-lexer.l
Normal 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); }
|
||||
%%
|
21
tests/Sanity/smoke-check-flex-runs/count_chars_and_lines.l
Normal file
21
tests/Sanity/smoke-check-flex-runs/count_chars_and_lines.l
Normal 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;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
STDOUT: 7
|
||||
STDOUT: -221
|
||||
STDOUT: 42
|
15
tests/Sanity/smoke-check-flex-runs/main.fmf
Normal file
15
tests/Sanity/smoke-check-flex-runs/main.fmf
Normal 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
|
78
tests/Sanity/smoke-check-flex-runs/runtest.sh
Executable file
78
tests/Sanity/smoke-check-flex-runs/runtest.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user