]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
build-perf-bisect: always do cleanup
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 30 Aug 2016 10:23:13 +0000 (13:23 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Thu, 6 Oct 2016 05:49:59 +0000 (08:49 +0300)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
build-perf-bisect.sh

index 6ad63a7a8e1c10a203bba051e35e33c8b70b59e8..b026cf93dc815af28fcfafaa52b638077da2eb29 100755 (executable)
@@ -141,6 +141,15 @@ do_sync () {
     sleep 2
 }
 
+cleanup () {
+    $cleanup_func "$@"
+}
+
+cleanup_default () {
+    cd $workdir
+    run_cmd rm -rf $builddir
+}
+
 
 #
 # TEST METHODS
@@ -154,10 +163,6 @@ buildtime () {
 
     result=`time_cmd bitbake $1` || exit 125
     result_h=`s_to_hms $result`
-
-    log "removing build directory"
-    cd $workdir
-    run_cmd rm -rf $builddir
 }
 
 tmpsize () {
@@ -171,10 +176,6 @@ tmpsize () {
 
     result=`du -s tmp* | cut -f1` || exit 255
     result_h=`kib_to_gib $result`
-
-    log "removing build directory"
-    cd $workdir
-    run_cmd rm -rf $builddir
 }
 
 esdktime () {
@@ -190,8 +191,9 @@ esdktime () {
 
     result=`time_cmd "${esdk_installer[-1]}" -y -d "esdk-deploy"` || exit 125
     result_h=`s_to_hms $result`
+}
 
-    log "removing deploy directories"
+cleanup_esdktime () {
     run_cmd rm -rf esdk-deploy tmp*
 }
 
@@ -203,10 +205,13 @@ parsetime () {
     result_h=`s_to_hms $result`
 }
 
+
 #
 # MAIN SCRIPT
 #
 build_target=$1
+cleanup_func=cleanup_default
+
 
 builddir="$workdir/build-$git_rev-$timestamp"
 case "$test_method" in
@@ -222,6 +227,7 @@ case "$test_method" in
         threshold=`hms_to_s $2`
         threshold_h=`s_to_hms $threshold`
         builddir="$workdir/build"
+        cleanup_func=cleanup_esdktime
         ;;
     parsetime)
         threshold=`hms_to_s $2`
@@ -233,6 +239,8 @@ case "$test_method" in
         exit 255
 esac
 
+trap cleanup EXIT
+
 
 #Initialize build environment
 mkdir -p $workdir