-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcoverage.sh
More file actions
executable file
·63 lines (53 loc) · 1.07 KB
/
coverage.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# OpenDMI: Cross-platform DMI/SMBIOS framework
# Copyright (c) 2025-2026, The OpenDMI contributors
#
# SPDX-License-Identifier: BSD-3-Clause
#
OSNAME=`uname -s`
LLVM_PROF=llvm-profdata
LLVM_COV=llvm-cov
if [ "${OSNAME}" == "Darwin" ]; then
LLVM_PROF="xcrun ${LLVM_PROF}"
LLVM_COV="xcrun ${LLVM_COV}"
fi
_missing_command() {
echo "Missing command. Use -h or --help for help" 1>&2
exit 1
}
_invalid_command() {
echo "Invalid command: $1. Use -h or --help for help" 1>&2
exit 1
}
_merge()
{
${LLVM_PROF} merge --sparse build/libopendmi/bin/*.profraw -o libopendmi.profdata
}
_show()
{
${LLVM_COV} show ./build/libopendmi/lib/libopendmi.dylib -instr-profile=libopendmi.profdata
}
_report()
{
${LLVM_COV} report build/libopendmi/lib/libopendmi.dylib -instr-profile=libopendmi.profdata
}
if [ $# -eq 0 ]; then
_missing_command
fi
COMMAND=$1
shift
case "${COMMAND}" in
merge)
_merge
;;
show)
_show
;;
report)
_report
;;
*)
_invalid_command ${COMMAND}
;;
esac