NOTES.VALGRIND 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. NOTES FOR VALGRIND
  2. ==================
  3. Valgrind is a test harness that includes many tools such as memcheck,
  4. which is commonly used to check for memory leaks, etc. The default tool
  5. run by Valgrind is memcheck. There are other tools available, but this
  6. will focus on memcheck.
  7. Valgrind runs programs in a virtual machine, this means OpenSSL unit
  8. tests run under Valgrind will take longer than normal.
  9. Requirements
  10. ------------
  11. 1. Platform supported by Valgrind
  12. See: http://valgrind.org/info/platforms.html
  13. 2. Valgrind installed on the platform
  14. See: http://valgrind.org/downloads/current.html
  15. 3. OpensSSL compiled
  16. See: INSTALL
  17. Running Tests
  18. -------------
  19. Test behavior can be modified by adjusting environment variables.
  20. EXE_SHELL
  21. This variable is used to specify the shell used to execute OpenSSL test
  22. programs. The default wrapper (util/wrap.pl) initializes the environment
  23. to allow programs to find shared libraries. The variable can be modified
  24. to specify a different executable environment.
  25. EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q"
  26. This will start up Valgrind with the default checker (memcheck).
  27. The --error-exitcode=1 option specifies that Valgrind should exit with an
  28. error code of 1 when memory leaks occur.
  29. The --leak-check=full option specifies extensive memory checking.
  30. The -q option prints only error messages.
  31. Additional Valgrind options may be added to the EXE_SHELL variable.
  32. OPENSSL_ia32cap
  33. This variable controls the processor-specific code on Intel processors.
  34. By default, OpenSSL will attempt to figure out the capabilities of a
  35. processor, and use it to its fullest capability. This variable can be
  36. used to control what capabilities OpenSSL uses.
  37. As of valgrind-3.15.0 on Linux/x86_64, instructions up to AVX2 are
  38. supported. Setting the following disables instructions beyond AVX2:
  39. OPENSSL_ia32cap=":0"
  40. This variable may need to be set to something different based on the
  41. processor and Valgrind version you are running tests on. More information
  42. may be found in docs/man3/OPENSSL_ia32cap.pod.
  43. Additional variables (i.e. VERBOSE and TESTS) are described in the
  44. INSTALL file in the root of the OpenSSL source tree.
  45. Example command line:
  46. make test EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"
  47. If an error occurs, you can then run the specific test via the TESTS
  48. variable with the VERBOSE option to gather additional information.
  49. make test VERBOSE=1 TESTS=test_test EXE_SHELL="`/bin/pwd`/util/wrap.pl valgrind --error-exitcode=1 --leak-check=full -q" OPENSSL_ia32cap=":0"