summaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-18 07:20:18 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-05-18 07:20:18 +0000
commit714346ca5e18851c784101537bcb9b0877d413a9 (patch)
tree121764ca0af5de204005d6b16d00a867f07fc5d8 /staging_vespalib/src/tests
parentf05f60b1ec40be6f3e60349d65da60bc41555db3 (diff)
Move ScheduledExecutor to searchcore and drop fnet dependency in staging_vespalib in order to prepare collapsing stagingg vespalib into vespalib
Diffstat (limited to 'staging_vespalib/src/tests')
-rw-r--r--staging_vespalib/src/tests/timer/.gitignore1
-rw-r--r--staging_vespalib/src/tests/timer/CMakeLists.txt8
-rw-r--r--staging_vespalib/src/tests/timer/timer_test.cpp55
3 files changed, 0 insertions, 64 deletions
diff --git a/staging_vespalib/src/tests/timer/.gitignore b/staging_vespalib/src/tests/timer/.gitignore
deleted file mode 100644
index 9031e40152a..00000000000
--- a/staging_vespalib/src/tests/timer/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-staging_vespalib_timer_test_app
diff --git a/staging_vespalib/src/tests/timer/CMakeLists.txt b/staging_vespalib/src/tests/timer/CMakeLists.txt
deleted file mode 100644
index 9fd12f11c7c..00000000000
--- a/staging_vespalib/src/tests/timer/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(staging_vespalib_timer_test_app TEST
- SOURCES
- timer_test.cpp
- DEPENDS
- staging_vespalib
-)
-vespa_add_test(NAME staging_vespalib_timer_test_app COMMAND staging_vespalib_timer_test_app)
diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp
deleted file mode 100644
index 1f0ee81e4e6..00000000000
--- a/staging_vespalib/src/tests/timer/timer_test.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/scheduledexecutor.h>
-#include <vespa/vespalib/util/size_literals.h>
-#include <vespa/fnet/transport.h>
-#include <vespa/fastos/thread.h>
-
-using namespace vespalib;
-using vespalib::Executor;
-typedef Executor::Task Task;
-
-namespace {
-
-class TestTask : public Task {
-private:
- vespalib::CountDownLatch &_latch;
-public:
- TestTask(vespalib::CountDownLatch & latch) : _latch(latch) { }
- void run() override { _latch.countDown(); }
-};
-
-}
-
-TEST("testScheduling") {
- vespalib::CountDownLatch latch1(3);
- vespalib::CountDownLatch latch2(2);
- FastOS_ThreadPool threadPool(64_Ki);
- FNET_Transport transport;
- transport.Start(&threadPool);
- ScheduledExecutor timer(transport);
- timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 100ms, 200ms);
- timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch2), 500ms, 500ms);
- EXPECT_TRUE(latch1.await(60s));
- EXPECT_TRUE(latch2.await(60s));
- timer.reset();
- transport.ShutDown(true);
-}
-
-TEST("testReset") {
- vespalib::CountDownLatch latch1(2);
- FastOS_ThreadPool threadPool(64_Ki);
- FNET_Transport transport;
- transport.Start(&threadPool);
- ScheduledExecutor timer(transport);
- timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 2s, 3s);
- timer.reset();
- EXPECT_TRUE(!latch1.await(3s));
- timer.scheduleAtFixedRate(std::make_unique<TestTask>(latch1), 200ms, 300ms);
- EXPECT_TRUE(latch1.await(60s));
- timer.reset();
- transport.ShutDown(true);
-}
-
-TEST_MAIN() { TEST_RUN_ALL(); }