diff --git a/doc/TODO b/doc/TODO index c1c577c..3c8bc58 100644 --- a/doc/TODO +++ b/doc/TODO @@ -9,3 +9,6 @@ - Find a solution on how we test desktop applications such as using: 1. GNU LDTP (Linux Desktop Testing Project) 2. Dogtail + +- Make a list of the top 200 most often downloaded apps from mirror.centos.org + and see if we can get 100% coverage for them; then expand to top 500 \ No newline at end of file diff --git a/tests/p_openssh/_helper_sshd_user_login-with-key.expect b/tests/p_openssh/_helper_sshd_user_login-with-key.expect new file mode 100644 index 0000000..7e01d18 --- /dev/null +++ b/tests/p_openssh/_helper_sshd_user_login-with-key.expect @@ -0,0 +1,7 @@ +#!/usr/bin/expect -f +# Author: Athmane Madjoudj + +set timeout 2 +spawn ssh -o StrictHostKeyChecking=no sshtest@localhost /bin/cat ssh_test_file +send -- "\r" +expect eof diff --git a/tests/p_openssh/sshd_user_login-with-key.sh b/tests/p_openssh/sshd_user_login-with-key.sh new file mode 100644 index 0000000..0ea04b1 --- /dev/null +++ b/tests/p_openssh/sshd_user_login-with-key.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +for KeyType in rsa dsa; do + userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest + runuser -l sshtest -c "echo | ssh-keygen -q -t ${KeyType} -b 1024 -f ~/.ssh/id_${KeyType}" > /dev/null + runuser -l sshtest -c "cat ~/.ssh/*pub > ~/.ssh/authorized_keys && chmod 600 ~/.ssh/*keys" > /dev/null + cp ./tests/p_openssh/_helper_sshd_user_login-with-key.expect /home/sshtest/ && chmod +x /home/sshtest/*.expect + + # Create a test file + TestString=$( mktemp -u ) + echo $TestString > /home/sshtest/ssh_test_file + + t_Log "Running $0 - SSH User can login using ${KeyType} key." + runuser -l sshtest -c "~/_helper_sshd_user_login-with-key.expect" | grep ${TestString} > /dev/null 2>&1 + t_CheckExitStatus $? + userdel -rf sshtest +done \ No newline at end of file diff --git a/tests/p_openssh/sshd_user_login.sh b/tests/p_openssh/sshd_user_login.sh index 5a962e8..78b64bb 100755 --- a/tests/p_openssh/sshd_user_login.sh +++ b/tests/p_openssh/sshd_user_login.sh @@ -6,12 +6,12 @@ userdel -rf sshtest; useradd sshtest && echo sshtest | passwd --stdin sshtest # Create a test file touch /home/sshtest/ssh_test_file -t_Log "Running $0 - SSH user login test." - -./tests/p_openssh/_helper_sshd_user_login.expect | grep "ssh_test_file" - > /dev/null 2>&1 - -t_CheckExitStatus $? - -userdel -rf sshtest +t_Log "Running $0 - SSH Interactive user login test." +if [ `egrep "^PasswordAuthentication" /etc/ssh/sshd_config | tail -n1 | egrep "\syes$" | wc -l ` -gt 0 ]; then + ./tests/p_openssh/_helper_sshd_user_login.expect | grep "ssh_test_file" > /dev/null 2>&1 + t_CheckExitStatus $? + userdel -rf sshtest +else + t_Log 'Skipped' +fi diff --git a/tests/p_yum/yum_distroverpkg.sh b/tests/p_yum/yum_distroverpkg.sh index 57d84b5..3ea970a 100755 --- a/tests/p_yum/yum_distroverpkg.sh +++ b/tests/p_yum/yum_distroverpkg.sh @@ -1,13 +1,7 @@ #!/bin/sh -# Author: Athmane Madjoudj t_Log "Running $0 - Yum configuration has the correct distroverpkg value test." -if (t_GetPkgRel basesystem | grep -q el6) -then - grep "distroverpkg=centos-release" /etc/yum.conf >/dev/null 2>&1 -else - echo "Test skipped for CentOS <= 5" -fi - -t_CheckExitStatus $? +ProvierTag=$(grep distroverpkg /etc/yum.conf | cut -f2 -d'=') +rpm -q --whatprovides ${ProvierTag} | grep centos-release > /dev/null +t_CheckExitStatus $? \ No newline at end of file