Function Capturing: Difference between revisions
No edit summary |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 20: | Line 20: | ||
By simply passing the new header file to the [[Build Tools|STRIDE Build Tools]] the captured function would become part of the [[Intercept Module]]. | By simply passing the new header file to the [[Build Tools|STRIDE Build Tools]] the captured function would become part of the [[Intercept Module]]. | ||
== Remoting == | |||
The simplest form of capturing (using [[scl_function]] with no additional arguments) would make a function exposed for external to the target use (remote calling). Such exposure provides a number of uses, among them is [[Perl_Script_Snippets#Invoking_a_function_on_the_target|fuxturing a test script]]. | |||
== Interception == | == Interception == | ||
A function could be captured for the purpose of interception. When intercepted it could be dynamically substituted to implement on-the-fly mocks, stubs, and doubles. The [[Using Test Doubles|Test Double]] article provides more details on the topic. | |||
[[Category: Source Instrumentation]] | [[Category: Source Instrumentation]] |
Latest revision as of 20:07, 1 June 2010
For a user function to be exposed to the STRIDE Test System it needs to be captured. Once made available it could be remoted or doubled.
Specification
By using the STRIDE special scl_function pragma any global function could be captured. For example to capture:
/* foo.h */
int foo(void);
create a new header file and add the following pragma statement:
/* foo_SCL.h */
#include "foo.h"
#ifdef _SCL
#pragma scl_function(foo)
#endif
By simply passing the new header file to the STRIDE Build Tools the captured function would become part of the Intercept Module.
Remoting
The simplest form of capturing (using scl_function with no additional arguments) would make a function exposed for external to the target use (remote calling). Such exposure provides a number of uses, among them is fuxturing a test script.
Interception
A function could be captured for the purpose of interception. When intercepted it could be dynamically substituted to implement on-the-fly mocks, stubs, and doubles. The Test Double article provides more details on the topic.