output: send self-test report email, the email body like this
kvcount.job_state=abnormal: 1 kvcount.job_state=failed: 6 kvcount.job_state=finished: 4 raw.id.[job_state=abnormal]: ["z9.91"] raw.id.[job_state=failed]: ["z9.85","z9.87","z9.88","z9.89","z9.86","z9.84"] raw.id.[job_state=finished]: ["z9.90","z9.92","z9.93","z9.94"]
Signed-off-by: Liu Yinsi liuyinsi@163.com --- tests/self-test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/self-test
diff --git a/tests/self-test b/tests/self-test new file mode 100644 index 000000000..316293714 --- /dev/null +++ b/tests/self-test @@ -0,0 +1,35 @@ +#!/bin/bash + +submit_args=( + "testbox=dc-8g cci-depends.benchmark=sshd cci-depends.yaml" + "testbox=dc-8g borrow-1h.yaml runtime=1m" + "testbox=vm-2p8g borrow-1h.yaml runtime=1m" + ) + +submit_one() +{ + submit_result=$(submit -m $args group_id=selftest) +} + +submit_all() +{ + for args in "${submit_args[@]}" + do + submit_one $args + done +} + +mail() +{ + job_state=$(es-jobs group_id=selftest | grep job_state) + email_content="To: $my_email +Subject: [NOTIFY Compass-CI] Self-test report + +$job_state +" + +curl -XPOST "${SEND_MAIL_HOST:-$LKP_SERVER}:${SEND_MAIL_PORT:-10001}/send_mail_text" -d "$email_content" +} + +submit_all +mail
On Wed, Apr 21, 2021 at 06:50:42PM +0800, Liu Yinsi wrote:
output: send self-test report email, the email body like this
kvcount.job_state=abnormal: 1 kvcount.job_state=failed: 6 kvcount.job_state=finished: 4 raw.id.[job_state=abnormal]: ["z9.91"] raw.id.[job_state=failed]: ["z9.85","z9.87","z9.88","z9.89","z9.86","z9.84"] raw.id.[job_state=finished]: ["z9.90","z9.92","z9.93","z9.94"]
Signed-off-by: Liu Yinsi liuyinsi@163.com
tests/self-test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/self-test
diff --git a/tests/self-test b/tests/self-test new file mode 100644 index 000000000..316293714 --- /dev/null +++ b/tests/self-test @@ -0,0 +1,35 @@ +#!/bin/bash
+submit_args=(
"testbox=dc-8g cci-depends.benchmark=sshd cci-depends.yaml"
"testbox=dc-8g borrow-1h.yaml runtime=1m"
"testbox=vm-2p8g borrow-1h.yaml runtime=1m"
)
+submit_one() +{
- submit_result=$(submit -m $args group_id=selftest)
$args => $@. Here $args looks coupled, you send parameter $args but not use it and access $args from caller directly.
-------- Thanks, Xijian
+submit_args=(
"testbox=dc-8g cci-depends.benchmark=sshd cci-depends.yaml"
"testbox=dc-8g borrow-1h.yaml runtime=1m"
"testbox=vm-2p8g borrow-1h.yaml runtime=1m"
)
+submit_one() +{
- submit_result=$(submit -m $args group_id=selftest)
$args => $@. Here $args looks coupled, you send parameter $args but not use it and access $args from caller directly.
submit_all() { ... for args in "${submit_args[@]}" ... }
$args is used in this function submit_all()
Thanks, Yinsi
Thanks, Xijian
@@ -0,0 +1,35 @@ +#!/bin/bash
+submit_args=(
"testbox=dc-8g cci-depends.benchmark=sshd cci-depends.yaml"
"testbox=dc-8g borrow-1h.yaml runtime=1m"
"testbox=vm-2p8g borrow-1h.yaml runtime=1m"
)
+submit_one() +{
- submit_result=$(submit -m $args group_id=selftest)
better not use variable defined in another function, hard to find when read it, you can add:
args=$1
before you use it
Thanks, Luan Shengde
+}
+submit_all() +{
- for args in "${submit_args[@]}"
- do
submit_one $args
- done
+}
+mail() +{
job_state=$(es-jobs group_id=selftest | grep job_state)
email_content="To: $my_email
+Subject: [NOTIFY Compass-CI] Self-test report
+$job_state +"
+curl -XPOST "${SEND_MAIL_HOST:-$LKP_SERVER}:${SEND_MAIL_PORT:-10001}/send_mail_text" -d "$email_content" +}
+submit_all
2.23.0
+submit_args=(
"testbox=dc-8g cci-depends.benchmark=sshd cci-depends.yaml"
"testbox=dc-8g borrow-1h.yaml runtime=1m"
"testbox=vm-2p8g borrow-1h.yaml runtime=1m"
)
+submit_one() +{
- submit_result=$(submit -m $args group_id=selftest)
better not use variable defined in another function, hard to find when read it, you can add:
args=$1
before you use it
good
Thanks, Yinsi
Thanks, Luan Shengde
+}
+submit_all() +{
- for args in "${submit_args[@]}"
- do
submit_one $args
- done
+}
+mail() +{
job_state=$(es-jobs group_id=selftest | grep job_state)
email_content="To: $my_email
+Subject: [NOTIFY Compass-CI] Self-test report
+$job_state +"
+curl -XPOST "${SEND_MAIL_HOST:-$LKP_SERVER}:${SEND_MAIL_PORT:-10001}/send_mail_text" -d "$email_content" +}
+submit_all
2.23.0