15-Oct-2013: New tracer features for software testing

 1 year ago
source link: https://yurichev.com/blog/75/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
New tracer features for software testing

15-Oct-2013: New tracer features for software testing

For my software testers friends I added two features to my tracer.

* Pause

PAUSE:number: Make a pause in milliseconds. 1000 - one second. It is convinient for testing, for creating artifical delays. For example, it is important to know program's behaviour in very slow network environment:

tracer.exe -l:test1.exe bpf=WS2_32.dll!WSARecv,pause:1000

... or if it will read from some very slow storage:

tracer.exe -l:test1.exe bpf=kernel32.dll!ReadFile,pause:1000

* Probability

RT_PROBABILITY:number: Used with RT: option in pair, defines probability of RT triggering. For example, if RT:0 and RT_PROBABILITY:30% were set, 0 will be set instead of function's return value in 30% of cases. It's convenient for testing - good written program should handle errors correctly. For example, that's how we can simulate memory allocation errors, 1 malloc() call of 100 will return NULL:

tracer.exe -l:test1.exe bpf=msvcrt.dll!malloc,rt:0,rt_probability:1%

... in 10% of cases, the file will fail to open:

tracer.exe -l:test1.exe bpf=kernel32.dll!CreateFile,rt:0,rt_probability:10%

Probability may be set in usual manner, as a number in 0 (never) to 1 (always) interval. 10% is 0.1, 3% is 0.03, etc.

About ideas on errors also may be simulated, read here: Oracle RDBMS internal self-testing features.

→ [list of blog posts]

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK