summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-dependencies.sh52
1 files changed, 39 insertions, 13 deletions
diff --git a/scripts/test-dependencies.sh b/scripts/test-dependencies.sh
index d3212c4f49..6ebfd3e4d6 100755
--- a/scripts/test-dependencies.sh
+++ b/scripts/test-dependencies.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/bash
2 2
3# Author: Martin Jansa <martin.jansa@gmail.com> 3# Author: Martin Jansa <martin.jansa@gmail.com>
4# 4#
@@ -6,7 +6,7 @@
6 6
7# Used to detect missing dependencies or automagically 7# Used to detect missing dependencies or automagically
8# enabled dependencies which aren't explicitly enabled 8# enabled dependencies which aren't explicitly enabled
9# or disabled. 9# or disabled. Using bash to have PIPESTATUS variable.
10 10
11# It does 3 builds of <target> 11# It does 3 builds of <target>
12# 1st to populate sstate-cache directory and sysroot 12# 1st to populate sstate-cache directory and sysroot
@@ -131,6 +131,7 @@ done
131echo "$buildtype" | grep -v '^[1234c ]*$' && echo_error "Invalid buildtype \"$buildtype\", only some combination of 1, 2, 3, 4, c separated by space is allowed" 131echo "$buildtype" | grep -v '^[1234c ]*$' && echo_error "Invalid buildtype \"$buildtype\", only some combination of 1, 2, 3, 4, c separated by space is allowed"
132 132
133OUTPUT_BASE=test-dependencies/`date "+%s"` 133OUTPUT_BASE=test-dependencies/`date "+%s"`
134declare -i RESULT=0
134 135
135build_all() { 136build_all() {
136 echo "===== 1st build to populate sstate-cache directory and sysroot =====" 137 echo "===== 1st build to populate sstate-cache directory and sysroot ====="
@@ -138,6 +139,9 @@ build_all() {
138 mkdir -p ${OUTPUT1} 139 mkdir -p ${OUTPUT1}
139 echo "Logs will be stored in ${OUTPUT1} directory" 140 echo "Logs will be stored in ${OUTPUT1} directory"
140 bitbake -k $targets 2>&1 | tee -a ${OUTPUT1}/complete.log 141 bitbake -k $targets 2>&1 | tee -a ${OUTPUT1}/complete.log
142 RESULT+=${PIPESTATUS[0]}
143 grep "ERROR: Task.*failed" ${OUTPUT1}/complete.log > ${OUTPUT1}/failed-tasks.log
144 cat ${OUTPUT1}/failed-tasks.log | sed 's@.*/@@g; s@_.*@@g; s@\..*@@g' | sort -u > ${OUTPUT1}/failed-recipes.log
141} 145}
142 146
143build_every_recipe() { 147build_every_recipe() {
@@ -162,12 +166,24 @@ build_every_recipe() {
162 rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null 166 rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null
163 fi 167 fi
164 i=1 168 i=1
165 count=`cat $recipes | wc -l` 169 count=`cat $recipes ${OUTPUT1}/failed-recipes.log | sort -u | wc -l`
166 for recipe in `cat $recipes`; do 170 for recipe in `cat $recipes ${OUTPUT1}/failed-recipes.log | sort -u`; do
167 echo "Building recipe: ${recipe} ($i/$count)" 171 echo "Building recipe: ${recipe} ($i/$count)"
168 bitbake -c cleansstate ${recipe} > ${OUTPUTB}/log.${recipe} 2>&1; 172 declare -i RECIPE_RESULT=0
169 bitbake ${recipe} >> ${OUTPUTB}/log.${recipe} 2>&1; 173 bitbake -c cleansstate ${recipe} > ${OUTPUTB}/${recipe}.log 2>&1;
170 grep "ERROR: Task.*failed" ${OUTPUTB}/log.${recipe} && mv ${OUTPUTB}/log.${recipe} ${OUTPUTB}/failed/${recipe} || mv ${OUTPUTB}/log.${recipe} ${OUTPUTB}/ok/${recipe} 174 RECIPE_RESULT+=$?
175 bitbake ${recipe} >> ${OUTPUTB}/${recipe}.log 2>&1;
176 RECIPE_RESULT+=$?
177 if [ "${RECIPE_RESULT}" != "0" ] ; then
178 RESULT+=${RECIPE_RESULT}
179 mv ${OUTPUTB}/${recipe}.log ${OUTPUTB}/failed/
180 grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | tee -a ${OUTPUTB}/failed-tasks.log
181 grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | sed 's@.*/@@g; s@_.*@@g; s@\..*@@g' >> ${OUTPUTB}/failed-recipes.log
182 # and append also ${recipe} in case the failed task was from some dependency
183 echo ${recipe} >> ${OUTPUTB}/failed-recipes.log
184 else
185 mv ${OUTPUTB}/${recipe}.log ${OUTPUTB}/ok/
186 fi
171 if [ "${TYPE}" != "2" ] ; then 187 if [ "${TYPE}" != "2" ] ; then
172 rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null 188 rm -rf $tmpdir/deploy $tmpdir/pkgdata $tmpdir/sstate-control $tmpdir/stamps $tmpdir/sysroots $tmpdir/work $tmpdir/work-shared 2>/dev/null
173 fi 189 fi
@@ -184,8 +200,6 @@ build_every_recipe() {
184 dest=`echo $f | sed "s#$tmpdir/work/##g; s#/#_#g"` 200 dest=`echo $f | sed "s#$tmpdir/work/##g; s#/#_#g"`
185 cp $f ${OUTPUTB}/do_package/$dest 201 cp $f ${OUTPUTB}/do_package/$dest
186 done 202 done
187 grep "ERROR: Task.*failed" ${OUTPUTB}/failed/* 2>/dev/null
188 ls -1 ${OUTPUTB}/failed/* >> ${OUTPUT_BASE}/failed.recipes 2>/dev/null
189} 203}
190 204
191compare_deps() { 205compare_deps() {
@@ -209,8 +223,10 @@ compare_deps() {
209 find ${OUTPUT_MAX}/packages/ -name latest | sed "s#${OUTPUT_MAX}/##g" | while read pkg; do 223 find ${OUTPUT_MAX}/packages/ -name latest | sed "s#${OUTPUT_MAX}/##g" | while read pkg; do
210 max_pkg=${OUTPUT_MAX}/${pkg} 224 max_pkg=${OUTPUT_MAX}/${pkg}
211 min_pkg=${OUTPUT_MIN}/${pkg} 225 min_pkg=${OUTPUT_MIN}/${pkg}
226 recipe=`echo "${pkg}" | sed 's#/.*##g'`
212 if [ ! -f "${min_pkg}" ] ; then 227 if [ ! -f "${min_pkg}" ] ; then
213 echo "ERROR: ${min_pkg} doesn't exist" | tee -a ${OUTPUT_FILE} 228 echo "ERROR: ${min_pkg} doesn't exist" | tee -a ${OUTPUT_FILE}
229 echo ${recipe} >> ${OUTPUTC}/failed-recipes.log
214 continue 230 continue
215 fi 231 fi
216 # strip version information in parenthesis 232 # strip version information in parenthesis
@@ -231,17 +247,18 @@ compare_deps() {
231 if [ -n "${missing_deps}" ] ; then 247 if [ -n "${missing_deps}" ] ; then
232 echo # to get rid of dots on last line 248 echo # to get rid of dots on last line
233 echo "WARN: ${pkg} lost dependency on ${missing_deps}" | tee -a ${OUTPUT_FILE} 249 echo "WARN: ${pkg} lost dependency on ${missing_deps}" | tee -a ${OUTPUT_FILE}
250 echo ${recipe} >> ${OUTPUTC}/failed-recipes.log
234 fi 251 fi
235 fi 252 fi
236 i=`expr $i + 1` 253 i=`expr $i + 1`
237 done 254 done
238 echo # to get rid of dots on last line 255 echo # to get rid of dots on last line
239 echo "Found differences: " 256 echo "Found differences: "
240 grep "^WARN: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.warn 257 grep "^WARN: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.warn.log
241 echo "Found errors: " 258 echo "Found errors: "
242 grep "^ERROR: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.error 259 grep "^ERROR: " ${OUTPUT_FILE} | tee ${OUTPUT_FILE}.error.log
243 # useful for reexecuting this script with only small subset of recipes with known issues 260 RESULT+=`cat ${OUTPUT_FILE}.warn.log | wc -l`
244 sed 's#.*[ /]packages/\([^/]*\)/\([^/]*\)/.*#\2#g' ${OUTPUT_FILE}.warn ${OUTPUT_FILE}.error | sort -u >> ${OUTPUT_BASE}/failed.recipes 261 RESULT+=`cat ${OUTPUT_FILE}.error.log | wc -l`
245} 262}
246 263
247for TYPE in $buildtype; do 264for TYPE in $buildtype; do
@@ -254,3 +271,12 @@ for TYPE in $buildtype; do
254 *) echo_error "Invalid buildtype \"$TYPE\"" 271 *) echo_error "Invalid buildtype \"$TYPE\""
255 esac 272 esac
256done 273done
274
275cat ${OUTPUT_BASE}/*/failed-recipes.log | sort -u > ${OUTPUT_BASE}/failed-recipes.log
276
277if [ "${RESULT}" != "0" ] ; then
278 echo "ERROR: ${RESULT} issues were found in these recipes: `cat ${OUTPUT_BASE}/failed-recipes.log | xargs`"
279fi
280
281echo "INFO: Output written in: ${OUTPUT_BASE}"
282exit ${RESULT}