|
5 | 5 |
|
6 | 6 | set -e |
7 | 7 |
|
| 8 | +set -x ################### DEBUG !!!!!!!!!!!!!!!!!!!!!!! |
| 9 | + |
8 | 10 | [ "$1" != "" ] && OUTPUT_NAME="$1" || OUTPUT_NAME="total_coverage" |
9 | 11 |
|
| 12 | +# Most common UMF source code directory on most GH CI runners |
| 13 | +COMMON_UMF_DIR=/home/runner/work/unified-memory-framework/unified-memory-framework |
| 14 | + |
| 15 | +# Get the current UMF source code directory |
| 16 | +# This is ${CURRENT_UMF_DIR}/scripts/coverage/coverage_capture.sh file, so |
| 17 | +CURRENT_UMF_DIR=$(realpath $(dirname $0)/../..) |
| 18 | + |
| 19 | +################### DEBUG !!!!!!!!!!!!!!!!!!!!!!! |
| 20 | +if [ 0 -eq 1 ]; then |
| 21 | + # Create the symbolic link $COMMON_UMF_DIR that points to $CURRENT_UMF_DIR: |
| 22 | + [ -e $COMMON_UMF_DIR ] && rm -rf $COMMON_UMF_DIR || ( ls -al $COMMON_UMF_DIR && exit 1 ) # remove the old link/directory |
| 23 | + sudo mkdir -p $(dirname $COMMON_UMF_DIR) # create all subdirectories |
| 24 | + sudo ln -s $CURRENT_UMF_DIR $COMMON_UMF_DIR # create the symbolic link |
| 25 | + GROUP=$(groups | cut -d' ' -f1) # get the main group of the current user |
| 26 | + sudo chown $USER:$GROUP $COMMON_UMF_DIR # change owner and group to the current user's one |
| 27 | + ls -al $COMMON_UMF_DIR # check the link |
| 28 | + |
| 29 | + # Replace $CURRENT_UMF_DIR with $COMMON_UMF_DIR during "lcov --capture" command. |
| 30 | + # From the lcovrc(5) manual: |
| 31 | + # Adjust path to source files by removing or changing path |
| 32 | + # components that match the specified pattern (Perl regular |
| 33 | + # expression format) |
| 34 | + # geninfo_adjust_src_path = /tmp/build => /usr/src |
| 35 | + echo "geninfo_adjust_src_path = \"s#$CURRENT_UMF_DIR#$COMMON_UMF_DIR#g\"" | tee ${HOME}/.lcovrc |
| 36 | +else |
| 37 | + rm -f ${HOME}/.lcovrc |
| 38 | +fi |
| 39 | + |
10 | 40 | set -x |
11 | 41 |
|
12 | | -# --exclude "*proxy_lib_new_delete.h*" |
13 | | -lcov --capture --directory . --exclude "/usr/*" --exclude "*/build/_deps/*" --exclude "*/examples/*" --exclude "*/test/*" --exclude "*/src/critnib/*" --exclude "*/src/ravl/*" --output-file $OUTPUT_NAME || \ |
14 | | - ( echo && lcov --capture --directory . --exclude "/usr/*" --exclude "*/build/_deps/*" --exclude "*/examples/*" --exclude "*/test/*" --exclude "*/src/critnib/*" --exclude "*/src/ravl/*" --ignore-errors mismatch,unused --output-file $OUTPUT_NAME ) |
| 42 | +lcov --capture --directory . \ |
| 43 | +--exclude "/usr/*" \ |
| 44 | +--exclude "*/build/*" \ |
| 45 | +--exclude "*/examples/*" \ |
| 46 | +--exclude "*/test/*" \ |
| 47 | +--exclude "*/src/critnib/*" \ |
| 48 | +--exclude "*/src/ravl/*" \ |
| 49 | +--exclude "*proxy_lib_new_delete.h" \ |
| 50 | +--output-file $OUTPUT_NAME || \ |
| 51 | + ( echo "RETRY after ERROR !!!:" && \ |
| 52 | + lcov --capture --directory . \ |
| 53 | + --exclude "/usr/*" \ |
| 54 | + --exclude "*/build/*" \ |
| 55 | + --exclude "*/examples/*" \ |
| 56 | + --exclude "*/test/*" \ |
| 57 | + --exclude "*/src/critnib/*" \ |
| 58 | + --exclude "*/src/ravl/*" \ |
| 59 | + --exclude "*proxy_lib_new_delete.h" \ |
| 60 | + --ignore-errors mismatch,unused,negative,corrupt \ |
| 61 | + --output-file $OUTPUT_NAME ) |
| 62 | + |
| 63 | +if [ "$CURRENT_UMF_DIR" != "$COMMON_UMF_DIR" ]; then |
| 64 | + sed -i "s#$CURRENT_UMF_DIR#$COMMON_UMF_DIR#g" $OUTPUT_NAME |
| 65 | +fi |
0 commit comments