-
Notifications
You must be signed in to change notification settings - Fork 50
/
validate
executable file
·129 lines (104 loc) · 4.24 KB
/
validate
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
cd $(dirname ${0})
#######################################################################################################################
# check arguments
PLATFORM=$1
PACKAGE=$2
if [ -z "${PLATFORM}" ] || [ -z "${PACKAGE}" ] || [ ! -e "plugins-dep/configs/${PLATFORM}_defconfig" ]; then
echo "Usage: $0 <platform> <plugin-package-name>"
echo " Where platform can be one of: $(echo $(ls plugins-dep/configs | grep _defconfig | sed 's/_defconfig//g' | sort))"
echo " and plugin-package-name is a folder inside ./plugins/package"
exit 1
fi
#######################################################################################################################
# Import common code and variables
source .common
#######################################################################################################################
# Check if requested plugin package exists
PACKAGE=$(basename ${PACKAGE} | sed "s|\.mk||")
PKGNAME=$(echo ${PACKAGE} | tr a-z- A-Z_)
if [ ! -d ${SOURCE_DIR}/plugins/package/${PACKAGE} ]; then
error "Plugin package name '${PACKAGE}' does not exist"
exit 1
fi
if [ ! -f ${SOURCE_DIR}/plugins/package/${PACKAGE}/${PACKAGE}.mk ]; then
error "Requested plugin package has no 'mk' file"
exit 1
fi
bundles=($(cat ${SOURCE_DIR}/plugins/package/${PACKAGE}/${PACKAGE}.mk | awk 'sub("'${PKGNAME}'_BUNDLES = ","")'))
if [[ "${bundles}" == "" ]]; then
error "Requested plugin package has no bundles"
exit 1
fi
#######################################################################################################################
# Check if plugin path exists
PLUGIN_PATH="${WORKDIR}/${PLATFORM}/plugins"
if [ ! -e "${PLUGIN_PATH}" ]; then
error "Failed to find plugin installed bundles"
exit 1
fi
#######################################################################################################################
# check if all bundles are present
function bundle_has_binaries
{
if find "$1" -name "*.so" >/dev/null; then
return 0
else
return 1
fi
}
for bundle in ${bundles[@]}; do
if [ ! -d ${PLUGIN_PATH}/${bundle} ]; then
error "Failed to find plugin installed bundles"
exit 1
fi
if ! bundle_has_binaries ${PLUGIN_PATH}/${bundle}; then
error "Failed to find plugin installed bundles"
exit 1
fi
done
#######################################################################################################################
# copy requested bundle to sandbox
rm -rf /tmp/mpb-plugin-check
mkdir /tmp/mpb-plugin-check
for bundle in ${bundles[@]}; do
cp -r "${PLUGIN_PATH}/${bundle}" /tmp/mpb-plugin-check/
done
BINDIR="${WORKDIR}/${PLATFORM}/target/usr/bin"
LIBDIR="${WORKDIR}/${PLATFORM}/target/usr/lib"
export LV2_PATH=/tmp/mpb-plugin-check
for bundle in ${bundles[@]}; do
echo "Checking ${bundle}..."
"${BINDIR}/lv2_validate" \
"${LIBDIR}/lv2/kx-*/*.ttl" \
"${LIBDIR}/lv2/mod.lv2/*.ttl" \
"${LIBDIR}/lv2/modgui.lv2/*.ttl" \
"${LIBDIR}/lv2/mod-hmi.lv2/*.ttl" \
"${LIBDIR}/lv2/mod-license.lv2/*.ttl" \
"/tmp/mpb-plugin-check/${bundle}/*.ttl"
done
# plugin list
plugins=($(lv2ls | tr -d '\r'))
echo "Found ${#plugins[@]} plugin(s)"
# real host test, if possible
if [ -e "${LIBDIR}/carla/carla-bridge-native" ]; then
export CARLA_BRIDGE_DUMMY=1
export CARLA_BRIDGE_TESTING=native
export VALGRIND_LIB="${LIBDIR}exec/valgrind"
for plugin in ${plugins[@]}; do
if [ -n "${VALGRIND}" ]; then
echo "Valgrind check ${plugin}..."
"${LIBDIR}/ld-linux-x86-64.so.2" --library-path "${LIBDIR}" \
"${BINDIR}/valgrind" \
--leak-check=full --track-origins=yes --keep-debuginfo=yes --suppressions=plugins-dep/valgrind-libdl.supp \
"${LIBDIR}/carla/carla-bridge-native" lv2 "" "${plugin}" 1>/dev/null
else
echo -n "Verifying ${plugin}... "
"${LIBDIR}/ld-linux-x86-64.so.2" --library-path "${LIBDIR}" \
"${LIBDIR}/carla/carla-bridge-native" lv2 "" "${plugin}" 1>/dev/null
echo "ok"
fi
done
fi
rm -rf /tmp/mpb-plugin-check
#######################################################################################################################