示例#1
0
TEST_F(ExtensionsTest, test_extension_start) {
  auto status = startExtensionManager(socket_path);
  EXPECT_TRUE(status.ok());
  EXPECT_TRUE(socketExistsLocal(socket_path));

  // Now allow duplicates (for testing, since EM/E are the same).
  Registry::allowDuplicates(true);
  status = startExtension(socket_path, "test", "0.1", "0.0.0", "9.9.9");
  // This will not be false since we are allowing deplicate items.
  // Otherwise, starting an extension and extensionManager would fatal.
  ASSERT_TRUE(status.ok());

  // Checks for version comparisons (also used by packs).
  ASSERT_FALSE(versionAtLeast("1.1.1", "0.0.1"));
  ASSERT_TRUE(versionAtLeast("1.1.1", "1.1.1"));
  ASSERT_TRUE(versionAtLeast("1.1.1", "1.1.2"));

  // The `startExtension` internal call (exposed for testing) returns the
  // uuid of the extension in the success status.
  RouteUUID uuid = (RouteUUID)stoi(status.getMessage(), nullptr, 0);

  // We can test-wait for the extensions's socket to open.
  EXPECT_TRUE(socketExistsLocal(socket_path + "." + std::to_string(uuid)));

  // Then clean up the registry modifications.
  Registry::removeBroadcast(uuid);
  Registry::allowDuplicates(false);
}
示例#2
0
文件: packs.cpp 项目: wxsBSD/osquery
bool Pack::checkVersion(const std::string& version) const {
  if (version.empty() || version == "null") {
    return true;
  }

  return versionAtLeast(version, kSDKVersion);
}
示例#3
0
 bool pointFormatSupported() const
 {
     if (versionAtLeast(1, 4))
         return m_pointFormat <= 10 && !hasWave();
     else
         return m_pointFormat <= 5 && !hasWave();
 }
示例#4
0
 size_t maxReturnCount() const
     { return (versionAtLeast(1, 4) ? RETURN_COUNT : LEGACY_RETURN_COUNT); }