Skip to content

Commit

Permalink
Bug Description: oddjob change pkgname var expression
Browse files Browse the repository at this point in the history
Fixed: added general package version check function to tc_utils.source and changed the same in oddjob script

signed-off by: Spoorthy<[email protected]>
  • Loading branch information
spoorthy committed Apr 10, 2018
1 parent 1225df8 commit 3bf86ff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions linux-tools/oddjob/oddjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions linux-tools/shared/tc_utils.source
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


0 comments on commit 3bf86ff

Please sign in to comment.