How to disable optimization in sanitycheck


Ooi, Cinly
 

Dear All

Is there an option (or any instruction on how to modify the code) to disable all optimization in sanitycheck?

Purpose: When I was looking at the code coverage report generated by sanitycheck, there are signs that there may be optimization enabled, e.g., only the middle of three C statements was not covered and the program execution is linear. I was exploring command line option to disable optimization but cannot find any

Then I was not sure whether something was optimized away with "Z_SYSCALL_HANDLER(funcName);" statement, i.e. a syscall handler with empty body

Many thanks in advance
Cinly


Marc Herbert
 

You may need one extra level of quotation, see --extra-args CMAKE_C_FLAGS example and sanitycheck pointer in https://github.com/zephyrproject-rtos/zephyr/pull/14593/files "test/determinism.sh"
 
http://resources.mpi-inf.mpg.de/departments/rg1/teaching/unixffb-ss98/quoting-guide.html


alberto.piedras@...
 

> there are signs that there may be optimization enabled

 

Note that you can check the configuration sanitycheck used in the sanity-out folder,

for example for hello_world with native_posix the folder is:

sanity-out/native_posix/samples/hello_world/sample.helloworld/zephyr/.config

 

You can check there for CONFIG_NO_OPTIMIZATIONS=y

 

You also have the used make/ninja files there.

 

BR
Alberto

 

From: devel@... [mailto:devel@...] On Behalf Of Ooi, Cinly via Lists.Zephyrproject.Org
Sent: Thursday 21 March 2019 01:19
To: devel@...
Cc: devel@...
Subject: [Zephyr-devel] How to disable optimization in sanitycheck

 

Dear All

 

Is there an option (or any instruction on how to modify the code) to disable all optimization in sanitycheck?

 

Purpose: When I was looking at the code coverage report generated by sanitycheck, there are signs that there may be optimization enabled, e.g., only the middle of three C statements was not covered and the program execution is linear. I was exploring command line option to disable optimization but cannot find any

 

Then I was not sure whether something was optimized away with "Z_SYSCALL_HANDLER(funcName);" statement, i.e. a syscall handler with empty body

 

Many thanks in advance

Cinly