(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: <Op_Semi ";"> ) ] 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] ) (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: <Left_Backtick "`"> spids: [66 86] ) } spids: [65] ) ] spids: [65] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ ($ VSub_Name "$SYSFS"))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$msg")} {(sysfs)} {(is)} {(not)} {(mounted)}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[120])] ) (C {(exit)} {(0)}) ] spids: [-1 105] ) ] spids: [-1 129] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(ls)} {($ VSub_Name "$SYSFS") (/devices/system/memory/memory) (Lit_Other "*") } ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [143] ) (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [147] ) ] ) ] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$msg")} {(memory)} {(hotplug)} {(is)} {(not)} {(supported)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[168])] ) (C {(exit)} {(0)}) ] spids: [-1 151] ) ] spids: [-1 177] ) ] spids: [11] ) spids: [7 10] ) (FuncDef name: hotpluggable_memory body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:state) op: Equal rhs: { (BracedVarSub token: <VSub_Number 1> suffix_op: (StringUnary op_id: VTest_ColonHyphen arg_word: {(.) (EscapedLiteralPart token:<Lit_EscapedChar "\\*">)} ) spids: [201 206] ) } spids: [200] ) ] spids: [198] ) (ForEach iter_name: memory iter_words: [{($ VSub_Name "$SYSFS") (/devices/system/memory/memory) (Lit_Other "*")}] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(grep)} {(-q)} {(1)} {($ VSub_Name "$memory") (/removable)}) (C {(grep)} {(-q)} {($ VSub_Name "$state")} {($ VSub_Name "$memory") (/state)} ) ] op_id: Op_DAmp ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} { (BracedVarSub token: <VSub_Name memory> suffix_op: (StringUnary op_id: VOp1_DPound arg_word: {(Lit_Slash /) ("*") (Lit_Slash /) (memory)} ) spids: [253 260] ) } ) ] spids: [-1 248] ) ] spids: [-1 263] ) ] spids: [221 266] ) spids: [215 219] ) ] spids: [195] ) spids: [191 194] ) (FuncDef name: hotplaggable_offline_memory body: (BraceGroup children:[(C {(hotpluggable_memory)} {(offline)})] spids:[275]) spids: [271 274] ) (FuncDef name: hotpluggable_online_memory body: (BraceGroup children:[(C {(hotpluggable_memory)} {(online)})] spids:[289]) spids: [285 288] ) (FuncDef name: memory_is_online body: (BraceGroup children: [ (C {(grep)} {(-q)} {(online)} {($ VSub_Name "$SYSFS") (/devices/system/memory/memory) ($ VSub_Number "$1") (/state)} ) ] spids: [303] ) spids: [299 302] ) (FuncDef name: memory_is_offline body: (BraceGroup children: [ (C {(grep)} {(-q)} {(offline)} {($ VSub_Name "$SYSFS") (/devices/system/memory/memory) ($ VSub_Number "$1") (/state)} ) ] spids: [324] ) spids: [320 323] ) (FuncDef name: online_memory body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(online)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$SYSFS") (/devices/system/memory/memory) ($ VSub_Number "$1") (/state) } spids: [352] ) ] ) ] spids: [345] ) spids: [341 344] ) (FuncDef name: offline_memory body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(offline)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$SYSFS") (/devices/system/memory/memory) ($ VSub_Number "$1") (/state) } spids: [373] ) ] ) ] spids: [366] ) spids: [362 365] ) (FuncDef name: online_memory_expect_success body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:memory) op: Equal rhs: {($ VSub_Number "$1")} spids: [392] ) ] spids: [390] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(online_memory)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(fail)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[420])] ) ] spids: [-1 406] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(memory_is_online)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[447])] ) ] spids: [424 433] ) ] spids: [-1 451] ) ] spids: [387] ) spids: [383 386] ) (FuncDef name: online_memory_expect_fail body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:memory) op: Equal rhs: {($ VSub_Number "$1")} spids: [465] ) ] spids: [463] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(online_memory)} {($ VSub_Name "$memory")}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [476] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(success)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[495])] ) ] spids: [-1 481] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(memory_is_offline)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(online)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[522])] ) ] spids: [499 508] ) ] spids: [-1 526] ) ] spids: [460] ) spids: [456 459] ) (FuncDef name: offline_memory_expect_success body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:memory) op: Equal rhs: {($ VSub_Number "$1")} spids: [540] ) ] spids: [538] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(offline_memory)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(fail)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[568])] ) ] spids: [-1 554] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(memory_is_offline)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[595])] ) ] spids: [572 581] ) ] spids: [-1 599] ) ] spids: [535] ) spids: [531 534] ) (FuncDef name: offline_memory_expect_fail body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:memory) op: Equal rhs: {($ VSub_Number "$1")} spids: [613] ) ] spids: [611] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(offline_memory)} {($ VSub_Name "$memory")}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [624] ) ] ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(success)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[643])] ) ] spids: [-1 629] ) (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(memory_is_online)} {($ VSub_Name "$memory")})] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$FUNCNAME")} {($ VSub_Name "$memory") (Lit_Other ":")} {(unexpected)} {(offline)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[670])] ) ] spids: [647 656] ) ] spids: [-1 674] ) ] spids: [608] ) spids: [604 607] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:error) op:Equal rhs:{(-12)} spids:[679])] spids: [679] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:priority) op:Equal rhs:{(0)} spids:[682])] spids: [682] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ratio) op:Equal rhs:{(10)} spids:[685])] spids: [685] ) (While cond: [ (Sentence child: (C {(getopts)} {(e) (Lit_Other ":") (hp) (Lit_Other ":") (r) (Lit_Other ":")} {(opt)}) terminator: <Op_Semi ";"> ) ] 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: [717] ) ] spids: [717] ) ] spids: [713 714 721 -1] ) (case_arm pat_list: [{(h)}] action: [ (C {(echo)} { (DQ ("Usage ") ($ VSub_Number "$0") ( " [ -e errno ] [ -p notifier-priority ] [ -r percent-of-memory-to-offline ]" ) ) } ) (C {(exit)}) ] spids: [724 725 740 -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: [747] ) ] spids: [747] ) ] spids: [743 744 751 -1] ) (case_arm pat_list: [{(r)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ratio) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [758] ) ] spids: [758] ) ] spids: [754 755 762 -1] ) ] spids: [706 710 765] ) ] spids: [703 767] ) ) (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: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("error code must be -4095 <= errno < 0"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[806])] ) (C {(exit)} {(1)}) ] spids: [-1 797] ) ] spids: [-1 814] ) (C {(prerequisite)}) (C {(echo)} {(DQ ("Test scope: ") ($ VSub_Name "$ratio") ("% hotplug memory"))}) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) (" online all hotplug memory in offline state") ) } ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) (" offline ") ($ VSub_Name "$ratio") ("% hotplug memory in online state") ) } ) (C {(echo)} {(-e)} { (DQ (EscapedLiteralPart token:<Lit_EscapedChar "\\t">) (" online all hotplug memory in offline state") ) } ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_memory)})]) left_token: <Left_Backtick "`"> spids: [873 875] ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {(offline-online)} {($ VSub_Name "$memory")}) (C {(online_memory_expect_success)} {($ VSub_Name "$memory")}) ] spids: [878 892] ) spids: [872 876] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_memory)})]) left_token: <Left_Backtick "`"> spids: [910 912] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (ArithSubPart anode: (ArithBinary op_id: Arith_Percent left: (ArithVarRef name:RANDOM) right: (ArithWord w:{(Lit_Digits 100)}) ) spids: [922 929] ) } {(-lt)} {($ VSub_Name "$ratio")} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (C {(echo)} {(online-offline)} {($ VSub_Name "$memory")}) (C {(offline_memory_expect_success)} {($ VSub_Name "$memory")}) ] spids: [-1 938] ) ] spids: [-1 953] ) ] spids: [915 955] ) spids: [909 913] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_memory)})]) left_token: <Left_Backtick "`"> spids: [973 975] ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {(offline-online)} {($ VSub_Name "$memory")}) (C {(online_memory_expect_success)} {($ VSub_Name "$memory")}) ] spids: [978 992] ) spids: [972 976] ) (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: <Left_Backtick "`"> spids: [1006 1026] ) } spids: [1005] ) ] spids: [1005] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NOTIFIER_ERR_INJECT_DIR) op: Equal rhs: {($ VSub_Name "$DEBUGFS") (/notifier-error-inject/memory)} spids: [1028] ) ] spids: [1028] ) (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: [1040] ) ] spids: [1040] ) (C {(/sbin/modprobe)} {(-q)} {(-r)} {(memory-notifier-error-inject)}) (C {(/sbin/modprobe)} {(-q)} {(memory-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: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {($ VSub_Name "$msg")} {(debugfs)} {(is)} {(not)} {(mounted)}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1097])] ) (C {(exit)} {(0)}) ] spids: [-1 1082] ) ] spids: [-1 1106] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR")} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name "$msg")} {(memory-notifier-error-inject)} {(module)} {(is)} {(not)} {(available)} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1140])] ) (C {(exit)} {(0)}) ] spids: [-1 1123] ) ] spids: [-1 1149] ) ] spids: [1037] ) spids: [1033 1036] ) (C {(prerequisite_extra)}) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/MEM_GOING_OFFLINE/error)} spids: [1170] ) ] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_memory)})]) left_token: <Left_Backtick "`"> spids: [1181 1183] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (ArithSubPart anode: (ArithBinary op_id: Arith_Percent left: (ArithVarRef name:RANDOM) right: (ArithWord w:{(Lit_Digits 100)}) ) spids: [1193 1200] ) } {(-lt)} {($ VSub_Name "$ratio")} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [(C {(offline_memory_expect_success)} {($ VSub_Name "$memory")})] spids: [-1 1209] ) ] spids: [-1 1217] ) ] spids: [1186 1219] ) spids: [1180 1184] ) (SimpleCommand words: [{(echo)} {($ VSub_Name "$error")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/MEM_GOING_ONLINE/error)} spids: [1235] ) ] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_memory)})]) left_token: <Left_Backtick "`"> spids: [1246 1248] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_memory_expect_fail)} {($ VSub_Name "$memory")})] spids: [1251 1258] ) spids: [1245 1249] ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/MEM_GOING_ONLINE/error)} spids: [1274] ) ] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotplaggable_offline_memory)})]) left_token: <Left_Backtick "`"> spids: [1285 1287] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(online_memory_expect_success)} {($ VSub_Name "$memory")})] spids: [1290 1297] ) spids: [1284 1288] ) (SimpleCommand words: [{(echo)} {($ VSub_Name "$error")}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/MEM_GOING_OFFLINE/error)} spids: [1313] ) ] ) (ForEach iter_name: memory iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(hotpluggable_online_memory)})]) left_token: <Left_Backtick "`"> spids: [1324 1326] ) } ] do_arg_iter: False body: (DoGroup children: [(C {(offline_memory_expect_fail)} {($ VSub_Name "$memory")})] spids: [1329 1336] ) spids: [1323 1327] ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {($ VSub_Name "$NOTIFIER_ERR_INJECT_DIR") (/actions/MEM_GOING_OFFLINE/error)} spids: [1343] ) ] ) (C {(/sbin/modprobe)} {(-q)} {(-r)} {(memory-notifier-error-inject)}) ] )