forked from woqidaideshi/openruyi-autotest
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb50ef29ed | ||
|
|
1942d2036a |
@@ -152,6 +152,29 @@ _stressNgTaintCheck() {
|
||||
|
||||
|
||||
|
||||
# Extract bogo ops/s (real time) for a stressor from a stress-ng metrics log
|
||||
_stressNgBogoOps() {
|
||||
local log="$1"
|
||||
local stressor="${2:-}"
|
||||
|
||||
awk -v stressor="$stressor" '
|
||||
/^stress-ng:[[:space:]]*metrc:/ {
|
||||
row = $0
|
||||
sub(/^stress-ng:[[:space:]]*metrc:[[:space:]]*\[[0-9]+\][[:space:]]*/, "", row)
|
||||
n = split(row, f, /[[:space:]]+/)
|
||||
if (n >= 7 && f[2] ~ /^[0-9]+$/ && f[6] ~ /^[0-9]+([.][0-9]+)?$/) {
|
||||
if (stressor != "" && f[1] == stressor && !found) {
|
||||
print f[6]
|
||||
found = 1
|
||||
}
|
||||
if (first == "") first = f[6]
|
||||
}
|
||||
}
|
||||
END { if (!found && first != "") print first }
|
||||
' "$log"
|
||||
}
|
||||
|
||||
|
||||
# Validate stress-ng result from log file
|
||||
|
||||
# Checks: successful run completed, failed=0, bogo ops > 0
|
||||
@@ -202,13 +225,7 @@ _stressNgValidate() {
|
||||
|
||||
local bogo
|
||||
|
||||
bogo=$(grep -oP "$stressor\s+.*?\s+(\d+\.?\d*)\s+\(\s*real\s+time\s*\)" "$log" | grep -oP '\d+\.?\d*(?=\s*\(\s*real)' | head -1)
|
||||
|
||||
if [ -z "$bogo" ]; then
|
||||
|
||||
bogo=$(grep "$stressor" "$log" | grep -oP '\d+\.?\d+(?=\s*\(\s*real)' | head -1)
|
||||
|
||||
fi
|
||||
bogo=$(_stressNgBogoOps "$log" "$stressor")
|
||||
|
||||
if [ -n "$bogo" ] && [ "$(echo "$bogo > 0" | bc 2>/dev/null || echo 1)" -eq 1 ]; then
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "combined stress: CPU+MEM+PROC"
|
||||
|
||||
local log="$TmpDir/combo1.log"
|
||||
log="$TmpDir/combo1.log"
|
||||
|
||||
# simultaneously CPU(2thread) + VM(128M) + FORK(2thread)
|
||||
|
||||
@@ -58,11 +58,11 @@ rlJournalStart
|
||||
|
||||
# useDocumentation recommends 13 workload (time)
|
||||
|
||||
local log="$TmpDir/combo2.log"
|
||||
log="$TmpDir/combo2.log"
|
||||
|
||||
local workloads="cpu context fork get mmap vm-splice wait zombie"
|
||||
workloads="cpu context fork get mmap vm-splice wait zombie"
|
||||
|
||||
local args=""
|
||||
args=""
|
||||
|
||||
for w in $workloads; do args="$args --$w 1"; done
|
||||
|
||||
@@ -76,7 +76,6 @@ rlJournalStart
|
||||
|
||||
# count passed count
|
||||
|
||||
local passed
|
||||
|
||||
passed=$(grep -oP 'passed:\s*\K\d+' "$log" | awk '{s+=$1} END {print s}')
|
||||
|
||||
@@ -92,7 +91,6 @@ rlJournalStart
|
||||
|
||||
# confirmnofailed
|
||||
|
||||
local failed
|
||||
|
||||
failed=$(grep -oP 'failed:\s*\K\d+' "$log" | awk '{s+=$1} END {print s}')
|
||||
|
||||
@@ -112,7 +110,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "metrics analysis"
|
||||
|
||||
local log="$TmpDir/combo1.log"
|
||||
log="$TmpDir/combo1.log"
|
||||
|
||||
# analysis usr/sys time
|
||||
|
||||
@@ -122,7 +120,6 @@ rlJournalStart
|
||||
|
||||
# usr time shouldtotaltime
|
||||
|
||||
local total_usr total_sys
|
||||
|
||||
total_usr=$(grep -oP 'usr time\s+\K[\d.]+' "$log" | head -1)
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "CPU stress rampthread"
|
||||
|
||||
local bogo_vals=()
|
||||
bogo_vals=()
|
||||
|
||||
for t in 1 2 4; do
|
||||
|
||||
local log="$TmpDir/cpu_${t}.log"
|
||||
log="$TmpDir/cpu_${t}.log"
|
||||
|
||||
rlRun "stress-ng --cpu $t --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "CPU $t thread"
|
||||
|
||||
@@ -42,9 +42,8 @@ rlJournalStart
|
||||
|
||||
# extract bogo ops/s
|
||||
|
||||
local bogo
|
||||
|
||||
bogo=$(grep "cpu" "$log" | grep -oP '\d+\.?\d*(?=\s*\(\s*real)' | head -1)
|
||||
bogo=$(_stressNgBogoOps "$log" "cpu")
|
||||
|
||||
bogo_vals+=("$bogo")
|
||||
|
||||
@@ -83,4 +82,3 @@ rlJournalStart
|
||||
rlJournalPrintText
|
||||
|
||||
rlJournalEnd
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "HDD stress (IO)"
|
||||
|
||||
local log="$TmpDir/hdd.log"
|
||||
log="$TmpDir/hdd.log"
|
||||
|
||||
rlRun "stress-ng --hdd 2 --hdd-bytes 32M --temp-path $TmpDir/io_test --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--hdd 2"
|
||||
|
||||
@@ -42,7 +42,7 @@ rlJournalStart
|
||||
|
||||
# aio needs libaio supports, possiblesystemnot supported
|
||||
|
||||
local log="$TmpDir/aio.log"
|
||||
log="$TmpDir/aio.log"
|
||||
|
||||
stress-ng --aio 2 --timeout 20s --metrics-brief --log-file "$log" 2>&1 | tail -5
|
||||
|
||||
@@ -64,7 +64,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "GETDENT stress (directory)"
|
||||
|
||||
local log="$TmpDir/getdent.log"
|
||||
log="$TmpDir/getdent.log"
|
||||
|
||||
rlRun "stress-ng --getdent 2 --timeout 20s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--getdent 2"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "MATRIX stress ()"
|
||||
|
||||
local log="$TmpDir/matrix.log"
|
||||
log="$TmpDir/matrix.log"
|
||||
|
||||
rlRun "stress-ng --matrix 2 --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--matrix 2"
|
||||
|
||||
@@ -36,7 +36,6 @@ rlJournalStart
|
||||
|
||||
if grep -q "matrix" "$log"; then
|
||||
|
||||
local usr sys
|
||||
|
||||
usr=$(grep "matrix" "$log" | awk '{for(i=1;i<=NF;i++){if($i~/^[0-9.]+$/&&$(i-1)~/secs/)print $i}}' | head -1)
|
||||
|
||||
@@ -50,7 +49,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "AF-ALG stress (kernelcrypto)"
|
||||
|
||||
local log="$TmpDir/af_alg.log"
|
||||
log="$TmpDir/af_alg.log"
|
||||
|
||||
stress-ng --af-alg 2 --timeout 20s --metrics-brief --log-file "$log" 2>&1 | tail -5
|
||||
|
||||
@@ -72,7 +71,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "VM-SPLICE stress (pipe splice)"
|
||||
|
||||
local log="$TmpDir/vm_splice.log"
|
||||
log="$TmpDir/vm_splice.log"
|
||||
|
||||
stress-ng --vm-splice 2 --timeout 20s --metrics-brief --log-file "$log" 2>&1 | tail -5
|
||||
|
||||
@@ -96,7 +95,7 @@ rlJournalStart
|
||||
|
||||
#: itemswillExceptionsignalhandlepath, possiblehaspreerror
|
||||
|
||||
local log="$TmpDir/bad_altstack.log"
|
||||
log="$TmpDir/bad_altstack.log"
|
||||
|
||||
rlRun "stress-ng --bad-altstack 1 --timeout 10s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--bad-altstack 1"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "VM stress (memory)"
|
||||
|
||||
local log="$TmpDir/vm.log"
|
||||
log="$TmpDir/vm.log"
|
||||
|
||||
rlRun "stress-ng --vm 2 --vm-bytes 128M --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--vm 2x128M"
|
||||
|
||||
@@ -38,7 +38,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "MMAP stress"
|
||||
|
||||
local log="$TmpDir/mmap.log"
|
||||
log="$TmpDir/mmap.log"
|
||||
|
||||
rlRun "stress-ng --mmap 2 --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--mmap 2"
|
||||
|
||||
@@ -50,7 +50,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "MADVISE stress"
|
||||
|
||||
local log="$TmpDir/madvise.log"
|
||||
log="$TmpDir/madvise.log"
|
||||
|
||||
rlRun "stress-ng --madvise 2 --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--madvise 2"
|
||||
|
||||
@@ -62,7 +62,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "Memory combined stress"
|
||||
|
||||
local log="$TmpDir/mem_combo.log"
|
||||
log="$TmpDir/mem_combo.log"
|
||||
|
||||
# simultaneously VM + MMAP
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "FORK stress"
|
||||
|
||||
local log="$TmpDir/fork.log"
|
||||
log="$TmpDir/fork.log"
|
||||
|
||||
rlRun "stress-ng --fork 4 --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--fork 4"
|
||||
|
||||
@@ -42,7 +42,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "CONTEXT switch stress"
|
||||
|
||||
local log="$TmpDir/context.log"
|
||||
log="$TmpDir/context.log"
|
||||
|
||||
rlRun "stress-ng --context 4 --timeout 30s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--context 4"
|
||||
|
||||
@@ -56,7 +56,7 @@ rlJournalStart
|
||||
|
||||
# zombie willproducedprocesspost, possiblehaspreerror
|
||||
|
||||
local log="$TmpDir/zombie.log"
|
||||
log="$TmpDir/zombie.log"
|
||||
|
||||
rlRun "stress-ng --zombie 2 --timeout 15s --metrics-brief --log-file $log 2>&1 | tail -5" 0 "--zombie 2"
|
||||
|
||||
@@ -68,7 +68,7 @@ rlJournalStart
|
||||
|
||||
rlPhaseStartTest "WAIT stress (get/gettid)"
|
||||
|
||||
local log="$TmpDir/wait.log"
|
||||
log="$TmpDir/wait.log"
|
||||
|
||||
# --get: callwith getpid/getppid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user