summaryrefslogtreecommitdiffstats
path: root/src/bin/dhcp4/tests/marker_file.h.in
blob: 06f60d85ae802829e13f081304c79eee49bf6149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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