Automatic code testing in c upon execution
each source file has a function:
unsigned char test(){
//return true if tests succceed false otherwise
}
Everytime the sourcefile gets recompiled I want the test function of that file to be run on execution of the executable and if the tests return false to halt. However, I want only code whose test code hasnt been run since build.
I was thinking that I could use the makefile system to help with this problem since makefiles will only recompile changed code which is exactly what i want. Therefore, I was thinking of adding something to the command line arguments. I saw an example in which they used echo and date to add a time last modified. The code would write the time last modified to a save file on a successful execution of the test code with which it will compare to the next time.
Is there a better way? One that doesnt rely on make? At the least is there a way without relying on spefic unix commands? Lastly, even if that isnt possible, what would the command line to do the addition to the file look like.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论