Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
mbed-client/run_unit_tests.sh@0:dbad57390bd1, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:37:05 2017 +0000
- Revision:
- 0:dbad57390bd1
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:dbad57390bd1 | 1 | #!/bin/bash |
ram54288 | 0:dbad57390bd1 | 2 | # Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:dbad57390bd1 | 3 | # SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:dbad57390bd1 | 4 | # Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:dbad57390bd1 | 5 | # not use this file except in compliance with the License. |
ram54288 | 0:dbad57390bd1 | 6 | # You may obtain a copy of the License at |
ram54288 | 0:dbad57390bd1 | 7 | # |
ram54288 | 0:dbad57390bd1 | 8 | # * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:dbad57390bd1 | 9 | # |
ram54288 | 0:dbad57390bd1 | 10 | # Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:dbad57390bd1 | 11 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:dbad57390bd1 | 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:dbad57390bd1 | 13 | # See the License for the specific language governing permissions and |
ram54288 | 0:dbad57390bd1 | 14 | # limitations under the License. |
ram54288 | 0:dbad57390bd1 | 15 | |
ram54288 | 0:dbad57390bd1 | 16 | echo |
ram54288 | 0:dbad57390bd1 | 17 | echo "Build mbed Client API unit tests" |
ram54288 | 0:dbad57390bd1 | 18 | echo |
ram54288 | 0:dbad57390bd1 | 19 | yt target x86-linux-native-coverage |
ram54288 | 0:dbad57390bd1 | 20 | yt clean |
ram54288 | 0:dbad57390bd1 | 21 | yt build |
ram54288 | 0:dbad57390bd1 | 22 | yt test --no-build -- -ojunit |
ram54288 | 0:dbad57390bd1 | 23 | echo |
ram54288 | 0:dbad57390bd1 | 24 | echo Create results |
ram54288 | 0:dbad57390bd1 | 25 | echo |
ram54288 | 0:dbad57390bd1 | 26 | rm -rf results |
ram54288 | 0:dbad57390bd1 | 27 | rm -rf coverage |
ram54288 | 0:dbad57390bd1 | 28 | mkdir results |
ram54288 | 0:dbad57390bd1 | 29 | mkdir coverage |
ram54288 | 0:dbad57390bd1 | 30 | |
ram54288 | 0:dbad57390bd1 | 31 | find ./build -name '*.xml' | xargs cp -t ./results/ |
ram54288 | 0:dbad57390bd1 | 32 | find ./build/x86-linux-native-coverage/test -name '*.gcno' | xargs cp -t ./coverage/ |
ram54288 | 0:dbad57390bd1 | 33 | find ./build/x86-linux-native-coverage/test -name '*.gcda' | xargs cp -t ./coverage/ |
ram54288 | 0:dbad57390bd1 | 34 | touch coverage/*.gcda |
ram54288 | 0:dbad57390bd1 | 35 | exclude_files="${PWD}/test/" |
ram54288 | 0:dbad57390bd1 | 36 | gcovr -r ./ --gcov-filter='.*source*.' --exclude-unreachable-branches --exclude $exclude_files --object-directory ./coverage -x -o ./results/gcovr.xml |
ram54288 | 0:dbad57390bd1 | 37 | echo |
ram54288 | 0:dbad57390bd1 | 38 | echo "Create coverage document" |
ram54288 | 0:dbad57390bd1 | 39 | echo |
ram54288 | 0:dbad57390bd1 | 40 | lcov -b ./ -d ./coverage -c -o ./coverage/app.info |
ram54288 | 0:dbad57390bd1 | 41 | lcov -q -r ./coverage/app.info "/test/mbedclient/*" -o ./coverage/app.info |
ram54288 | 0:dbad57390bd1 | 42 | lcov -q -r ./coverage/app.info "/usr*" -o ./coverage/app.info |
ram54288 | 0:dbad57390bd1 | 43 | genhtml -q --no-branch-coverage --function-coverage --demangle-cpp --title "mbed Client coverage" ./coverage/app.info -o ./coverage |
ram54288 | 0:dbad57390bd1 | 44 | rm -f ./coverage/*.gcno |
ram54288 | 0:dbad57390bd1 | 45 | rm -f ./coverage/*.gcda |
ram54288 | 0:dbad57390bd1 | 46 | echo |
ram54288 | 0:dbad57390bd1 | 47 | echo "Creating report" |
ram54288 | 0:dbad57390bd1 | 48 | echo |
ram54288 | 0:dbad57390bd1 | 49 | echo '<?xml version="1.0" encoding="UTF-8" ?> |
ram54288 | 0:dbad57390bd1 | 50 | <?xml-stylesheet type="text/xsl" href="junit_xsl.xslt"?> |
ram54288 | 0:dbad57390bd1 | 51 | <list>' >> index.xml |
ram54288 | 0:dbad57390bd1 | 52 | |
ram54288 | 0:dbad57390bd1 | 53 | for f in results/*.xml |
ram54288 | 0:dbad57390bd1 | 54 | do |
ram54288 | 0:dbad57390bd1 | 55 | name=${f##*/} |
ram54288 | 0:dbad57390bd1 | 56 | echo '<entry name="results/'"$name"'" />'>> index.xml |
ram54288 | 0:dbad57390bd1 | 57 | done |
ram54288 | 0:dbad57390bd1 | 58 | |
ram54288 | 0:dbad57390bd1 | 59 | echo '</list>' >> index.xml |
ram54288 | 0:dbad57390bd1 | 60 | |
ram54288 | 0:dbad57390bd1 | 61 | echo |
ram54288 | 0:dbad57390bd1 | 62 | echo "Report created to index.xml (outputs html)" |
ram54288 | 0:dbad57390bd1 | 63 | echo |
ram54288 | 0:dbad57390bd1 | 64 | xsltproc -o results/testresults.html junit_xsl.xslt index.xml |
ram54288 | 0:dbad57390bd1 | 65 | rm -f index.xml |
ram54288 | 0:dbad57390bd1 | 66 |