From 3bf86ffbed50a0d0f00edf9fe8f72d125db3211c Mon Sep 17 00:00:00 2001 From: spoorthy Date: Tue, 10 Apr 2018 15:11:45 +0530 Subject: [PATCH 1/2] 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 --- linux-tools/oddjob/oddjob.sh | 6 +++--- linux-tools/shared/tc_utils.source | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) 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 +} + + From 1b400c9cc3d9272b4f70c263e7e8c04bf6d42dac Mon Sep 17 00:00:00 2001 From: spoorthy Date: Wed, 11 Apr 2018 10:15:23 +0530 Subject: [PATCH 2/2] Description: authconfig test fails as samba is not supported Fix: Excluded samba related tests when Samba package is not installed signed-off by:spoorthy --- linux-tools/authconfig/authconfig-test.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-tools/authconfig/authconfig-test.sh b/linux-tools/authconfig/authconfig-test.sh index e53ba47d9..ebc8f1821 100755 --- a/linux-tools/authconfig/authconfig-test.sh +++ b/linux-tools/authconfig/authconfig-test.sh @@ -212,6 +212,8 @@ function test_winbind() grep "USEWINBINDAUTH" /etc/sysconfig/authconfig | grep -q "no" tc_pass_or_fail $? "test --disablewinbindauth failed" + tc_check_package samba + if [ $? -eq 0 ]; then #Test smbsecurity types local smb_security_types="user server domain ads" for types in $smb_security_types; do @@ -239,6 +241,10 @@ function test_winbind() authconfig --test 1>$stdout 2>$stderr grep "SMB workgroup" $stdout | grep -q "TESTGROUP" tc_pass_or_fail $? "test --smbworkgroup failed" + + else + tc_info "skipped samba related tests as Samba package is not installed" + fi } function test_hesiod()