1. submit job in z9 tbox, remove my-qemu.sh.
2. submit 'key=value' instead of -s.
3. remove job yaml redundant field.
Signed-off-by: Liu Yinsi <liuyinsi(a)163.com>
---
.../maintain/walk-os-test/iperf-walk-os.yaml | 4 -
.../maintain/walk-os-test/walk-os-iperf-test | 119 +++++++++---------
2 files changed, 58 insertions(+), 65 deletions(-)
diff --git a/user-client/maintain/walk-os-test/iperf-walk-os.yaml b/user-client/maintain/walk-os-test/iperf-walk-os.yaml
index 647220c..237d006 100644
--- a/user-client/maintain/walk-os-test/iperf-walk-os.yaml
+++ b/user-client/maintain/walk-os-test/iperf-walk-os.yaml
@@ -7,9 +7,5 @@ if role server:
if role client:
iperf:
protocol: tcp
-testbox: vm-2p8g--USER
-os: OS
-os_arch: OS_ARCH
-os_version: OS_VER
node_roles: server client
LKP_DEBUG_PREFIX: bash -x
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test
index 21e1428..9910723 100755
--- a/user-client/maintain/walk-os-test/walk-os-iperf-test
+++ b/user-client/maintain/walk-os-test/walk-os-iperf-test
@@ -1,62 +1,59 @@
-#!/bin/bash -e
+#!/usr/bin/env ruby
# SPDX-License-Identifier: MulanPSL-2.0+
-
-# os test rounds
-test_times=1
-
-test_logs=walk-test.report
-test_yaml=iperf-walk-os.yaml
-test_os=(
- 'openeuler aarch64 20'
- 'openeuler aarch64 20.03'
- 'centos aarch64 7.6'
- 'centos aarch64 7.8'
- 'centos aarch64 8.1.1911'
- 'debian aarch64 sid'
-)
-
-trap 'echo User Cancelled! && exit' SIGINT
-
-sec2date() {
- date -d@$1 +"%Y%m%d_%H:%M:%S"
-}
-
-logging() {
- if [ 'new' == "$1" ] ; then
- printf "%-5s %-8s %-25s %-20s %-20s %-8s %-10s\n" ${@:2} > $test_logs
- else
- printf "%-5s %-8s %-25s %-20s %-20s %-8s %-10s\n" $@ >> $test_logs
- fi
-}
-
-create_test_yaml() {
- local hwarch os os_arch os_ver cur_os
- hwarch=$(arch)
- cur_os="$@"
- os=$(echo $cur_os |cut -d' ' -f1)
- os_arch=$(echo $cur_os |cut -d' ' -f2)
- os_ver=$(echo $cur_os |cut -d' ' -f3)
- sed "s/USER/$USER/" $test_yaml > test.yaml
- sed -i "s/OS_ARCH/$os_arch/" test.yaml
- sed -i "s/OS_VER/$os_ver/" test.yaml
- sed -i "s/OS/$os/" test.yaml
- echo "$hwarch $os/$os_arch/$os_ver"
-}
-
-job_test() {
- local job_id bef aft
- job_id=$(submit test.yaml |awk '{print $NF}')
- bef=$(date +%s)
- ./my-qemu.sh
- aft=$(date +%s)
- logging "$1" "$2" "$3" "$(sec2date $bef)" "$(sec2date $aft)" "$((aft - bef))" "$job_id"
-}
-
-logging new "Index" "hwArch" "OS" "Begin" "End" "Cost/sec" "Job_ID"
-for round in $(seq $test_times)
-do
- for idx in "${!test_os[@]}"
- do
- job_test $round $(create_test_yaml "${test_os[$idx]}")
- done
-done
+# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+# frozen_string_literal: true
+
+# rootfs test via job, including cifs, initramfs files.
+# boot way including PXE and kvm.
+# input: job yaml, os, os_version, os_arch, os_mount, testbox
+# output: a test report, including job ID, os, runtime, job state and url to check logs,
+# and send mail.
+#
+# Eg: test report format:
+#
+# Job_ID OS Begin
+# crystal.104748 openeuler/aarch64/20.03/initramfs 2020-10-19/18:42:41
+#
+# End Cost/sec Job_State Result_Url
+# 2020-10-19/18:44:48 127 finished #{SRV_HTTP_HOST}:#{SRV_HTTP_PORT}/#{result_root}
+
+TEST_OS = [
+ 'openeuler aarch64 20.03',
+ 'centos aarch64 7.6.1810',
+ 'centos aarch64 7.8.2003',
+ 'centos aarch64 8.1.1911',
+ 'debian aarch64 sid'
+].freeze
+
+MOUNT_TYPE = %w[cifs initramfs].freeze
+TESTBOX = %w[vm-2p8g vm-pxe-2p8g].freeze
+TEST_REPORT = 'walk-test.report'
+TEST_YAML = 'iperf-walk-os.yaml'
+
+def submit_job(os_array, testbox)
+ os = os_array[0]
+ os_arch = os_array[1]
+ os_ver = os_array[2]
+ os_mount = os_array[3]
+ message = %(submit 'testbox=#{testbox}' 'os=#{os}' 'os_arch=#{os_arch}' 'os_version=#{os_ver}' 'os_mount=#{os_mount}' #{TEST_YAML})
+ return if message.include? 'error'
+
+ # if job not running on tbox, add this the task will be consumed.
+ # Process.fork do
+ # %x(./my-qemu.sh >/dev/null 2>&1)
+ # end
+end
+
+def get_os_array(os_mount, testbox)
+ TEST_OS.each do |item|
+ os_array = item.split.push(os_mount)
+
+ submit_job(os_array, testbox)
+ end
+end
+
+def get_testbox(os_mount)
+ TESTBOX.each { |testbox| get_os_array(os_mount, testbox) }
+end
+
+MOUNT_TYPE.each { |os_mount| get_testbox(os_mount) }
--
2.23.0