Implement basic smoke test
This commit is contained in:
parent
b14e048321
commit
3125eb89db
@ -6,3 +6,4 @@ decision_contexts:
|
|||||||
- bodhi_update_push_stable
|
- bodhi_update_push_stable
|
||||||
rules:
|
rules:
|
||||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}
|
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}
|
||||||
|
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional}
|
||||||
|
5
plans/smoke.fmf
Normal file
5
plans/smoke.fmf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
summary: Basic smoke test
|
||||||
|
discover:
|
||||||
|
how: fmf
|
||||||
|
execute:
|
||||||
|
how: tmt
|
54
tests/Sanity/smoke/calc.y
Normal file
54
tests/Sanity/smoke/calc.y
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
%{
|
||||||
|
%}
|
||||||
|
|
||||||
|
%token NUM
|
||||||
|
%left '+' '-'
|
||||||
|
%left '*' '/'
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
exp : NUM { $$.ival = $1.ival; }
|
||||||
|
| exp '+' exp { $$.ival = $1.ival + $3.ival; }
|
||||||
|
| exp '-' exp { $$.ival = $1.ival - $3.ival; }
|
||||||
|
| exp '*' exp { $$.ival = $1.ival * $3.ival; }
|
||||||
|
| exp '/' exp { $$.ival = $1.ival / $3.ival; }
|
||||||
|
| '(' exp ')' { $$.ival = $2.ival; }
|
||||||
|
;
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
private String buf;
|
||||||
|
|
||||||
|
private void yyerror(String s) {
|
||||||
|
throw new RuntimeException("Parse error: " + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int yylex() {
|
||||||
|
if (buf.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int ch = buf.charAt(0);
|
||||||
|
buf = buf.substring(1);
|
||||||
|
if (ch >= '0' && ch <= '9') {
|
||||||
|
yylval.ival = ch - '0';
|
||||||
|
while (!buf.isEmpty() && buf.charAt(0) >= '0' && buf.charAt(0) <= '9') {
|
||||||
|
yylval.ival = yylval.ival * 10 + buf.charAt(0) - '0';
|
||||||
|
buf = buf.substring(1);
|
||||||
|
}
|
||||||
|
return NUM;
|
||||||
|
}
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int parse(String expr) {
|
||||||
|
buf = expr;
|
||||||
|
yyparse();
|
||||||
|
return val_pop().ival;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String args[])
|
||||||
|
{
|
||||||
|
Parser par = new Parser(true);
|
||||||
|
int res = par.parse(args[0]);
|
||||||
|
System.out.println("RESULT is: " + res);
|
||||||
|
}
|
4
tests/Sanity/smoke/main.fmf
Normal file
4
tests/Sanity/smoke/main.fmf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
summary: byaccj smoke test
|
||||||
|
description: |
|
||||||
|
Test basic functionality of byaccj.
|
||||||
|
require: java-devel
|
32
tests/Sanity/smoke/runtest.sh
Executable file
32
tests/Sanity/smoke/runtest.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Author: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
. /usr/share/beakerlib/beakerlib.sh
|
||||||
|
|
||||||
|
rlJournalStart
|
||||||
|
|
||||||
|
rlPhaseStartTest "check for presence of byaccj command"
|
||||||
|
rlAssertRpm byaccj
|
||||||
|
rlAssertBinaryOrigin byaccj byaccj
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "display byaccj usage"
|
||||||
|
rlRun -s "byaccj" 1
|
||||||
|
rlAssertGrep "^usage:" $rlRun_LOG
|
||||||
|
rlAssertGrep "Jclass=className" $rlRun_LOG
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartTest "generate, compile and run a simple parser"
|
||||||
|
rlRun -s "byaccj -J calc.y"
|
||||||
|
rlAssertExists "Parser.java"
|
||||||
|
rlAssertExists "ParserVal.java"
|
||||||
|
rlRun -s "javac *.java"
|
||||||
|
rlAssertExists "Parser.class"
|
||||||
|
rlAssertExists "ParserVal.class"
|
||||||
|
rlRun -s "java -cp . Parser '(42+10)/8*5'"
|
||||||
|
rlAssertGrep "^RESULT is: 30" $rlRun_LOG
|
||||||
|
rlRun -s "java -cp . Parser 'boom'" 1
|
||||||
|
rlAssertGrep "syntax error" $rlRun_LOG
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlJournalEnd
|
||||||
|
rlJournalPrintText
|
4
tests/main.fmf
Normal file
4
tests/main.fmf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
contact: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
framework: beakerlib
|
||||||
|
test: ./runtest.sh
|
||||||
|
tier: 1
|
Loading…
Reference in New Issue
Block a user