merge event base tests
authorJames Sedgwick <jsedgwick@fb.com>
Thu, 20 Nov 2014 18:02:13 +0000 (10:02 -0800)
committerDave Watson <davejwatson@fb.com>
Thu, 11 Dec 2014 15:58:15 +0000 (07:58 -0800)
Summary: someone made another event base test while the big set still lived in thrift. merge it now that the old tests have been moved.

Test Plan: fbconfig folly/io/async/test && fbmake runtests --extended-tests

Reviewed By: davejwatson@fb.com

Subscribers: njormrod, folly-diffs@

FB internal diff: D1690764

Signature: t1:1690764:1416413748:f3ae64d509432844bb2e1b689a75d66825269d15

folly/io/async/test/EventBaseTest.cpp
folly/io/test/EventBaseTest.cpp [deleted file]

index c20a9fe605eddcfab36bf51341ffafbd632b5872..59b89dbaf32c7b456e08c144cd00949d4675ae88 100644 (file)
@@ -1558,3 +1558,36 @@ TEST(EventBaseTest, RunBeforeLoopWait) {
   // Check that we only ran once, and did not loop multiple times.
   ASSERT_EQ(cb.getCount(), 0);
 }
+
+class PipeHandler : public EventHandler {
+public:
+  PipeHandler(EventBase* eventBase, int fd)
+    : EventHandler(eventBase, fd) {}
+
+  void handlerReady(uint16_t events) noexcept {
+    abort();
+  }
+};
+
+TEST(EventBaseTest, StopBeforeLoop) {
+  EventBase evb;
+
+  // Give the evb something to do.
+  int p[2];
+  ASSERT_EQ(0, pipe(p));
+  PipeHandler handler(&evb, p[0]);
+  handler.registerHandler(EventHandler::READ);
+
+  // It's definitely not running yet
+  evb.terminateLoopSoon();
+
+  // let it run, it should exit quickly.
+  std::thread t([&] { evb.loop(); });
+  t.join();
+
+  handler.unregisterHandler();
+  close(p[0]);
+  close(p[1]);
+
+  SUCCEED();
+}
diff --git a/folly/io/test/EventBaseTest.cpp b/folly/io/test/EventBaseTest.cpp
deleted file mode 100644 (file)
index b7020c8..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <thread>
-
-#include <gtest/gtest.h>
-
-#include <folly/io/async/EventBase.h>
-#include <folly/io/async/EventHandler.h>
-
-using namespace folly;
-
-class PipeHandler : public EventHandler {
-public:
-  PipeHandler(EventBase* eventBase, int fd)
-    : EventHandler(eventBase, fd) {}
-
-  void handlerReady(uint16_t events) noexcept {
-    abort();
-  }
-};
-
-TEST(EventBase, StopBeforeLoop) {
-  EventBase evb;
-
-  // Give the evb something to do.
-  int p[2];
-  ASSERT_EQ(0, pipe(p));
-  PipeHandler handler(&evb, p[0]);
-  handler.registerHandler(EventHandler::READ);
-
-  // It's definitely not running yet
-  evb.terminateLoopSoon();
-
-  // let it run, it should exit quickly.
-  std::thread t([&] { evb.loop(); });
-  t.join();
-
-  handler.unregisterHandler();
-  close(p[0]);
-  close(p[1]);
-
-  SUCCEED();
-}