(CommandList children: [ (C {(set)} {(-e)}) (C {(modprobe)} {(test_firmware)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DIR) op: Equal rhs: {(/sys/devices/virtual/misc/test_firmware)} spids: [25] ) ] spids: [25] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:HAS_FW_LOADER_USER_HELPER) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-d)} {(/sys/class/firmware/)} {(Lit_Other "]")}) terminator: <Op_Semi ";"> ) ] action: [(Sentence child:(C {(echo)} {(yes)}) terminator:<Op_Semi ";">)] spids: [-1 51] ) ] else_action: [(Sentence child:(C {(echo)} {(no)}) terminator:<Op_Semi ";">)] spids: [58 65] ) ] ) left_token: <Left_CommandSub "$("> spids: [39 66] ) } spids: [38] ) ] spids: [38] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$HAS_FW_LOADER_USER_HELPER"))} {(Lit_Other "=")} {(DQ (yes))} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:OLD_TIMEOUT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(cat)} {(/sys/class/firmware/timeout)})] ) left_token: <Left_CommandSub "$("> spids: [90 94] ) } spids: [89] ) ] spids: [89] ) ] spids: [-1 86] ) ] else_action: [(C {(echo)} {(DQ ("usermode helper disabled so ignoring test"))}) (C {(exit)} {(0)})] spids: [96 110] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FWPATH) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(mktemp)} {(-d)})]) left_token: <Left_CommandSub "$("> spids: [114 118] ) } spids: [113] ) ] spids: [113] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FW) op: Equal rhs: {(DQ ($ VSub_Name "$FWPATH") (/test-firmware.bin))} spids: [120] ) ] spids: [120] ) (FuncDef name: test_finish body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name "$OLD_TIMEOUT"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/sys/class/firmware/timeout)} spids: [140] ) ] ) (C {(rm)} {(-f)} {(DQ ($ VSub_Name "$FW"))}) (C {(rmdir)} {(DQ ($ VSub_Name "$FWPATH"))}) ] spids: [131] ) spids: [127 130] ) (FuncDef name: load_fw body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [171] ) ] spids: [169] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:file) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [179] ) ] spids: [177] ) (Sentence child: (SimpleCommand words: [{(echo)} {(-n)} {(DQ ($ VSub_Name "$name"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$DIR")) (/trigger_request)} spids: [198] ) ] ) terminator: <Op_Amp "&"> ) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:timeout) op:Equal rhs:{(10)} spids:[214])] spids: [212] ) (While cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-e)} {(DQ ($ VSub_Name "$DIR")) (/) (DQ ($ VSub_Name "$name")) (/loading)} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] body: (DoGroup children: [ (C {(sleep)} {(0.1)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:timeout) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name "$timeout")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [247 256] ) } spids: [246] ) ] spids: [246] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$timeout"))} {(-eq)} {(0)} {(Lit_Other "]")} ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ($ VSub_Number "$0") (": firmware interface never appeared"))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [284] ) ] ) (C {(exit)} {(1)}) ] spids: [-1 274] ) ] spids: [-1 293] ) ] spids: [238 296] ) ) (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$DIR")) (/) (DQ ($ VSub_Name "$name")) (/loading)} spids: [304] ) ] ) (SimpleCommand words: [{(cat)} {(DQ ($ VSub_Name "$file"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$DIR")) (/) (DQ ($ VSub_Name "$name")) (/data)} spids: [321] ) ] ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$DIR")) (/) (DQ ($ VSub_Name "$name")) (/loading)} spids: [336] ) ] ) (C {(wait)}) ] spids: [166] ) spids: [162 165] ) (C {(trap)} {(DQ (test_finish))} {(EXIT)}) (SimpleCommand words: [{(echo)} {(DQ (ABCD0123))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(DQ ($ VSub_Name "$FW"))} spids:[375])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NAME) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(basename)} {(DQ ($ VSub_Name "$FW"))})]) left_token: <Left_CommandSub "$("> spids: [381 387] ) } spids: [380] ) ] spids: [380] ) (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/sys/class/firmware/timeout)} spids:[397]) ] ) (SimpleCommand words: [{(echo)} {(-n)} {(DQ ($ VSub_Name "$NAME"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$DIR")) (/trigger_request)} spids: [408] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(diff)} {(-q)} {(DQ ($ VSub_Name "$FW"))} {(/dev/test_firmware)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[426])] ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number "$0") (": firmware was not expected to match"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[441])] ) (C {(exit)} {(1)}) ] spids: [-1 431] ) ] else_action: [(C {(echo)} {(DQ ($ VSub_Number "$0") (": timeout works"))})] spids: [449 459] ) (SimpleCommand words: [{(echo)} {(4)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(/sys/class/firmware/timeout)} spids:[472]) ] ) (C {(load_fw)} {(DQ ($ VSub_Name "$NAME"))} {(DQ ($ VSub_Number "$0"))}) (If arms: [ (if_arm cond: [ (Sentence child: (SimpleCommand words: [{(diff)} {(-q)} {(DQ ($ VSub_Name "$FW"))} {(/dev/test_firmware)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[501])] ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number "$0") (": firmware was not expected to match"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[516])] ) (C {(exit)} {(1)}) ] spids: [-1 506] ) ] else_action: [(C {(echo)} {(DQ ($ VSub_Number "$0") (": firmware comparison works"))})] spids: [524 534] ) (C {(load_fw)} {(DQ ($ VSub_Name "$NAME"))} {(DQ ($ VSub_Name "$FW"))}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(diff)} {(-q)} {(DQ ($ VSub_Name "$FW"))} {(/dev/test_firmware)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[564])] ) ] negated: True ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number "$0") (": firmware was not loaded"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[579])] ) (C {(exit)} {(1)}) ] spids: [-1 569] ) ] else_action: [(C {(echo)} {(DQ ($ VSub_Number "$0") (": user helper firmware loading works"))})] spids: [587 597] ) (C {(exit)} {(0)}) ] )