summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2015-11-20 14:08:57 +0100
committerPavel Raiskup <praiskup@redhat.com>2015-11-20 14:08:57 +0100
commit2bbcabf92610a475a93e0b75f28fd82e9953484b (patch)
tree5e61a8c9a6ad5a9440f3485c8fdc6e639be7ae4f
parent872193e6a71f79646cb5b289cbbd26d453b4a443 (diff)
downloaddtf-2bbcabf92610a475a93e0b75f28fd82e9953484b.zip
dtf-2bbcabf92610a475a93e0b75f28fd82e9953484b.tar.gz
dtf-2bbcabf92610a475a93e0b75f28fd82e9953484b.tar.xz
tests-api: new api dtf_assert_right_distro
* share/dtf/lib/tests (dtf_assert_right_distro): New API function used to detect that 'dg' was run with right --distro flag.
-rw-r--r--share/dtf/lib/tests20
1 files changed, 20 insertions, 0 deletions
diff --git a/share/dtf/lib/tests b/share/dtf/lib/tests
index d2d57b1..e5797d1 100644
--- a/share/dtf/lib/tests
+++ b/share/dtf/lib/tests
@@ -41,6 +41,26 @@ dtf_debug ()
}
+dtf_assert_right_distro ()
+{
+ _d_distro='{{ config.os.id }}'
+ _d_distroversion='{{ config.os.version }}'
+ _d_expected=$_d_distro-$_d_distroversion
+
+ case $_d_expected in
+ fedora-*|rhel-7*)
+ test -f /etc/os-release || dtf_fail "/etc/os-release not found!"
+ _d_real=$(. /etc/os-release ; echo "$ID-$VERSION_ID" ; )
+ test "$_d_real" = "$_d_expected" \
+ || dtf_fail "/etc/os-release is wong: $_d_real vs $_d_expected"
+ ;;
+ *)
+ dtf_fail "dtf_assert_right_distro () is not implemented here"
+ ;;
+ esac
+}
+
+
__dtf_debug ()
{
dtf_debug dtf_lib "$*"