- name: Compare buckify output
run: make check-buck-targets
+
+ - name: Simple source code checks
+ run: make check-sources
ifndef SKIP_FORMAT_BUCK_CHECKS
$(MAKE) check-format
$(MAKE) check-buck-targets
+ $(MAKE) check-sources
endif
# TODO add ldb_tests
check-buck-targets:
buckifier/check_buck_targets.sh
+check-sources:
+ build_tools/check-sources.sh
+
package:
bash build_tools/make_package.sh $(SHARED_MAJOR).$(SHARED_MINOR)
ribbon_bench: $(OBJ_DIR)/microbench/ribbon_bench.o $(LIBRARY)
$(AM_LINK)
-
+
cache_reservation_manager_test: $(OBJ_DIR)/cache/cache_reservation_manager_test.o $(TEST_LIBRARY) $(LIBRARY)
$(AM_LINK)
#-------------------------------------------------
# Remove the rules for which dependencies should not be generated and see if any are left.
#If so, include the dependencies; if not, do not include the dependency files
-ROCKS_DEP_RULES=$(filter-out clean format check-format check-buck-targets jclean jtest package analyze tags rocksdbjavastatic% unity.% unity_test, $(MAKECMDGOALS))
+ROCKS_DEP_RULES=$(filter-out clean format check-format check-buck-targets check-sources jclean jtest package analyze tags rocksdbjavastatic% unity.% unity_test, $(MAKECMDGOALS))
ifneq ("$(ROCKS_DEP_RULES)", "")
-include $(DEPFILES)
endif
--- /dev/null
+#!/usr/bin/env bash
+# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
+#
+# Check for some simple mistakes that should prevent commit or push
+
+BAD=""
+
+git grep 'namespace rocksdb' -- '*.[ch]*'
+if [ "$?" != "1" ]; then
+ echo "^^^^^ Do not hardcode namespace rocksdb. Use ROCKSDB_NAMESPACE"
+ BAD=1
+fi
+
+git grep -i 'nocommit' -- ':!build_tools/check-sources.sh'
+if [ "$?" != "1" ]; then
+ echo "^^^^^ Code was not intended to be committed"
+ BAD=1
+fi
+
+git grep '<rocksdb/' -- ':!build_tools/check-sources.sh'
+if [ "$?" != "1" ]; then
+ echo '^^^^^ Use double-quotes as in #include "rocksdb/something.h"'
+ BAD=1
+fi
+
+if [ "$BAD" ]; then
+ exit 1
+fi
return 1;
}
#else
-#include <rocksdb/cache_bench_tool.h>
+#include "rocksdb/cache_bench_tool.h"
int main(int argc, char** argv) {
return ROCKSDB_NAMESPACE::cache_bench_tool(argc, argv);
}
return 1;
}
#else
-#include <rocksdb/db_stress_tool.h>
+#include "rocksdb/db_stress_tool.h"
int main(int argc, char** argv) {
return ROCKSDB_NAMESPACE::db_stress_tool(argc, argv);
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
-#include <rocksdb/compaction_filter.h>
-#include <rocksdb/db.h>
-#include <rocksdb/merge_operator.h>
-#include <rocksdb/options.h>
+#include "rocksdb/compaction_filter.h"
+#include "rocksdb/db.h"
+#include "rocksdb/merge_operator.h"
+#include "rocksdb/options.h"
class MyMerge : public ROCKSDB_NAMESPACE::MergeOperator {
public:
#pragma once
-#include <rocksdb/slice.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdexcept>
#include <unordered_set>
+#include "rocksdb/slice.h"
+
namespace ROCKSDB_NAMESPACE {
class Arena;
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#pragma once
-#include <rocksdb/rocksdb_namespace.h>
-#include <rocksdb/status.h>
#include <stdint.h>
#include <memory>
+#include "rocksdb/rocksdb_namespace.h"
+#include "rocksdb/status.h"
+
#ifdef _WIN32
// Windows API macro interference
#undef GetCurrentTime
#include "rocksjni/portal.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
EventListenerJniCallback::EventListenerJniCallback(
JNIEnv* env, jobject jevent_listener,
const std::set<EnabledEventCallback>& enabled_event_callbacks)
CleanupCallbackInvocation(env, attached_thread, {&jop_info});
}
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
#include "rocksdb/listener.h"
#include "rocksjni/jnicallback.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
enum EnabledEventCallback {
ON_FLUSH_COMPLETED = 0x0,
jmethodID m_on_error_recovery_completed_mid;
};
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
#endif // JAVA_ROCKSJNI_EVENT_LISTENER_JNICALLBACK_H_
#include "memkind_kmem_allocator.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
void* MemkindKmemAllocator::Allocate(size_t size) {
void* p = memkind_malloc(MEMKIND_DAX_KMEM, size);
}
#endif // ROCKSDB_MALLOC_USABLE_SIZE
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
#endif // MEMKIND
#include <memkind.h>
#include "rocksdb/memory_allocator.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
class MemkindKmemAllocator : public MemoryAllocator {
public:
#endif
};
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
#endif // MEMKIND
#include "table/block_based/block_based_table_factory.h"
#include "test_util/testharness.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
TEST(MemkindKmemAllocatorTest, Allocate) {
MemkindKmemAllocator allocator;
void* p;
ASSERT_OK(s);
ASSERT_OK(DestroyDB(dbname, options));
}
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
#include "table/block_based/partitioned_filter_block.h"
#include "table/format.h"
-// Without anonymous namespace here, we fail the warning -Wmissing-prototypes
namespace ROCKSDB_NAMESPACE {
-// using namespace rocksdb;
+
// Create a index builder based on its type.
IndexBuilder* IndexBuilder::CreateIndexBuilder(
BlockBasedTableOptions::IndexType index_type,
#else
#include <gtest/gtest.h>
#endif
-#include <rocksdb/utilities/regex.h>
+#include "rocksdb/utilities/regex.h"
// A "skipped" test has a specific meaning in Facebook infrastructure: the
// test is in good shape and should be run, but something about the
return 1;
}
#else
-#include <rocksdb/db_bench_tool.h>
+#include "rocksdb/db_bench_tool.h"
int main(int argc, char** argv) {
return ROCKSDB_NAMESPACE::db_bench_tool(argc, argv);
}