Skip to content

Commit 3bf86ff

Browse files
author
spoorthy
committed
Bug Description: oddjob change pkgname var expression
Fixed: added general package version check function to tc_utils.source and changed the same in oddjob script signed-off by: Spoorthy<[email protected]>
1 parent 1225df8 commit 3bf86ff

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

linux-tools/oddjob/oddjob.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ ODDJOB_CMDDIR="${LTPBIN%/shared}/oddjob/tests/cmdparse"
3737
function tc_local_setup()
3838
{
3939
# Check Installation
40-
tc_check_package oddjob
41-
tc_break_if_bad $? "oddjob required, but not installed" || return
40+
tc_check_package oddjob
41+
tc_break_if_bad $? "oddjob required, but not installed" || return
4242

4343
cp $TESTDIR/tests/test-oddjobd.sh $TESTDIR/tests/test-oddjobd.sh.bkp
4444
sed -e 's/break/exit 1/g' -e '/exit 0/d' -i $TESTDIR/tests/test-oddjobd.sh
45-
tc_check_package oddjob
45+
pkgname=$(tc_print_package_version oddjob)
4646
cp $TESTDIR/tests/test-oddjobd.conf $TESTDIR/tests/test-oddjobd.conf.bkp
4747
sed -e 's|/builddir/build/BUILD/'$pkgname'/tests/|'$ODDJOB_TESTDIR'|g' -e 's/"mockbuild"/"root"/' -i $TESTDIR/tests/test-oddjobd.conf
4848
sed -e 's|\(^[0-9].*\)|0|g' -e 's|mockbuild|root|g' -i $TESTDIR/tests/006/expected_stdout

linux-tools/shared/tc_utils.source

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,3 +2586,20 @@ function tc_check_package()
25862586
rc=$?
25872587
return $rc
25882588
}
2589+
2590+
###################################################
2591+
# Function to print package name and version
2592+
###################################################
2593+
function tc_print_package_version()
2594+
{
2595+
local package=$1
2596+
# check for Ubuntu OS
2597+
grep -i "ubuntu" /etc/*-release >/dev/null 2>&1
2598+
if [ $? -eq 0 ];then # Start of OS check
2599+
dpkg --list| grep $package
2600+
else
2601+
rpm -q $package | sed -En "/$package-[0-9].*/p"
2602+
fi
2603+
}
2604+
2605+

0 commit comments

Comments
 (0)