Skip to content

Commit

Permalink
ltp: fix ltp/commands/mail: Mailer daemon can't report failure to root
Browse files Browse the repository at this point in the history
        fix the following issue:  When mail fail to deliver the mail. Mailer daemon should report this failure to root.
        -----------
        ltp/commands: mail_tests::mail02    2  TFAIL  :  ltpapicmd.c:156: Test #2: No new mail for root. Reason:
                      mail_tests::mail03    3  TFAIL  :  ltpapicmd.c:156: Test #3: No new mail for root. Reason:
        -----------
        We need to install postfix and fix the config file to report the failure to root.

Signed-off-by: Shaoting Lei <[email protected]>
Signed-off-by: Philip Li <[email protected]>
  • Loading branch information
leishaoting authored and rli9 committed Oct 24, 2017
1 parent 91453fc commit eb01e9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions distro/depends/ltp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bind9
dnsutils
apache2
heirloom-mailx=12.5-4
postfix
rsyslog
nscd
libnss-sss
Expand Down
1 change: 1 addition & 0 deletions distro/keep-deb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rstatd
bind9
apache2
heirloom-mailx
postfix
rsyslog
nscd
libnss-sss
Expand Down
29 changes: 28 additions & 1 deletion tests/ltp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ specify_tmpdir()
return 0
}

make_configfile()
{
[ -f "$CONFIG_FILE" ] || return
cp $CONFIG_FILE $CONFIG_FILE.ltpback
grep -q "default_transport = error" $CONFIG_FILE || {
echo "default_transport = error" >> $CONFIG_FILE
/etc/init.d/postfix reload || return
sleep 2
systemctl restart postfix || return
sleep 3
}

return 0
}

recover_configfile()
{
[ -f "$CONFIG_FILE" ] || return
cp $CONFIG_FILE.ltpback $CONFIG_FILE
}

workaround_env

case "$test" in
Expand Down Expand Up @@ -93,7 +114,9 @@ commands)
done
systemctl restart nscd || exit
}
;;
CONFIG_FILE="/etc/postfix/main.cf"
make_configfile || exit
;;
dio)
[ -z "$mount_points" ] && exit
export TMPDIR="${mount_points%% *}"
Expand Down Expand Up @@ -151,6 +174,10 @@ log_cmd ./runltp -f $test $big_dev_opt $tmpdir_opt || exit

exit_value=$?

[ "$test" == "commands" ] && {
recover_configfile || exit
}

upload_files -t results $BENCHMARK_ROOT/ltp/results/* \
$BENCHMARK_ROOT/ltp/output

Expand Down

0 comments on commit eb01e9d

Please sign in to comment.