diff --git a/examples/template/README.rst b/examples/template/README.rst new file mode 100644 index 0000000000..678f4e9d1a --- /dev/null +++ b/examples/template/README.rst @@ -0,0 +1,12 @@ + +================================================================== + tmt test template +================================================================== + +When creating a new ``tmt`` test it is recommended to use the test +template provided in this directory. In order to be able to use it +directly from the ``tmt test create`` command you might want to +symlink it to your configuration:: + + ln -sr test.sh ~/.config/tmt/templates/script/tmt.j2 + ln -sr main.fmf ~/.config/tmt/templates/test/tmt.j2 diff --git a/examples/template/main.fmf b/examples/template/main.fmf new file mode 100644 index 0000000000..bc4c1a527e --- /dev/null +++ b/examples/template/main.fmf @@ -0,0 +1,4 @@ +summary: Verify that this and that works like this +description: + Include a bit longer description which would help a stranger + or your future self to quickly grasp the purpose of the test. diff --git a/examples/template/test.sh b/examples/template/test.sh new file mode 100755 index 0000000000..3214a21ae1 --- /dev/null +++ b/examples/template/test.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "run=\$(mktemp -d)" 0 "Create a run directory" + rlRun "pushd data" + rlPhaseEnd + + rlPhaseStartTest + rlRun "tmt run --id $run" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlGetTestState || rlFileSubmit "$run/log.txt" + rlRun "rm -r $run" 0 "Remove the run directory" + rlPhaseEnd +rlJournalEnd