From 9737b165b1301905e35b96514ca2096d595efc5f Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Tue, 30 Jun 2015 00:37:10 +0800 Subject: Ubuntu: Fix rcutorture test on new Kernel - Update test code to simply check if torture module exist in lsmod output. On Kernel V3.18, torture module is used by rcutorture. lsmod output list two torture modules. The current assumption on rcutorture-module-check test is too strong. - On kernel V3.18, because torture is using by rcutorture, 'rmmod torture' doesn't work. The right approach is use 'modprobe -r rcutorture'. 'modprobe -r' is smarter then rmmod. If the modules rcutorture depends on are also unused, it will try to removed them too. Change-Id: I46d9184ebe300ed16fc2c7d65f5d836d24983496 Signed-off-by: Chase Qi --- ubuntu/scripts/rcutorture.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'ubuntu') diff --git a/ubuntu/scripts/rcutorture.py b/ubuntu/scripts/rcutorture.py index 6b7d6ac..6feb601 100755 --- a/ubuntu/scripts/rcutorture.py +++ b/ubuntu/scripts/rcutorture.py @@ -51,7 +51,8 @@ if start_return != 0: collect_result('rcutorture-end', 'skip') sys.exit(1) else: - print 'RCU Torture test started. Test time is ' + str(rcutorture_time) + ' Seconds.' + print('RCU Torture test started. Test time is %s seconds' + % (rcutorture_time)) collect_result('rcutorture-start', 'pass') time.sleep(int(rcutorture_time)) @@ -60,22 +61,17 @@ 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 == []: +if len(torture_list) == 0: 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] +else: 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' +rcutorture_end = 'modprobe -r rcutorture' end_return = subprocess.call(shlex.split(rcutorture_end)) if end_return != 0: print 'RCU Torture terminate command ran failed.' -- cgit v1.2.3