README 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. How to add recipes
  2. ==================
  3. For any test that you want to perform, you write a script located in
  4. test/recipes/, named {nn}-test_{name}.t, where {nn} is a two digit number and
  5. {name} is a unique name of your choice.
  6. Please note that if a test involves a new testing executable, you will need to
  7. do some additions in test/Makefile. More on this later.
  8. Naming convetions
  9. =================
  10. A test executable is named test/{name}test.c
  11. A test recipe is named test/recipes/{nn}-test_{name}.t, where {nn} is a two
  12. digit number and {name} is a unique name of your choice.
  13. The number {nn} is (somewhat loosely) grouped as follows:
  14. 05 individual symmetric cipher algorithms
  15. 10 math (bignum)
  16. 15 individual asymmetric cipher algorithms
  17. 20 openssl enc
  18. 25 certificate forms, generation and verification
  19. 30 engine and evp
  20. 70 PACKET layer
  21. 80 "larger" protocols (CA, CMS, OCSP, SSL, TSA)
  22. 90 misc
  23. A recipe that just runs a test executable
  24. =========================================
  25. A script that just runs a program looks like this:
  26. #! /usr/bin/perl
  27. use OpenSSL::Test::Simple;
  28. simple_test("test_{name}", "{name}test", "{name}");
  29. {name} is the unique name you have chosen for your test.
  30. The second argument to `simple_test' is the test executable, and `simple_test'
  31. expects it to be located in test/
  32. For documentation on OpenSSL::Test::Simple, do
  33. `perldoc test/testlib/OpenSSL/Test/Simple.pm'.
  34. A recipe that runs a more complex test
  35. ======================================
  36. For more complex tests, you will need to read up on Test::More and
  37. OpenSSL::Test. Test::More is normally preinstalled, do `man Test::More' for
  38. documentation. For OpenSSL::Test, do `perldoc test/testlib/OpenSSL/Test.pm'.
  39. A script to start from could be this:
  40. #! /usr/bin/perl
  41. use strict;
  42. use warnings;
  43. use OpenSSL::Test;
  44. setup("test_{name}");
  45. plan tests => 2; # The number of tests being performed
  46. ok(test1, "test1");
  47. ok(test2, "test1");
  48. sub test1
  49. {
  50. # test feature 1
  51. }
  52. sub test2
  53. {
  54. # test feature 2
  55. }
  56. Changes to test/Makefile
  57. ========================
  58. Whenever a new test involves a new test executable you need to do the
  59. following (at all times, replace {NAME} and {name} with the name of your
  60. test):
  61. * among the variables for test executables at the beginning, add a line like
  62. this:
  63. {NAME}TEST= {name}test
  64. * add `$({NAME}TEST)$(EXE_EXT)' to the assignment of EXE:
  65. * add `$({NAME}TEST).o' to the assignment of OBJ:
  66. * add `$({NAME}TEST).c' to the assignment of SRC:
  67. * add the following lines for building the executable:
  68. $({NAME}TEST)$(EXE_EXT): $({NAME}TEST).o $(DLIBCRYPTO)
  69. @target=$({NAME}TEST); $(BUILD_CMD)