|
Message-ID: <20110613022231.GA21480@openwall.com> Date: Mon, 13 Jun 2011 06:22:31 +0400 From: Solar Designer <solar@...nwall.com> To: musl@...ts.openwall.com Subject: specification of cluts tests - code or/and data? (was: Weekly reports - B) Luka, Rich - On Mon, Jun 13, 2011 at 06:11:30AM +0400, Solar Designer wrote: > Overall, I think the code could be made prettier. I'll post an idea > (which you don't have to use, but you may) in another message. Here's what I meant: Rather than write a piece of code for testing every property of every function, we could consider implementing interpreters or wrapper functions for common tests, or tables (arrays of structs) listing similar tests. A problem here is that call to a string function via a function pointer might not invoke the same implementation that direct use would (there could be a macro or a C compiler builtin). On the other hand, this also means that whatever approach to program structure we choose, we could want to test both kinds of uses of string functions (direct and via function pointer), to test both implementations (which might be present). This is not directly relevant, but to illustrate the use of interpreter or data structure approach to a task where most people tend to write lots of code instead, see: http://openwall.info/wiki/people/solar/software/public-domain-source-code/intel-80186-disassembler This is a complete i80186 disassembler in only 164 bytes of code, plus some 2.5 KB of data (17 KB source). Other disassemblers I saw typically process the different instruction types, addressing modes, etc. in code, and are much larger (in terms of code+data, as well as their source code). Maybe this will give you some inspiration for coming up with suitable data structures to define some classes of tests. You do not have to take it to the same "extreme" level - very generic code, data structures that are tricky to specify in C. You'll need to find a balance that works well for cluts. And you do not have to use an approach like this at all. You may continue as you have started. I just thought I'd mention the option. Maybe this helps. Alexander
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.