#!/bin/bash # Run smoketest script on every build/system-image-* architecture. # If $FORK is set, run them in parallel. test -z $FORK || global TIMEOUT := $(TIMEOUT:-180) source sources/utility_functions.sh || exit 1 proc dotest { test -z $FORK && echo -n "Testing $1:" test ! -z $VERBOSE && global VERBOSITY := '"tee >(cat >&2) |'" global RESULT := $[more/smoketest.sh $1 !2 > !1 | eval "$VERBOSITY grep 'Hello world!'] test -z $RESULT && global RESULT := '"FAIL'" || global RESULT := '"PASS'" test -z $FORK && echo $RESULT || echo "Testing $1:$RESULT" rm -f build/system-image-"$1"/hdb.img !2 >/dev/null } # Test all non-hw targets to see whether or not they can compile and run # the included "hello world" program. for i in [$[ls -d sources/targets/* | sed 's@.*/@@' | grep -v "^hw-]] { if test -e "build/system-image-$i" { maybe_fork "dotest $i" } else { echo "Testing $i:NONE" } } wait (CommandList children: [ (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$FORK"))} {(Lit_Other "]")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TIMEOUT) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(180)}) spids: [25 29] ) } spids: [24] ) ] spids: [24] ) ] op_id: Op_DPipe ) (AndOr children: [(C {(.)} {(sources/utility_functions.sh)}) (C {(exit)} {(1)})] op_id: Op_DPipe ) (FuncDef name: dotest body: (BraceGroup children: [ (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$FORK"))} {(Lit_Other "]")}) (C {(echo)} {(-n)} {(DQ ("Testing ") ($ VSub_Number "$1") (":"))}) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(KW_Bang "!")} {(-z)} {(DQ ($ VSub_Name "$VERBOSE"))} {(Lit_Other "]")} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VERBOSITY) op: Equal rhs: {(DQ ("tee >(cat >&2) |"))} spids: [89] ) ] spids: [89] ) ] op_id: Op_DAmp ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RESULT) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [{(more/smoketest.sh)} {(DQ ($ VSub_Number "$1"))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: 2 arg_word: {(1)} spids: [104] ) ] ) (C {(eval)} {(DQ ($ VSub_Name "$VERBOSITY") (" grep 'Hello world!'"))} ) ] negated: False ) ] ) left_token: spids: [97 115] ) ) } spids: [95] ) ] spids: [95] ) (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$RESULT"))} {(Lit_Other "]")}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RESULT) op: Equal rhs: {(DQ (FAIL))} spids: [131] ) ] spids: [131] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RESULT) op: Equal rhs: {(DQ (PASS))} spids: [138] ) ] spids: [138] ) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$FORK"))} {(Lit_Other "]")}) (AndOr children: [ (C {(echo)} {(DQ ($ VSub_Name "$RESULT"))}) (C {(echo)} {(DQ ("Testing ") ($ VSub_Number "$1") (":") ($ VSub_Name "$RESULT"))}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (SimpleCommand words: [{(rm)} {(-f)} {(build/system-image-) (DQ ($ VSub_Number "$1")) (/hdb.img)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[184])] ) ] spids: [49] ) spids: [43 48] ) (ForEach iter_name: i iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(ls)} {(-d)} {(sources/targets/) (Lit_Other "*")}) (C {(sed)} {(SQ <"s@.*/@@">)}) (C {(grep)} {(-v)} {(DQ ("^hw-"))}) ] negated: False ) ] ) left_token: spids: [203 228] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (C {(Lit_Other "[")} {(-e)} {(DQ (build/system-image-) ($ VSub_Name "$i"))} {(Lit_Other "]")} ) ] action: [(C {(maybe_fork)} {(DQ ("dotest ") ($ VSub_Name "$i"))})] spids: [-1 247] ) ] else_action: [(C {(echo)} {(DQ ("Testing ") ($ VSub_Name "$i") (":NONE"))})] spids: [258 270] ) ] spids: [230 272] ) spids: [202 -1] ) (C {(wait)}) ] )