summaryrefslogtreecommitdiff
path: root/ubuntu
diff options
context:
space:
mode:
authorBotao Sun <botao.sun@linaro.org>2014-12-10 15:27:48 +1100
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-12-17 14:32:26 +0000
commit6293afe3dbbe08c406f329283b7bdea77db74b50 (patch)
tree0194253430220d53cef9090b849c4021927d08e1 /ubuntu
parent76a1e67419b20ba816694f242440afd9d9919478 (diff)
Add RCU Torture Test to Linux-Linaro Kernel.
This test code is to add RCU Torture test to Linux-linaro Kernel based images. https://www.kernel.org/doc/Documentation/RCU/torture.txt It has been validated in LAVA on both LSK 3.10 and 3.14 Signed-off by: Botao Sun <botao.sun@linaro.org> Change-Id: I15ba99aac346abb13b94396059aa0ef776ac007d
Diffstat (limited to 'ubuntu')
-rw-r--r--ubuntu/rcutorture.yaml29
-rwxr-xr-xubuntu/scripts/rcutorture.py100
2 files changed, 129 insertions, 0 deletions
diff --git a/ubuntu/rcutorture.yaml b/ubuntu/rcutorture.yaml
new file mode 100644
index 0000000..83124bf
--- /dev/null
+++ b/ubuntu/rcutorture.yaml
@@ -0,0 +1,29 @@
+metadata:
+ name: rcutorture
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Run RCU Torture test for Linux Kernel."
+ maintainer:
+ - botao.sun@linaro.org
+ os:
+ - ubuntu
+ - openembedded
+ devices:
+ - d01
+ - panda
+ - panda-es
+ - arndale
+ - vexpress-a9
+ - vexpress-tc2
+ - ifc6410
+ - rtsm_fvp_base-aemv8a
+ - juno
+ - beaglebone-black
+ environment:
+ - lava-test-shell
+
+params:
+ TORTURETIME: 600
+
+run:
+ steps:
+ - "cd ubuntu/scripts; ./rcutorture.py $TORTURETIME"
diff --git a/ubuntu/scripts/rcutorture.py b/ubuntu/scripts/rcutorture.py
new file mode 100755
index 0000000..9e16c3b
--- /dev/null
+++ b/ubuntu/scripts/rcutorture.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+# RCU Torture test for Linux Kernel.
+#
+# Copyright (C) 2010 - 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Botao Sun <botao.sun@linaro.org>
+
+import os
+import sys
+import time
+import shlex
+import subprocess
+
+# Result collection for LAVA
+debug_switcher = False
+def collect_result(testcase, result):
+ if debug_switcher == False:
+ subprocess.call(['lava-test-case', testcase, '--result', result])
+ else:
+ print ['lava-test-case', testcase, '--result', result]
+
+# Switch to home path of current user
+home_path = os.path.expanduser("~")
+os.chdir(home_path)
+print os.getcwd()
+
+# RCU Torture start check
+rcutorture_start = 'modprobe rcutorture'
+rcutorture_time = sys.argv[1]
+start_return = subprocess.call(shlex.split(rcutorture_start))
+if start_return != 0:
+ collect_result('rcutorture-start', 'fail')
+ collect_result('rcutorture-module-check', 'skip')
+ collect_result('rcutorture-end', 'skip')
+ sys.exit(1)
+else:
+ print 'RCU Torture test started. Test time is ' + str(rcutorture_time) + ' Seconds.'
+ collect_result('rcutorture-start', 'pass')
+ time.sleep(int(rcutorture_time))
+
+# RCU Torture module check
+lsmod_output = subprocess.check_output(['lsmod'])
+print lsmod_output
+lsmod_list = lsmod_output.split()
+torture_list = filter(lambda x:x.find('torture')!=-1, lsmod_list)
+if torture_list == []:
+ print 'Cannot find rcutorture module in lsmod, abort!'
+ collect_result('rcutorture-module-check', 'fail')
+ collect_result('rcutorture-end', 'skip')
+ sys.exit(1)
+elif len(torture_list) == 1:
+ rcutorture_end = 'rmmod ' + torture_list[0]
+ collect_result('rcutorture-module-check', 'pass')
+elif len(torture_list) > 1:
+ print 'More than one item with torture in name, please check it manually.'
+ collect_result('rcutorture-module-check', 'fail')
+ collect_result('rcutorture-end', 'skip')
+ sys.exit(1)
+
+# RCU Torture result check
+end_keyword = 'rcu-torture:--- End of test'
+end_return = subprocess.call(shlex.split(rcutorture_end))
+if end_return != 0:
+ print 'RCU Torture terminate command ran failed.'
+ collect_result('rcutorture-end', 'fail')
+ sys.exit(1)
+else:
+ keyword_counter = 0
+ output = subprocess.check_output(['dmesg'])
+ output_list = output.split('\n')
+ for item in output_list:
+ if end_keyword in item:
+ keyword_counter = keyword_counter + 1
+ print 'RCU Torture test has finished.'
+ if 'SUCCESS' in item:
+ collect_result('rcutorture-end', 'pass')
+ sys.exit(0)
+ else:
+ print 'RCU Torture finished with issues.'
+ collect_result('rcutorture-end', 'fail')
+ sys.exit(1)
+
+ if keyword_counter == 0:
+ print 'Cannot find the ending of this RCU Torture test.'
+ collect_result('rcutorture-end', 'fail')