Resolves: RHELMISC-5984 Add tmt based CI test
This commit is contained in:
parent
17c26f681e
commit
bb00087b6c
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
5
plans/basic.fmf
Normal file
5
plans/basic.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
summary: Basic smoke test
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
||||
3
tests/foma-input.txt
Normal file
3
tests/foma-input.txt
Normal file
@ -0,0 +1,3 @@
|
||||
def Animals c a t | d o g ;
|
||||
regex Animals+ ;
|
||||
print defined
|
||||
7
tests/main.fmf
Normal file
7
tests/main.fmf
Normal file
@ -0,0 +1,7 @@
|
||||
framework: beakerlib
|
||||
duration: 10m
|
||||
require:
|
||||
- foma
|
||||
- python3
|
||||
test: ./runtest.sh
|
||||
|
||||
23
tests/runtest.sh
Executable file
23
tests/runtest.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlAssertRpm python3
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "cp test_foma.py foma-input.txt $tmp"
|
||||
rlRun "pushd $tmp"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "python3 test_foma.py -v" \
|
||||
0 "Running test cases"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
25
tests/test_foma.py
Normal file
25
tests/test_foma.py
Normal file
@ -0,0 +1,25 @@
|
||||
import unittest
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
class TestFoma(unittest.TestCase):
|
||||
|
||||
def test_dummy(self):
|
||||
self.assertEqual(True, True)
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_expected_failure(self):
|
||||
self.assertEqual(False, True)
|
||||
|
||||
def test_foma(self):
|
||||
cp = subprocess.run(['foma -f foma-input.txt'], encoding='UTF-8', text=True, shell=True, capture_output=True)
|
||||
self.assertEqual(
|
||||
'defined Animals: 455 bytes. 6 states, 6 arcs, 2 paths.\n'
|
||||
'471 bytes. 6 states, 8 arcs, Cyclic.\n'
|
||||
'Animals\t455 bytes. 6 states, 6 arcs, 2 paths.\n',
|
||||
cp.stdout)
|
||||
self.assertEqual('', cp.stderr)
|
||||
self.assertEqual(0, cp.returncode)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Reference in New Issue
Block a user