From eb01e9d7c1772525ebda6d2f7e500e328078af7d Mon Sep 17 00:00:00 2001 From: leishaoting Date: Tue, 24 Oct 2017 13:43:11 +0800 Subject: [PATCH] ltp: fix ltp/commands/mail: Mailer daemon can't report failure to root 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 Signed-off-by: Philip Li --- distro/depends/ltp | 1 + distro/keep-deb | 1 + tests/ltp | 29 ++++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/distro/depends/ltp b/distro/depends/ltp index 7fb18eb65..42807dc61 100644 --- a/distro/depends/ltp +++ b/distro/depends/ltp @@ -24,6 +24,7 @@ bind9 dnsutils apache2 heirloom-mailx=12.5-4 +postfix rsyslog nscd libnss-sss diff --git a/distro/keep-deb b/distro/keep-deb index e591f0c63..428d2338f 100644 --- a/distro/keep-deb +++ b/distro/keep-deb @@ -23,6 +23,7 @@ rstatd bind9 apache2 heirloom-mailx +postfix rsyslog nscd libnss-sss diff --git a/tests/ltp b/tests/ltp index 8eb632490..4b62b2bca 100755 --- a/tests/ltp +++ b/tests/ltp @@ -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 @@ -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%% *}" @@ -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