#!/bin/bash set -e set -o pipefail # To debug, uncomment the following line # set -x # Test whether the compile option -mprofile-kernel exists and generates # profiling code (ie. a call to _mcount()). echo "int func() { return 0; }" | \ $ifsjoin(Argv) -S -x c -O2 -p -mprofile-kernel - -o - !2 > /dev/null | \ grep -q "_mcount" # Test whether the notrace attribute correctly suppresses calls to _mcount(). echo -e "#include \nnotrace int func() { return 0; }" | \ $ifsjoin(Argv) -S -x c -O2 -p -mprofile-kernel - -o - !2 > /dev/null | \ grep -q "_mcount" && \ exit 1 echo "OK" exit 0 (CommandList children: [ (C {(set)} {(-e)}) (C {(set)} {(-o)} {(pipefail)}) (Pipeline children: [ (C {(echo)} {(DQ ("int func() { return 0; }"))}) (SimpleCommand words: [ {($ VSub_Star "$*")} {(-S)} {(-x)} {(c)} {(-O2)} {(-p)} {(-mprofile-kernel)} {(-)} {(-o)} {(-)} ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[58])] ) (C {(grep)} {(-q)} {(DQ (_mcount))}) ] negated: False ) (AndOr children: [ (Pipeline children: [ (C {(echo)} {(-e)} { (DQ ("#include ") (EscapedLiteralPart token:) ("notrace int func() { return 0; }") ) } ) (SimpleCommand words: [ {($ VSub_Star "$*")} {(-S)} {(-x)} {(c)} {(-O2)} {(-p)} {(-mprofile-kernel)} {(-)} {(-o)} {(-)} ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[113])] ) (C {(grep)} {(-q)} {(DQ (_mcount))}) ] negated: False ) (C {(exit)} {(1)}) ] op_id: Op_DAmp ) (C {(echo)} {(DQ (OK))}) (C {(exit)} {(0)}) ] )