Skip to contentSkip to conversation

scripts/yocto-compat-layer.py: Return non-zero when layer test fail

PATCH New Aníbal Limón 1 participant 2 messages Jun 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/yocto-compat-layer.py: Return non-zero when layer test fail

If whatever layer tested fails returns 2 to indicate the failure.

[YOCTO #11482]

---
 scripts/yocto-compat-layer.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/yocto-compat-layer.py +4 -1
index 0d5700b..30c55a9 100755
@@ -178,16 +178,19 @@ def main():
         results_status[layer['name']] = 'PASS' if results[layer['name']].wasSuccessful() else 'FAIL'
         layers_tested = layers_tested + 1
 
+    ret = 0
     if layers_tested:
         logger.info('')
         logger.info('Summary of results:')
         logger.info('')
         for layer_name in results_status:
             logger.info('%s ... %s' % (layer_name, results_status[layer_name]))
+            if not results[layer_name].wasSuccessful():
+                ret = 2 # ret = 1 used for initialization errors
 
     cleanup_bblayers(None, None)
 
-    return 0
+    return ret
 
 if __name__ == '__main__':
     try:
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 scripts/yocto-compat-layer-wrapper: Use realpath of output_log

We are using a temp directory, use the realpath for output log to store the results in the original BUILDDIR.

[YOCTO #11571]

---
 scripts/yocto-compat-layer-wrapper | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
scripts/yocto-compat-layer-wrapper +17 -1
index db4b687..b6baeb4 100755
@@ -13,13 +13,29 @@ if [ -z "$BUILDDIR" ]; then
 	exit 2
 fi
 
+# since we are using a temp directory, use the realpath for output
+# log option
+output_log=''
+while getopts o: name
+do
+	case $name in
+	o) output_log=$(realpath "$OPTARG")
+	esac
+done
+shift $(($OPTIND - 1))
+
+# generate a temp directory to run compat layer script
 base_dir=$(realpath $BUILDDIR/../)
 cd $base_dir
 
 build_dir=$(mktemp -p $base_dir -d -t build-XXXX)
 
 source oe-init-build-env $build_dir
-yocto-compat-layer.py "$@"
+if [[ $output_log != '' ]]; then
+	yocto-compat-layer.py -o "$output_log" "$*"
+else
+	yocto-compat-layer.py "$@"
+fi
 retcode=$?
 
 rm -rf $build_dir
Signature · 1 line
2.1.4