marker_file.h.in 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. #ifndef MARKER_FILE_H
  7. #define MARKER_FILE_H
  8. /// @file
  9. /// Define a marker file that is used in tests to prove that an "unload"
  10. /// function has been called
  11. namespace {
  12. const char* const LOAD_MARKER_FILE = "@abs_builddir@/load_marker.txt";
  13. const char* const UNLOAD_MARKER_FILE = "@abs_builddir@/unload_marker.txt";
  14. }
  15. namespace isc {
  16. namespace dhcp {
  17. namespace test {
  18. /// @brief Check marker file
  19. ///
  20. /// This function is used in some of the DHCP server tests.
  21. ///
  22. /// Marker files are used by the load/unload functions in the hooks
  23. /// libraries in these tests to signal whether they have been loaded or
  24. /// unloaded. The file (if present) contains a single line holding
  25. /// a set of characters.
  26. ///
  27. /// This convenience function checks the file to see if the characters
  28. /// are those expected.
  29. ///
  30. /// @param name Name of the marker file.
  31. /// @param expected Characters expected. If a marker file is present,
  32. /// it is expected to contain characters.
  33. ///
  34. /// @return true if all tests pass, false if not (in which case a failure
  35. /// will have been logged).
  36. bool
  37. checkMarkerFile(const char* name, const char* expected);
  38. /// @brief Check marker file exists
  39. ///
  40. /// This function is used in some of the DHCP server tests.
  41. ///
  42. /// Checkes that the specified file does NOT exist.
  43. ///
  44. /// @param name Name of the marker file.
  45. ///
  46. /// @return true if file exists, false if not.
  47. bool
  48. checkMarkerFileExists(const char* name);
  49. } // namespace test
  50. } // namespace dhcp
  51. } // namespace isc
  52. #endif // MARKER_FILE_H