-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include an example template for creating
tmt
tests
Vast majority of tests verifying the `tmt` features shares a similar outline of the `beakerlib` skeleton. Let's make it super easy to start writing a new `tmt` test. The skeleton also covers submitting `log.txt` when something goes wrong during the test execution so that a detailed investigation is possible later.
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |