Patchwork fix march sanity check issue

login
register
mail settings
Submitter Zhenhua Luo
Date March 20, 2013, 7:52 a.m.
Message ID <1363765932-17501-1-git-send-email-zhenhua.luo@freescale.com>
Download mbox | patch
Permalink /patch/46531/
State Accepted
Commit 4a4228fe250c8b23a5deeb25825d61c6e84a47a2
Headers show

Comments

Zhenhua Luo - March 20, 2013, 7:52 a.m.
1. check if gcc_test is really generate before os.remove("gcc_test") to avoid
   following error:
      ERROR: Execution of event handler 'check_sanity_eventhandler' failed
      Traceback (most recent call last):
      File "check_sanity_eventhandler(e)", line 4, in check_sanity_eventhandler(e=<bb.event.ConfigParsed object at 0x3151450>)
      File "sanity.bbclass", line 107, in check_sanity(sanity_data=<bb.data_smart.DataSmart object at 0x11ba110>)
      File "sanity.bbclass", line 22, in check_gcc_march(sanity_data=<bb.data_smart.DataSmart object at 0x11ba110>)
      OSError: [Errno 2] No such file or directory: 'gcc_test'
2. set result to False when build failed with -march=native to ensure 
   -march=native is appended to BUILD_CFLAGS  when host gcc really supports this flag, 
   otherwise following error appears when build native packages.
      | cap_text.c:1: error: bad value (native) for -march= switch
      | cap_text.c:1: error: bad value (native) for -mtune= switch

Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
---
 meta/classes/sanity.bbclass |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 8cdb06e..ecc0a43 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -327,11 +327,14 @@  def check_gcc_march(sanity_data):
         if status != 0:
             # Check if GCC could work with march
             status,result = commands.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
-            if status == 0:
-                result =  True
+            if status == 0: 
+                result = True
+            else:
+                result = False
 
         os.remove("gcc_test.c")
-        os.remove("gcc_test")
+        if os.path.exists("gcc_test"):
+            os.remove("gcc_test")
 
     return result