From 7a16e89b3375acfafd211bb6c4a876e7088a7ccb Mon Sep 17 00:00:00 2001 From: Vector Li Date: Wed, 7 Jun 2023 20:36:04 +0800 Subject: [PATCH] Add a simple test Signed-off-by: Vector Li --- tests/test/script/data/.fmf/version | 1 + tests/test/script/data/tests/foo.fmf | 9 +++++++++ tests/test/script/main.fmf | 1 + tests/test/script/test.sh | 23 +++++++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 tests/test/script/data/.fmf/version create mode 100644 tests/test/script/data/tests/foo.fmf create mode 100644 tests/test/script/main.fmf create mode 100755 tests/test/script/test.sh diff --git a/tests/test/script/data/.fmf/version b/tests/test/script/data/.fmf/version new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/tests/test/script/data/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tests/test/script/data/tests/foo.fmf b/tests/test/script/data/tests/foo.fmf new file mode 100644 index 0000000000..57f0b43eda --- /dev/null +++ b/tests/test/script/data/tests/foo.fmf @@ -0,0 +1,9 @@ +/pos: + summary: Normal test metadata should be accepted + test: 'false' + framework: shell + +/neg: + summary: Malformed test metadata should be rejected + test: false + framework: shell diff --git a/tests/test/script/main.fmf b/tests/test/script/main.fmf new file mode 100644 index 0000000000..01238c893c --- /dev/null +++ b/tests/test/script/main.fmf @@ -0,0 +1 @@ +summary: Verify test metadata should be string diff --git a/tests/test/script/test.sh b/tests/test/script/test.sh new file mode 100755 index 0000000000..755efb095c --- /dev/null +++ b/tests/test/script/test.sh @@ -0,0 +1,23 @@ +#!/bin/bash +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "pushd data" + rlRun "set -o pipefail" + rlPhaseEnd + + rlPhaseStartTest "Normal test metadata" + rlRun -s "tmt tests ls /pos" 0 + rlAssertGrep "/tests/foo/pos" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartTest "Malformed test metadata" + rlRun -s "tmt tests ls /neg" "1-255" + rlAssertGrep "Field '/tests/foo/neg:test' must be a string, 'bool' found" $rlRun_LOG + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlPhaseEnd +rlJournalEnd