diff options
Diffstat (limited to 'src/bin/dhcp4/tests/marker_file.h.in')
-rw-r--r-- | src/bin/dhcp4/tests/marker_file.h.in | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/bin/dhcp4/tests/marker_file.h.in b/src/bin/dhcp4/tests/marker_file.h.in new file mode 100644 index 0000000..06f60d8 --- /dev/null +++ b/src/bin/dhcp4/tests/marker_file.h.in @@ -0,0 +1,62 @@ +// Copyright (C) 2013-2018 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef MARKER_FILE_H +#define MARKER_FILE_H + +/// @file +/// Define a marker file that is used in tests to prove that an "unload" +/// function has been called + +namespace { +const char* const LOAD_MARKER_FILE = "@abs_builddir@/load_marker.txt"; +const char* const UNLOAD_MARKER_FILE = "@abs_builddir@/unload_marker.txt"; +const char* const SRV_CONFIG_MARKER_FILE = "@abs_builddir@/srv_config_marker_file.txt"; +} + +namespace isc { +namespace dhcp { +namespace test { + +/// @brief Check marker file +/// +/// This function is used in some of the DHCP server tests. +/// +/// Marker files are used by the load/unload functions in the hooks +/// libraries in these tests to signal whether they have been loaded or +/// unloaded. The file (if present) contains a single line holding +/// a set of characters. +/// +/// This convenience function checks the file to see if the characters +/// are those expected. +/// +/// @param name Name of the marker file. +/// @param expected Characters expected. If a marker file is present, +/// it is expected to contain characters. +/// +/// @return true if all tests pass, false if not (in which case a failure +/// will have been logged). +bool +checkMarkerFile(const char* name, const char* expected); + +/// @brief Check marker file exists +/// +/// This function is used in some of the DHCP server tests. +/// +/// Checks that the specified file does NOT exist. +/// +/// @param name Name of the marker file. +/// +/// @return true if file exists, false if not. +bool +checkMarkerFileExists(const char* name); + +} // namespace test +} // namespace dhcp +} // namespace isc + +#endif // MARKER_FILE_H + |