diff --git a/gating.yaml b/gating.yaml index 0d484d7..6430b69 100644 --- a/gating.yaml +++ b/gating.yaml @@ -6,3 +6,4 @@ decision_contexts: - bodhi_update_push_stable rules: - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/smoke.functional} diff --git a/plans/smoke.fmf b/plans/smoke.fmf new file mode 100644 index 0000000..a1e7bfd --- /dev/null +++ b/plans/smoke.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/Sanity/smoke/calc.y b/tests/Sanity/smoke/calc.y new file mode 100644 index 0000000..d19e37e --- /dev/null +++ b/tests/Sanity/smoke/calc.y @@ -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); +} diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf new file mode 100644 index 0000000..7943bd1 --- /dev/null +++ b/tests/Sanity/smoke/main.fmf @@ -0,0 +1,4 @@ +summary: byaccj smoke test +description: | + Test basic functionality of byaccj. +require: java-devel diff --git a/tests/Sanity/smoke/runtest.sh b/tests/Sanity/smoke/runtest.sh new file mode 100755 index 0000000..fdeb46e --- /dev/null +++ b/tests/Sanity/smoke/runtest.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Author: Mikolaj Izdebski +. /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 diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..9e2ea10 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,4 @@ +contact: Mikolaj Izdebski +framework: beakerlib +test: ./runtest.sh +tier: 1