summaryrefslogtreecommitdiff
path: root/common/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'common/scripts')
-rwxr-xr-xcommon/scripts/is-cpu-isolated.sh30
-rwxr-xr-xcommon/scripts/kvm/test-kvm.sh8
-rwxr-xr-xcommon/scripts/ltp-realtime2LAVA.py197
3 files changed, 227 insertions, 8 deletions
diff --git a/common/scripts/is-cpu-isolated.sh b/common/scripts/is-cpu-isolated.sh
index 0ff03cf..91a2b3c 100755
--- a/common/scripts/is-cpu-isolated.sh
+++ b/common/scripts/is-cpu-isolated.sh
@@ -3,6 +3,7 @@
# Variable decided outcome of test, this is the minimum isolation we need.
MIN_ISOLATION=10
RESULT="PASS"
+STRESS_DURATION=500
if [ $2 ]; then
MIN_ISOLATION=$2
@@ -49,6 +50,13 @@ get_isolation_duration() {
while [ $new_count -eq $old_count ]
do
new_count=$(get_tick_count)
+ ps h -C stress -o pid > /dev/null
+ if [ $? != 0 ]; then
+ echo "Tick didn't got updated for stress duration:" $STRESS_DURATION
+ echo "Probably in infinite mode, quiting test"
+ echo "test_case_id:Min-isolation "$MIN_ISOLATION" secs result:"$RESULT" measurement:"$STRESS_DURATION" units:secs"
+ exit
+ fi
done
isdebug echo "count locked: " $new_count
@@ -186,10 +194,24 @@ isolate_cpu1() {
# But disallow load balancing within the NOHZ domain
echo 0 > /dev/cpuset/rt/sched_load_balance
- # Start a single threaded task on CPU1 or RT group
- echo $$ > /dev/cpuset/rt/tasks
- stress -q --cpu 1 --timeout 2000 &
- echo $$ > /dev/cpuset/gp/tasks
+ stress -q --cpu 1 --timeout $STRESS_DURATION &
+
+ # Restart CPU1 to migrate all tasks to CPU0
+ echo 0 > /sys/devices/system/cpu/cpu1/online
+ echo 1 > /sys/devices/system/cpu/cpu1/online
+
+ # Setup the NOHZ domain again: CPU1
+ echo 0 > /dev/cpuset/rt/mems
+ echo 1 > /dev/cpuset/rt/cpus
+
+ # Try to move all processes in top set to the GP set.
+ for pid in `ps h -C stress -o pid`; do
+ echo $pid > /dev/cpuset/rt/tasks 2>/dev/null
+ if [ $? != 0 ]; then
+ isdebug echo -n "RT: Cannot move PID $pid: "
+ isdebug echo "$(cat /proc/$pid/status | grep ^Name | cut -f2)"
+ fi
+ done
}
clear_cpusets() {
diff --git a/common/scripts/kvm/test-kvm.sh b/common/scripts/kvm/test-kvm.sh
index 2df1c7d..0154482 100755
--- a/common/scripts/kvm/test-kvm.sh
+++ b/common/scripts/kvm/test-kvm.sh
@@ -14,8 +14,8 @@ fi
dmesg|grep 'Hyp mode initialized successfully' && echo "$KVM_INIT pass" || echo "$KVM_INIT fail"
if hash curl 2>/dev/null; then
- EXTRACT_BUILD_NUMBER="curl -s"
- DOWNLOAD_FILE="curl -SO"
+ EXTRACT_BUILD_NUMBER="curl -sk"
+ DOWNLOAD_FILE="curl -SOk"
else
EXTRACT_BUILD_NUMBER="wget -q --no-check-certificate -O -"
DOWNLOAD_FILE="wget --progress=dot -e dotbytes=2M --no-check-certificate"
@@ -49,7 +49,7 @@ cat >> /mnt/usr/bin/test-guest.sh <<EOF
#!/bin/sh
exec > /root/guest.log 2>&1
echo "$KVM_BOOT pass"
- ping -W 4 -c 10 192.168.1.10 && echo "$KVM_GUEST_NET pass" || echo "$KVM_GUEST_NET fail"
+ ping -W 4 -c 10 10.0.0.1 && echo "$KVM_GUEST_NET pass" || echo "$KVM_GUEST_NET fail"
sh $TEST_SCRIPT
EOF
chmod a+x /mnt/usr/bin/test-guest.sh
@@ -67,7 +67,7 @@ brctl addif br0 eth0
brctl addif br0 tap0
udhcpc -t 10 -i br0
-ping -W 4 -c 10 192.168.1.10 && echo "$KVM_HOST_NET pass" || echo "$KVM_HOST_NET fail"
+ping -W 4 -c 10 10.0.0.1 && echo "$KVM_HOST_NET pass" || echo "$KVM_HOST_NET fail"
qemu-system-arm -smp 2 -m 1024 -cpu cortex-a15 -M vexpress-a15 \
-kernel ./zImage -dtb ./vexpress-v2p-ca15-tc1.dtb \
diff --git a/common/scripts/ltp-realtime2LAVA.py b/common/scripts/ltp-realtime2LAVA.py
new file mode 100755
index 0000000..f5f41fa
--- /dev/null
+++ b/common/scripts/ltp-realtime2LAVA.py
@@ -0,0 +1,197 @@
+#!/usr/bin/python
+import re
+import sys
+import fileinput
+
+#extract a standard results block from the stream
+def standard_results ():
+ minimum = re.compile("^Min:\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
+ maximum = re.compile("^Max:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ average = re.compile("^Avg:\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
+ standarddev = re.compile("^StdDev:\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)")
+ finished=0
+ for line in sys.stdin:
+ for parser in [maximum,minimum,average,standarddev]:
+ result = parser.search(line)
+ if result is not None:
+ if parser is minimum:
+ test_min = result.group('min')
+ units = result.group('units')
+ print "test_case_id:%s%s min measurement:%s units:%s result:skip" % (test_name, test_args, test_min, units)
+ finished += 1
+ break
+ if parser is maximum:
+ test_max = result.group('max')
+ units = result.group('units')
+ finished += 1
+ print "test_case_id:%s%s max measurement:%s units:%s result:skip" % (test_name, test_args, test_max, units)
+ break
+ if parser is average:
+ test_avg = result.group('average')
+ units = result.group('units')
+ print "test_case_id:%s%s avg measurement:%s units:%s result:skip" % (test_name, test_args, test_avg, units)
+ finished += 1
+ break
+ if parser is standarddev:
+ test_stddev = result.group('stddev')
+ units = result.group('units')
+ print "test_case_id:%s%s stddev measurement:%s units:%s result:skip" % (test_name, test_args, test_stddev, units)
+ finished += 1
+ break
+ else:
+ continue
+ if finished ==4:
+ return
+
+ print "ERROR: Parser failed and ran to EOF"
+ sys.exit(-1)
+
+def result_results ():
+ results = re.compile("Result:\s+(?P<result>\w+)")
+ finished=0
+ for line in sys.stdin:
+ for parser in [results]:
+ result = parser.search(line)
+ if result is not None:
+ if parser is results:
+ test_result = result.group('result')
+ print "test_case_id:%s%s_test measurement:0 units:none result:%s" % (test_name, test_args, test_result)
+ finished += 1
+ break
+ else:
+ continue
+ if finished ==1:
+ return
+
+ print "ERROR: Parser failed and ran to EOF"
+ sys.exit(-1)
+
+
+def sched_jitter_results ():
+ maximum = re.compile("^max jitter:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ finished=0
+ for line in sys.stdin:
+ for parser in [maximum]:
+ result = parser.search(line)
+ if result is not None:
+ if parser is maximum:
+ test_max = result.group('max')
+ units = result.group('units')
+ print "test_case_id:%s%s max jitter measurement:%s units:%s result:skip" % (test_name, test_args, test_max, units)
+ finished += 1
+ break
+ else:
+ continue
+ if finished ==1:
+ #print "min:%s max:%s avg:%s stddev:%s" % (test_min, test_max, test_avg, test_stddev)
+ return
+
+ print "ERROR: Parser failed and ran to EOF"
+ sys.exit(-1)
+
+def pi_perf_results ():
+ minimum = re.compile("^Min delay =\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
+ maximum = re.compile("^Max delay =\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ average = re.compile("^Average delay =\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
+ standarddev = re.compile("^Standard Deviation =\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)")
+ finished=0
+ for line in sys.stdin:
+ for parser in [maximum,minimum,average,standarddev]:
+ result = parser.search(line)
+ if result is not None:
+ if parser is minimum:
+ test_min = result.group('min')
+ units = result.group('units')
+ print "test_case_id:%s%s min measurement:%s units:%s result:skip" % (test_name, test_args, test_min, units)
+ finished += 1
+ break
+ if parser is maximum:
+ test_max = result.group('max')
+ units = result.group('units')
+ print "test_case_id:%s%s max measurement:%s units:%s result:skip" % (test_name, test_args, test_max, units)
+ finished += 1
+ break
+ if parser is average:
+ test_avg = result.group('average')
+ units = result.group('units')
+ print "test_case_id:%s%s avg measurement:%s units:%s result:skip" % (test_name, test_args, test_avg, units)
+ finished += 1
+ break
+ if parser is standarddev:
+ test_stddev = result.group('stddev')
+ units = result.group('units')
+ print "test_case_id:%s%s stddev measurement:%s units:%s result:skip" % (test_name, test_args, test_stddev, units)
+ finished += 1
+ break
+ else:
+ continue
+ if finished ==4:
+ return
+
+ print "ERROR: Parser failed and ran to EOF"
+ sys.exit(-1)
+
+def do_nothing ():
+ return
+
+#names of the test parsed out fo the input stream, converted to functioncalls
+def async_handler():
+ standard_results()
+ result_results()
+def tc_2():
+ result_results()
+def gtod_latency():
+ standard_results()
+def periodic_cpu_load_single():
+ standard_results()
+def sched_latency():
+ standard_results()
+def sched_jitter():
+ sched_jitter_results()
+def sched_football():
+ result_results()
+def rt_migrate():
+ result_results()
+def pthread_kill_latency():
+ standard_results()
+ result_results()
+def prio_wake():
+ result_results()
+def pi_perf():
+ pi_perf_results()
+def prio_preempt():
+ result_results()
+def matrix_mult():
+ result_results()
+def periodic_cpu_load():
+ result_results()
+def async_handler_jk():
+ result_results()
+
+#Parse the input stream and tuen test names into function calls to parse their
+#details
+
+test_start = re.compile("--- Running testcase (?P<name>[a-zA-Z0-9_-]+)\s+(?P<args>[a-zA-Z0-9_.\- ]*?)\s*---")
+test_finish = re.compile("The .* test appears to have completed.")
+
+for line in sys.stdin:
+ for parser in [test_start,test_finish]:
+ result = parser.search(line)
+ if result is not None:
+ if parser is test_start:
+ test_name = result.group('name')
+ func_name = result.group('name')
+ func_name = func_name.replace("-","_")
+ test_args = result.group('args')
+ test_args = test_args.replace(" ","-")
+ print
+ print " test_start= " + test_name + test_args
+ globals()[func_name]()
+ break
+
+ if parser is test_finish:
+ print " test_finished= " + test_name + test_args
+ break
+ else:
+ continue
+