Merge pull request #1284 from marpaia/whats-snappenin

Install snappy headers instead of just the library
This commit is contained in:
Mike Arpaia 2015-07-01 16:25:04 -07:00
commit 51f594e2bf
4 changed files with 13 additions and 9 deletions

View File

@ -16,6 +16,7 @@
#include <rocksdb/env.h>
#include <rocksdb/options.h>
#include <snappy.h>
#include <osquery/database.h>
#include <osquery/filesystem.h>

View File

@ -34,7 +34,7 @@ Status Query::getPreviousQueryResults(QueryData& results) {
Status Query::getPreviousQueryResults(QueryData& results, DBHandleRef db) {
if (!isQueryNameInDatabase()) {
return Status(1, "Query name not found in database");
return Status(0, "Query name not found in database");
}
std::string raw;
@ -89,6 +89,9 @@ Status Query::addNewResults(const QueryData& current_qd,
// Get the rows from the last run of this query name.
QueryData previous_qd;
auto status = getPreviousQueryResults(previous_qd);
if (!status.ok()) {
return status;
}
// Sanitize all non-ASCII characters from the query data values.
QueryData escaped_current_qd;

View File

@ -108,7 +108,8 @@ TEST_F(QueryTests, test_query_name_not_found_in_db) {
auto query = getOsqueryScheduledQuery();
auto cf = Query("not_a_real_query", query);
auto status = cf.getPreviousQueryResults(previous_qd, db_);
EXPECT_FALSE(status.ok());
EXPECT_TRUE(status.toString() == "Query name not found in database");
EXPECT_TRUE(status.ok());
}
TEST_F(QueryTests, test_is_query_name_in_database) {

View File

@ -142,15 +142,14 @@ function install_snappy() {
URL=$DEPS_URL/snappy-1.1.1.tar.gz
SOURCE=snappy-1.1.1
if provision snappy /usr/local/lib/libsnappy.a; then
if [[ ! -f snappy-1.1.1/.libs/libsnappy.a ]]; then
if provision snappy /usr/local/include/snappy.h; then
pushd $SOURCE
CC="$CC" CXX="$CXX" ./configure --with-pic --enable-static
if [[ ! -f .libs/libsnappy.a ]]; then
make -j $THREADS
popd
fi
# We do not need the snappy include headers, just static library.
sudo cp snappy-1.1.1/.libs/libsnappy.a /usr/local/lib
sudo make install
popd
fi
}