Skip to content

Commit

Permalink
refactor: checks for slow machines
Browse files Browse the repository at this point in the history
  • Loading branch information
Laateef committed Feb 12, 2024
1 parent 6592723 commit 4358341
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

Expand Down
8 changes: 4 additions & 4 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PROJECT_ICON =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = ../build/doc
OUTPUT_DIRECTORY = build/doc

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format
Expand Down Expand Up @@ -949,7 +949,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = ../include ../test
INPUT = include test

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -1054,7 +1054,7 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.

EXCLUDE = ../test/ntp/tools
EXCLUDE = test/ntp/tools

# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
Expand Down Expand Up @@ -1084,7 +1084,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH = ../demo
EXAMPLE_PATH = demo

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down
2 changes: 1 addition & 1 deletion test/ntp/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ TEST_SUITE("Client")
}) == 1);
}

TEST_CASE_FIXTURE(Context, "cancel queries concurrently" * doctest::timeout(5))
TEST_CASE_FIXTURE(Context, "cancel queries concurrently" * doctest::timeout(10))
{
std::vector<Server*> serverList { &server1, &server2, &server3, &server4, &server5 };
const size_t ServerCount = serverList.size();
Expand Down
4 changes: 2 additions & 2 deletions test/ntp/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ TEST_SUITE("Query")
TEST_CASE_FIXTURE(Context, "cancellable during query - multiple times" * doctest::timeout(1))
{
const auto& start = steady_clock::now();
server1.replay(nullptr, 0, milliseconds(200));
server1.replay(nullptr, 0, milliseconds(300));
const std::string& host = stringify(server1.endpoint());
auto query = Query::start(pool, host, queryTracer.callable());
CHECK(serverTracer1.wait() == 1);
Expand All @@ -198,7 +198,7 @@ TEST_SUITE("Query")
CHECK(query.expired());
CHECK(serverTracer1.counter() == 1);
CHECK(serverTracer1.wait(2) == 2);
CHECK(compare(start, milliseconds(200)));
CHECK(compare(start, milliseconds(300)));
}

TEST_CASE_FIXTURE(Context, "cancellable concurrently" * doctest::timeout(1))
Expand Down
6 changes: 5 additions & 1 deletion test/ntp/tools/helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
bool compare(const steady_clock::duration& actualDuration, const milliseconds& referenceDuration)
{
const auto diff = duration_cast<milliseconds>(actualDuration) - referenceDuration;
return milliseconds(-25) < diff && diff < milliseconds(175);
#ifdef __APPLE__
return milliseconds(-25) < diff && diff < milliseconds(275);
#else
return milliseconds(-25) < diff && diff < milliseconds(75);
#endif
}

bool compare(const steady_clock::time_point& start, const milliseconds& duration)
Expand Down
14 changes: 7 additions & 7 deletions test/ntp/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ TEST_SUITE("Tracer")
CHECK(t.wait(1, seconds(0)) == 1);
CHECK(compare(start, milliseconds(1)));
std::thread([&] {
std::this_thread::sleep_for(milliseconds(100));
std::this_thread::sleep_for(milliseconds(200));
t.callable()();
std::this_thread::sleep_for(milliseconds(100));
std::this_thread::sleep_for(milliseconds(300));
t.callable()();
}).detach();
CHECK(t.wait(2, milliseconds(50)) == 1);
CHECK(compare(start, milliseconds(50)));
CHECK(t.wait(3, milliseconds(100)) == 2);
CHECK(compare(start, milliseconds(150)));
CHECK(t.wait(3, milliseconds(100)) == 3);
CHECK(compare(start, milliseconds(200)));
CHECK(t.wait(3, milliseconds(200)) == 2);
CHECK(compare(start, milliseconds(250)));
CHECK(t.wait(3, milliseconds(300)) == 3);
CHECK(compare(start, milliseconds(500)));
}

TEST_CASE("parameterizable callbacks")
Expand Down Expand Up @@ -194,7 +194,7 @@ TEST_SUITE("Tracer")
}
}).detach();
}
CHECK(t.wait(count * multiplier) == count * multiplier);
CHECK(t.wait(count * multiplier, seconds(3)) == count * multiplier);
}

TEST_CASE("resetable")
Expand Down

0 comments on commit 4358341

Please sign in to comment.