Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← 05-08 Testing Fault Injection

05-08 Testing Fault Injection

Get Embed Code
1 Language

Showing Revision 2 created 07/16/2014 by Udacity Robot.

  1. This is what we got this time--so we can see is that our fault injection version of read
  2. is indeed reading less bytes than the full number of bytes we asked for
  3. and what you can see is the first time it's called, you get the range from 1-3121,
  4. so it's going to pick something in the middle usually, but then success of read calls have a narrow,
  5. narrow range of random numbers that can return and so that's what explains this kind of
  6. progressional numbers, that's what explains this sort of progression of numbers
  7. towards smaller numbers, and so there should be a 100 of these little sequences
  8. due to fact that we let the test loop 100 times.
  9. So the question we can ask is, is our confidence in the software now are higher.
  10. Well, probably there are other tests we should do--like one thing
  11. we could do is use a read fault injection function.
  12. Instead of being random just reads 1 byte every time--
  13. that might end up being a reasonable stress test.
  14. Another thing we might do is simulate random end of file conditions
  15. when random errors that read is allowed to return.
  16. So during our testing, the read system call never actually returned an error value.
  17. It always read the file successful, but if we want to use fault injection to make it do that,
  18. then we have to modify our program a little but, but I'm not going to do that right now.
  19. In the meantime, I think we've established that the logic here is fairly solid.
  20. It can do with a wide variety of conditions and one thing we might want to do just before
  21. our leaving is out of the 1,000,000 times instead of 100 times.
  22. Okay, so we compile with optimizations, we run it, it's running a 1,000,000 iterations
  23. of the test sequence, so it's doing a 1,000,000 iterations of this little sequence here,
  24. and let's see how long this takes, hopefully, it's not very long.
  25. Okay, there we go--it took like 15 or 20 seconds, so that was a
  26. little bit painful but not that bad overall.
  27. And so the question is now do we have reasonable confidence that our logic is solid
  28. and except for the error handling condition that we talked about, I would say that this is
  29. probably pretty solid--this is probably pretty solid code now.