diff --git a/linux-tools/oddjob/oddjob.sh b/linux-tools/oddjob/oddjob.sh index 2c4ff0a9e..66bbef093 100755 --- a/linux-tools/oddjob/oddjob.sh +++ b/linux-tools/oddjob/oddjob.sh @@ -37,12 +37,12 @@ ODDJOB_CMDDIR="${LTPBIN%/shared}/oddjob/tests/cmdparse" function tc_local_setup() { # Check Installation - tc_check_package oddjob - tc_break_if_bad $? "oddjob required, but not installed" || return + tc_check_package oddjob + tc_break_if_bad $? "oddjob required, but not installed" || return cp $TESTDIR/tests/test-oddjobd.sh $TESTDIR/tests/test-oddjobd.sh.bkp sed -e 's/break/exit 1/g' -e '/exit 0/d' -i $TESTDIR/tests/test-oddjobd.sh - tc_check_package oddjob + pkgname=$(tc_print_package_version oddjob) cp $TESTDIR/tests/test-oddjobd.conf $TESTDIR/tests/test-oddjobd.conf.bkp sed -e 's|/builddir/build/BUILD/'$pkgname'/tests/|'$ODDJOB_TESTDIR'|g' -e 's/"mockbuild"/"root"/' -i $TESTDIR/tests/test-oddjobd.conf sed -e 's|\(^[0-9].*\)|0|g' -e 's|mockbuild|root|g' -i $TESTDIR/tests/006/expected_stdout diff --git a/linux-tools/shared/tc_utils.source b/linux-tools/shared/tc_utils.source index 09534b06f..de81890b7 100755 --- a/linux-tools/shared/tc_utils.source +++ b/linux-tools/shared/tc_utils.source @@ -2586,3 +2586,20 @@ function tc_check_package() rc=$? return $rc } + +################################################### +# Function to print package name and version +################################################### +function tc_print_package_version() +{ + local package=$1 + # check for Ubuntu OS + grep -i "ubuntu" /etc/*-release >/dev/null 2>&1 + if [ $? -eq 0 ];then # Start of OS check + dpkg --list| grep $package + else + rpm -q $package | sed -En "/$package-[0-9].*/p" + fi +} + +