summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJiajun Xu <jiajun.xu@intel.com>2012-05-18 17:18:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-18 15:25:11 +0100
commit3e57b1d7494ac649c08692182aa522113926ccce (patch)
tree537d7e5b422500b03dce213ee4a788ecd1d002ce /scripts
parentf3c07ace4b8a41c3ee265ab257c1ad1cb8ee656b (diff)
downloadpoky-3e57b1d7494ac649c08692182aa522113926ccce.tar.gz
test-reexec: Add script to address issues when task re-execution
The script is used to address build issues when tasks of different recipes are re-executed. The script goes through all available recipes and their tasks. The test results are saved in ./reexeclogs. Force build logs are saved with prefix "force". Build failure logs are saved with prefix "failed". [YOCTO #2123] (From OE-Core rev: 6258a11f22103d68d02e329c2e7fb198202cc6ef) Signed-off-by: Jiajun Xu <jiajun.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-reexec123
1 files changed, 123 insertions, 0 deletions
diff --git a/scripts/test-reexec b/scripts/test-reexec
new file mode 100755
index 0000000000..9eaa96e754
--- /dev/null
+++ b/scripts/test-reexec
@@ -0,0 +1,123 @@
1#!/bin/bash
2
3# Test Script for task re-execution
4#
5# Copyright 2012 Intel Corporation
6# All rights reserved.
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21#
22# DESCRIPTION
23# This script is intended to address issues for re-execution of
24# tasks. The test results are saved in ./reexeclogs. Force build
25# logs are saved with prefix "force". Build failure logs are saved with
26# prefix "failed". Log files with prefix "initial" are used to save
27# initial build logs for each recipe. Log files with prefix "clean" are
28# used to save logs of clean task after testing for a recipe is finished.
29#
30
31targets=`bitbake -s | cut -d " " -f 1`
32
33LOGS=./reexeclogs
34
35mkdir -p $LOGS
36
37# Clear sstate files for specified recipe
38function clearsstate {
39 target=$1
40
41 sstate_dir=`bitbake $target -e | grep "^SSTATE_DIR" | cut -d "\"" -f 2`
42 sstate_pkgspec=`bitbake $target -e | grep "^SSTATE_PKGSPEC" | cut -d "\"" -f 2`
43 sstasks=`bitbake $target -e | grep "^SSTATETASKS" | cut -d "\"" -f 2`
44
45 for sstask in $sstasks
46 do
47 sstask=${sstask:3}
48 case $sstask in
49 populate_sysroot) sstask="populate-sysroot"
50 ;;
51 populate_lic) sstask="populate-lic"
52 ;;
53 package_write_ipk) sstask="deploy-ipk"
54 ;;
55 package_write_deb) sstask="deploy-deb"
56 ;;
57 package_write_rpm) sstask="deploy-rpm"
58 ;;
59 package) sstask="package"
60 ;;
61 deploy) sstask="deploy"
62 ;;
63 *)
64 ;;
65 esac
66
67 echo "Removing ${sstate_dir}/${sstate_pkgspec}*_${sstask}.tgz* for $target"
68 rm -rf ${sstate_dir}/${sstate_pkgspec}*_${sstask}.tgz*
69 done
70}
71
72# Function to re-execute specified task of recipe
73function testit {
74 target=$1
75 task=$2
76
77 task=`echo $task | sed 's/_setscene//'`
78
79 if [ -f $LOGS/force.$target.$task ]; then
80 return
81 fi
82
83 case $task in
84 clean|build|cleansstate|cleanall|package|cleansstate2|package_write|package_write_ipk|package_write_rpm|package_write_deb|fetch|populate_lic) return;;
85 fetchall|devshell|buildall|listtasks|checkuri|checkuriall) return;;
86 esac
87
88 echo "Attempting target $target, task $task"
89 echo "Initial build"
90 bitbake $target -c cleansstate > $LOGS/initial.$target.$task
91 bitbake $target >> $LOGS/initial.$target.$task
92 clearsstate $target >> $LOGS/initial.$target.$task
93 echo "Re-execution build"
94 bitbake $target -c $task -f > $LOGS/force.$target.$task
95 if [ "$?" != 0 ]; then
96 echo "FAILURE for $target $task"
97 cp $LOGS/force.$target.$task $LOGS/failed.$target.$task
98 bitbake $target -c clean > $LOGS/clean.$target.$task
99 else
100 bitbake $target >> $LOGS/force.$target.$task
101 if [ "$?" != 0 ]; then
102 echo "FAILURE2 for $target $task"
103 cp $LOGS/force.$target.$task $LOGS/failed.$target.$task
104 bitbake $target -c clean > $LOGS/clean.$target.$task
105 fi
106 fi
107 echo "Done"
108}
109
110# Go through the recipe list and these recipes' task list
111# Then re-execute them
112for target in $targets; do
113 # Remove log messages from bitbake output
114 case $target in
115 Summary*|WARNING*|Loading*|Loaded*|Package*|=====*) continue;;
116 esac
117 tasks=`bitbake $target -c listtasks | grep ^do_ | sed s/do_//`
118 for task in $tasks; do
119 testit $target $task
120 done
121done
122
123