|
@@ -1,7 +1,7 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
set -e
|
|
set -e
|
|
clear
|
|
clear
|
|
-cd $(dirname $0)
|
|
|
|
|
|
+cd "$(dirname "$0")"
|
|
|
|
|
|
compiler="gcc"
|
|
compiler="gcc"
|
|
if [ -e compiler ]; then
|
|
if [ -e compiler ]; then
|
|
@@ -126,7 +126,7 @@ buildProfile() {
|
|
folder=$1
|
|
folder=$1
|
|
shift 1
|
|
shift 1
|
|
if [ ! -e "$folder" ]; then
|
|
if [ ! -e "$folder" ]; then
|
|
- cmake -B "$folder" -S . -G Ninja -DCMAKE_C_COMPILER=${compiler} -DCMAKE_INSTALL_PREFIX=../install $@
|
|
|
|
|
|
+ cmake -B "$folder" -S . -G Ninja -DCMAKE_C_COMPILER="${compiler}" -DCMAKE_INSTALL_PREFIX=../install "$@"
|
|
fi
|
|
fi
|
|
ninja -C "$folder"
|
|
ninja -C "$folder"
|
|
}
|
|
}
|
|
@@ -174,8 +174,8 @@ if $performance; then
|
|
if $stats; then
|
|
if $stats; then
|
|
user=$(whoami)
|
|
user=$(whoami)
|
|
sudo perf record ./performance
|
|
sudo perf record ./performance
|
|
- sudo chown $user:$user perf.data
|
|
|
|
- sudo chown $user:$user default.profraw
|
|
|
|
|
|
+ sudo chown "$user:$user" perf.data
|
|
|
|
+ sudo chown "$user:$user" default.profraw
|
|
perf report
|
|
perf report
|
|
else
|
|
else
|
|
./performance
|
|
./performance
|
|
@@ -183,7 +183,7 @@ if $performance; then
|
|
cd ..
|
|
cd ..
|
|
fi
|
|
fi
|
|
if $time; then
|
|
if $time; then
|
|
- lines=$(cat build_release/.ninja_log | grep "^[0-9]")
|
|
|
|
|
|
+ lines=$(grep "^[0-9]" "build_release/.ninja_log")
|
|
|
|
|
|
startMillis=0
|
|
startMillis=0
|
|
endMillis=0
|
|
endMillis=0
|
|
@@ -197,12 +197,12 @@ if $time; then
|
|
endMillis=$arg
|
|
endMillis=$arg
|
|
elif [ $i == 3 ]; then
|
|
elif [ $i == 3 ]; then
|
|
name=$arg
|
|
name=$arg
|
|
- diff=$(expr $endMillis - $startMillis)
|
|
|
|
|
|
+ diff=$((endMillis - startMillis))
|
|
output="${output}\n$diff $name"
|
|
output="${output}\n$diff $name"
|
|
fi
|
|
fi
|
|
- i=$(expr $(expr $i + 1) % 5) && true
|
|
|
|
|
|
+ i=$(($((i + 1)) % 5))
|
|
done
|
|
done
|
|
- printf "$output" | sort -n
|
|
|
|
|
|
+ echo -e "$output" | sort -n
|
|
fi
|
|
fi
|
|
|
|
|
|
generateCoverageFunctions() {
|
|
generateCoverageFunctions() {
|
|
@@ -210,18 +210,18 @@ generateCoverageFunctions() {
|
|
ignore=$(cat ./ignoredCoverageFunctions)
|
|
ignore=$(cat ./ignoredCoverageFunctions)
|
|
list=$(nm ./build_debug/libcore.a -j | grep "^[a-zA-Z]")
|
|
list=$(nm ./build_debug/libcore.a -j | grep "^[a-zA-Z]")
|
|
for file in $ignore; do
|
|
for file in $ignore; do
|
|
- list=$(echo "$list" | grep -v $file)
|
|
|
|
|
|
+ list=$(echo "$list" | grep -v "$file")
|
|
done
|
|
done
|
|
echo "$list" | sed 's/^/allowlist_fun:/g' > build_debug/coverageFunctions
|
|
echo "$list" | sed 's/^/allowlist_fun:/g' > build_debug/coverageFunctions
|
|
}
|
|
}
|
|
|
|
|
|
if $coverage; then
|
|
if $coverage; then
|
|
- if [ $compiler = "gcc" ]; then
|
|
|
|
|
|
+ if [ "$compiler" = "gcc" ]; then
|
|
gcovr -r . build_debug -e test -e performance \
|
|
gcovr -r . build_debug -e test -e performance \
|
|
--exclude-lines-by-pattern ".*CoverageIgnore.*"
|
|
--exclude-lines-by-pattern ".*CoverageIgnore.*"
|
|
else
|
|
else
|
|
- files=$(find build_debug -name *.profraw)
|
|
|
|
- llvm-profdata-17 merge -sparse $files -o build_debug/default.profdata
|
|
|
|
|
|
+ mapfile -t files < <(find build_debug -name "*.profraw")
|
|
|
|
+ llvm-profdata-17 merge -sparse "${files[@]}" -o build_debug/default.profdata
|
|
generateCoverageFunctions
|
|
generateCoverageFunctions
|
|
llvm-cov-17 show ./build_debug/test -instr-profile=build_debug/default.profdata --ignore-filename-regex="test/" -line-coverage-lt=100 --name-allowlist=build_debug/coverageFunctions
|
|
llvm-cov-17 show ./build_debug/test -instr-profile=build_debug/default.profdata --ignore-filename-regex="test/" -line-coverage-lt=100 --name-allowlist=build_debug/coverageFunctions
|
|
fi
|
|
fi
|