#!/bin/bash global SYSFS := '' proc prerequisite { global msg := '"skip all tests:'" if test $UID != 0 { echo $msg must be run as root > !2 exit 0 } taskset -p 01 $Pid global SYSFS := $[mount -t sysfs | head -1 | awk '{ print $3 }] if test ! -d $SYSFS { echo $msg sysfs is not mounted > !2 exit 0 } if ! ls $SYSFS/devices/system/cpu/cpu* > /dev/null !2 > !1 { echo $msg cpu hotplug is not supported > !2 exit 0 } echo "CPU online/offline summary:" global online_cpus := $[cat $SYSFS/devices/system/cpu/online] global online_max := $(online_cpus##*-) echo -e "\t Cpus in online state: $online_cpus" global offline_cpus := $[cat $SYSFS/devices/system/cpu/offline] if [[ "a$offline_cpus" = "a" ]] { global offline_cpus := '0' } else { global offline_max := $(offline_cpus##*-) } echo -e "\t Cpus in offline state: $offline_cpus" } # # list all hot-pluggable CPUs # proc hotpluggable_cpus { var state = $(1:-.\*) for cpu in [$SYSFS/devices/system/cpu/cpu*] { if test -f $cpu/online && grep -q $state $cpu/online { echo $(cpu##/*/cpu) } } } proc hotplaggable_offline_cpus { hotpluggable_cpus 0 } proc hotpluggable_online_cpus { hotpluggable_cpus 1 } proc cpu_is_online { grep -q 1 $SYSFS/devices/system/cpu/cpu$1/online } proc cpu_is_offline { grep -q 0 $SYSFS/devices/system/cpu/cpu$1/online } proc online_cpu { echo 1 > $SYSFS/devices/system/cpu/cpu$1/online } proc offline_cpu { echo 0 > $SYSFS/devices/system/cpu/cpu$1/online } proc online_cpu_expect_success { var cpu = $1 if ! online_cpu $cpu { echo $FUNCNAME $cpu: unexpected fail > !2 } elif ! cpu_is_online $cpu { echo $FUNCNAME $cpu: unexpected offline > !2 } } proc online_cpu_expect_fail { var cpu = $1 if online_cpu $cpu !2 > /dev/null { echo $FUNCNAME $cpu: unexpected success > !2 } elif ! cpu_is_offline $cpu { echo $FUNCNAME $cpu: unexpected online > !2 } } proc offline_cpu_expect_success { var cpu = $1 if ! offline_cpu $cpu { echo $FUNCNAME $cpu: unexpected fail > !2 } elif ! cpu_is_offline $cpu { echo $FUNCNAME $cpu: unexpected offline > !2 } } proc offline_cpu_expect_fail { var cpu = $1 if offline_cpu $cpu !2 > /dev/null { echo $FUNCNAME $cpu: unexpected success > !2 } elif ! cpu_is_online $cpu { echo $FUNCNAME $cpu: unexpected offline > !2 } } global error := '-12' global allcpus := '0' global priority := '0' global online_cpus := '0' global online_max := '0' global offline_cpus := '0' global offline_max := '0' while getopts e:ahp: opt { matchstr $opt { e { global error := $OPTARG } a { global allcpus := '1' } h { echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]" echo -e "\t default offline one cpu" echo -e "\t run with -a option to offline all cpus" exit } p { global priority := $OPTARG } } } if ! test $error -ge -4095 -a $error -lt 0 { echo "error code must be -4095 <= errno < 0" > !2 exit 1 } prerequisite # # Safe test (default) - offline and online one cpu # if test $allcpus -eq 0 { echo "Limited scope test: one hotplug cpu" echo -e "\t (leaves cpu in the original state):" echo -e "\t online to offline to online: cpu $online_max" offline_cpu_expect_success $online_max online_cpu_expect_success $online_max if [[ $offline_cpus -gt 0 ]] { echo -e "\t offline to online to offline: cpu $offline_max" online_cpu_expect_success $offline_max offline_cpu_expect_success $offline_max } exit 0 } else { echo "Full scope test: all hotplug cpus" echo -e "\t online all offline cpus" echo -e "\t offline all online cpus" echo -e "\t online all offline cpus" } # # Online all hot-pluggable CPUs # for cpu in [$[hotplaggable_offline_cpus]] { online_cpu_expect_success $cpu } # # Offline all hot-pluggable CPUs # for cpu in [$[hotpluggable_online_cpus]] { offline_cpu_expect_success $cpu } # # Online all hot-pluggable CPUs again # for cpu in [$[hotplaggable_offline_cpus]] { online_cpu_expect_success $cpu } # # Test with cpu notifier error injection # global DEBUGFS := $[mount -t debugfs | head -1 | awk '{ print $3 }] global NOTIFIER_ERR_INJECT_DIR := "$DEBUGFS/notifier-error-inject/cpu" proc prerequisite_extra { global msg := '"skip extra tests:'" /sbin/modprobe -q -r cpu-notifier-error-inject /sbin/modprobe -q cpu-notifier-error-inject priority=$priority if test ! -d $DEBUGFS { echo $msg debugfs is not mounted > !2 exit 0 } if test ! -d $NOTIFIER_ERR_INJECT_DIR { echo $msg cpu-notifier-error-inject module is not available > !2 exit 0 } } prerequisite_extra # # Offline all hot-pluggable CPUs # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error for cpu in [$[hotpluggable_online_cpus]] { offline_cpu_expect_success $cpu } # # Test CPU hot-add error handling (offline => online) # echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error for cpu in [$[hotplaggable_offline_cpus]] { online_cpu_expect_fail $cpu } # # Online all hot-pluggable CPUs # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error for cpu in [$[hotplaggable_offline_cpus]] { online_cpu_expect_success $cpu } # # Test CPU hot-remove error handling (online => offline) # echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error for cpu in [$[hotpluggable_online_cpus]] { offline_cpu_expect_fail $cpu } echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error /sbin/modprobe -q -r cpu-notifier-error-inject (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SYSFS) op:Equal rhs:{(SQ )} spids:[4])] spids: [4] ) (FuncDef name: prerequisite body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:msg) op: Equal rhs: {(DQ ("skip all tests:"))} spids: [14] ) ] spids: [14] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$UID")} {(KW_Bang "!") (Lit_Other "=")} {(0)} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$msg")} {(must)} {(be)} {(run)} {(as)} {(root)}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[52])] ) (C {(exit)} {(0)}) ] spids: [-1 35] ) ] spids: [-1 61] ) (C {(taskset)} {(-p)} {(01)} {($ VSub_Dollar "$$")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SYSFS) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(mount)} {(-t)} {(sysfs)}) (C {(head)} {(-1)}) (C {(awk)} {(SQ <"{ print $3 }">)}) ] negated: False ) ] ) left_token: spids: [76 96] ) } spids: [75] ) ] spids: [75] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$SYSFS"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$msg")} {(sysfs)} {(is)} {(not)} {(mounted)}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[130])] ) (C {(exit)} {(0)}) ] spids: [-1 115] ) ] spids: [-1 139] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(ls)} {($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) (Lit_Other "*")} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [153] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [157] ) ] ) ] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$msg")} {(cpu)} {(hotplug)} {(is)} {(not)} {(supported)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[178])] ) (C {(exit)} {(0)}) ] spids: [-1 161] ) ] spids: [-1 187] ) (C {(echo)} {(DQ ("CPU online/offline summary:"))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:online_cpus) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(cat)} {($ VSub_Name "$SYSFS") (/devices/system/cpu/online)}) ] ) left_token: spids: [199 204] ) } spids: [198] ) ] spids: [198] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:online_max) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*-")}) spids: [208 212] ) } spids: [207] ) ] spids: [207] ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" Cpus in online state: ") ($ VSub_Name "$online_cpus") ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:offline_cpus) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(cat)} {($ VSub_Name "$SYSFS") (/devices/system/cpu/offline)}) ] ) left_token: spids: [228 233] ) } spids: [227] ) ] spids: [227] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobEqual left: {(DQ (a) ($ VSub_Name "$offline_cpus"))} right: {(DQ (a))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:offline_cpus) op: Equal rhs: {(0)} spids: [257] ) ] spids: [257] ) ] spids: [-1 254] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:offline_max) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*-")}) spids: [265 269] ) } spids: [264] ) ] spids: [264] ) ] spids: [261 272] ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" Cpus in offline state: ") ($ VSub_Name "$offline_cpus") ) } ) ] spids: [11] ) spids: [7 10] ) (FuncDef name: hotpluggable_cpus body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:state) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(.) (EscapedLiteralPart token:)} ) spids: [307 312] ) } spids: [306] ) ] spids: [304] ) (ForEach iter_name: cpu iter_words: [{($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) (Lit_Other "*")}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(-f)} {($ VSub_Name "$cpu") (/online)} {(Lit_Other "]")} ) (C {(grep)} {(-q)} {($ VSub_Name "$state")} {($ VSub_Name "$cpu") (/online)} ) ] op_id: Op_DAmp ) terminator: ) ] action: [ (C {(echo)} { (BracedVarSub token: suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {(Lit_Slash /) ("*") (Lit_Slash /) (cpu)} ) spids: [358 365] ) } ) ] spids: [-1 353] ) ] spids: [-1 368] ) ] spids: [327 371] ) spids: [321 325] ) ] spids: [301] ) spids: [297 300] ) (FuncDef name: hotplaggable_offline_cpus body: (BraceGroup children:[(C {(hotpluggable_cpus)} {(0)})] spids:[380]) spids: [376 379] ) (FuncDef name: hotpluggable_online_cpus body: (BraceGroup children:[(C {(hotpluggable_cpus)} {(1)})] spids:[394]) spids: [390 393] ) (FuncDef name: cpu_is_online body: (BraceGroup children: [ (C {(grep)} {(-q)} {(1)} {($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) ($ VSub_Number "$1") (/online)} ) ] spids: [408] ) spids: [404 407] ) (FuncDef name: cpu_is_offline body: (BraceGroup children: [ (C {(grep)} {(-q)} {(0)} {($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) ($ VSub_Number "$1") (/online)} ) ] spids: [429] ) spids: [425 428] ) (FuncDef name: online_cpu body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) ($ VSub_Number "$1") (/online)} spids: [457] ) ] ) ] spids: [450] ) spids: [446 449] ) (FuncDef name: offline_cpu body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$SYSFS") (/devices/system/cpu/cpu) ($ VSub_Number "$1") (/online)} spids: [478] ) ] ) ] spids: [471] ) spids: [467 470] ) (FuncDef name: online_cpu_expect_success body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:cpu) op: Equal rhs: {($ VSub_Number "$1")} spids: [497] ) ] spids: [495] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(online_cpu)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(fail)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[525])] ) ] spids: [-1 511] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(cpu_is_online)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[552])] ) ] spids: [529 538] ) ] spids: [-1 556] ) ] spids: [492] ) spids: [488 491] ) (FuncDef name: online_cpu_expect_fail body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:cpu) op: Equal rhs: {($ VSub_Number "$1")} spids: [570] ) ] spids: [568] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(online_cpu)} {($ VSub_Name "$cpu")}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [581] ) ] ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(success)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[600])] ) ] spids: [-1 586] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(cpu_is_offline)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(online)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[627])] ) ] spids: [604 613] ) ] spids: [-1 631] ) ] spids: [565] ) spids: [561 564] ) (FuncDef name: offline_cpu_expect_success body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:cpu) op: Equal rhs: {($ VSub_Number "$1")} spids: [645] ) ] spids: [643] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(offline_cpu)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(fail)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[673])] ) ] spids: [-1 659] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(cpu_is_offline)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[700])] ) ] spids: [677 686] ) ] spids: [-1 704] ) ] spids: [640] ) spids: [636 639] ) (FuncDef name: offline_cpu_expect_fail body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:cpu) op: Equal rhs: {($ VSub_Number "$1")} spids: [718] ) ] spids: [716] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(offline_cpu)} {($ VSub_Name "$cpu")}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [729] ) ] ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(success)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[748])] ) ] spids: [-1 734] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(cpu_is_online)} {($ VSub_Name "$cpu")})] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$cpu") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[775])] ) ] spids: [752 761] ) ] spids: [-1 779] ) ] spids: [713] ) spids: [709 712] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:error) op:Equal rhs:{(-12)} spids:[784])] spids: [784] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:allcpus) op:Equal rhs:{(0)} spids:[787])] spids: [787] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:priority) op:Equal rhs:{(0)} spids:[790])] spids: [790] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:online_cpus) op:Equal rhs:{(0)} spids:[793])] spids: [793] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:online_max) op:Equal rhs:{(0)} spids:[796])] spids: [796] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:offline_cpus) op:Equal rhs:{(0)} spids:[799])] spids: [799] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:offline_max) op:Equal rhs:{(0)} spids:[802])] spids: [802] ) (While cond: [ (Sentence child: (C {(getopts)} {(e) (Lit_Other ":") (ahp) (Lit_Other ":")} {(opt)}) terminator: ) ] body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$opt")} arms: [ (case_arm pat_list: [{(e)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:error) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [832] ) ] spids: [832] ) ] spids: [828 829 836 -1] ) (case_arm pat_list: [{(a)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:allcpus) op:Equal rhs:{(1)} spids:[843])] spids: [843] ) ] spids: [839 840 847 -1] ) (case_arm pat_list: [{(h)}] action: [ (C {(echo)} { (DQ ("Usage ") ($ VSub_Number "$0") (" [ -a ] [ -e errno ] [ -p notifier-priority ]") ) } ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" default offline one cpu") ) } ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" run with -a option to offline all cpus") ) } ) (C {(exit)}) ] spids: [850 851 886 -1] ) (case_arm pat_list: [{(p)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:priority) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [893] ) ] spids: [893] ) ] spids: [889 890 897 -1] ) ] spids: [821 825 900] ) ] spids: [818 902] ) ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$error"))} {(-ge)} {(-4095)} {(-a)} {(DQ ($ VSub_Name "$error"))} {(-lt)} {(0)} {(Lit_Other "]")} ) ] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("error code must be -4095 <= errno < 0"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[941])] ) (C {(exit)} {(1)}) ] spids: [-1 932] ) ] spids: [-1 949] ) (C {(prerequisite)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {($ VSub_Name "$allcpus")} {(-eq)} {(0)} {(Lit_Other "]")}) terminator: ) ] action: [ (C {(echo)} {(DQ ("Limited scope test: one hotplug cpu"))}) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" (leaves cpu in the original state):") ) } ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" online to offline to online: cpu ") ($ VSub_Name "$online_max") ) } ) (C {(offline_cpu_expect_success)} {($ VSub_Name "$online_max")}) (C {(online_cpu_expect_success)} {($ VSub_Name "$online_max")}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: {($ VSub_Name "$offline_cpus")} right: {(0)} ) ) terminator: ) ] action: [ (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:) (" offline to online to offline: cpu ") ($ VSub_Name "$offline_max") ) } ) (C {(online_cpu_expect_success)} {($ VSub_Name "$offline_max")}) (C {(offline_cpu_expect_success)} {($ VSub_Name "$offline_max")}) ] spids: [-1 1032] ) ] spids: [-1 1056] ) (C {(exit)} {(0)}) ] spids: [-1 977] ) ] else_action: [ (C {(echo)} {(DQ ("Full scope test: all hotplug cpus"))}) (C {(echo)} {(-e)} {(DQ (EscapedLiteralPart token:) (" online all offline cpus"))} ) (C {(echo)} {(-e)} {(DQ (EscapedLiteralPart token:) (" offline all online cpus"))} ) (C {(echo)} {(-e)} {(DQ (EscapedLiteralPart token:) (" online all offline cpus"))} ) ] spids: [1063 1102] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_cpus)})]) left_token: spids: [1120 1122] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_cpu_expect_success)} {($ VSub_Name "$cpu")})] spids: [1125 1132] ) spids: [1119 1123] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_cpus)})]) left_token: spids: [1150 1152] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(offline_cpu_expect_success)} {($ VSub_Name "$cpu")})] spids: [1155 1162] ) spids: [1149 1153] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_cpus)})]) left_token: spids: [1180 1182] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_cpu_expect_success)} {($ VSub_Name "$cpu")})] spids: [1185 1192] ) spids: [1179 1183] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DEBUGFS) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(mount)} {(-t)} {(debugfs)}) (C {(head)} {(-1)}) (C {(awk)} {(SQ <"{ print $3 }">)}) ] negated: False ) ] ) left_token: spids: [1206 1226] ) } spids: [1205] ) ] spids: [1205] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NOTIFIER_ERR_INJECT_DIR) op: Equal rhs: {($ VSub_Name "$DEBUGFS") (/notifier-error-inject/cpu)} spids: [1228] ) ] spids: [1228] ) (FuncDef name: prerequisite_extra body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:msg) op: Equal rhs: {(DQ ("skip extra tests:"))} spids: [1240] ) ] spids: [1240] ) (C {(/sbin/modprobe)} {(-q)} {(-r)} {(cpu-notifier-error-inject)}) (C {(/sbin/modprobe)} {(-q)} {(cpu-notifier-error-inject)} {(Lit_VarLike "priority=") ($ VSub_Name "$priority")} ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$DEBUGFS"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$msg")} {(debugfs)} {(is)} {(not)} {(mounted)}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1297])] ) (C {(exit)} {(0)}) ] spids: [-1 1282] ) ] spids: [-1 1306] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR")} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$msg")} {(cpu-notifier-error-inject)} {(module)} {(is)} {(not)} {(available)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1340])] ) (C {(exit)} {(0)}) ] spids: [-1 1323] ) ] spids: [-1 1349] ) ] spids: [1237] ) spids: [1233 1236] ) (C {(prerequisite_extra)}) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/CPU_DOWN_PREPARE/error)} spids: [1370] ) ] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_cpus)})]) left_token: spids: [1381 1383] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(offline_cpu_expect_success)} {($ VSub_Name "$cpu")})] spids: [1386 1393] ) spids: [1380 1384] ) (SimpleCommand words: [{(echo)} {($ VSub_Name "$error")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/CPU_UP_PREPARE/error)} spids: [1409] ) ] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_cpus)})]) left_token: spids: [1420 1422] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_cpu_expect_fail)} {($ VSub_Name "$cpu")})] spids: [1425 1432] ) spids: [1419 1423] ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/CPU_UP_PREPARE/error)} spids: [1448] ) ] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_cpus)})]) left_token: spids: [1459 1461] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_cpu_expect_success)} {($ VSub_Name "$cpu")})] spids: [1464 1471] ) spids: [1458 1462] ) (SimpleCommand words: [{(echo)} {($ VSub_Name "$error")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/CPU_DOWN_PREPARE/error)} spids: [1487] ) ] ) (ForEach iter_name: cpu iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_cpus)})]) left_token: spids: [1498 1500] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(offline_cpu_expect_fail)} {($ VSub_Name "$cpu")})] spids: [1503 1510] ) spids: [1497 1501] ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/CPU_DOWN_PREPARE/error)} spids: [1517] ) ] ) (C {(/sbin/modprobe)} {(-q)} {(-r)} {(cpu-notifier-error-inject)}) ] )