Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing test script issues #138

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions linux-tools/authconfig/authconfig-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
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
}