From 2bbcabf92610a475a93e0b75f28fd82e9953484b Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 20 Nov 2015 14:08:57 +0100 Subject: 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. --- share/dtf/lib/tests | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'share/dtf') 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 "$*" -- cgit