Building and Testing the Bustub Database System

Repository Setup

Begin by creating a private repository on GitHub named bustub-private. Follow these steps to mirror the original public repository:

# Clone the original repository as bare
git clone --bare https://github.com/cmu-db/bustub.git bustub-original

# Mirror to your private repository
cd bustub-original
git push https://github.com/student/bustub-private.git main

# Clean up and clone your private repository
cd ..
rm -rf bustub-original
git clone https://github.com/student/bustub-private.git

# Add original repository as upstream
git remote add upstream https://github.com/cmu-db/bustub.git

To sync with upstream changes:

git fetch upstream
git merge upstream/main

Compilation Process

Linux and macOS Setup

Install required dependencies using the provided scripts:

# Linux
sudo build_support/packages.sh
# macOS
build_support/packages.sh

Build the system with these commands:

mkdir build
cd build
cmake ..
make

Debug Build Configuration

For debugging purposes, configure CMake in debug mode:

cmake -DCMAKE_BUILD_TYPE=Debug ..

To accelerate compilation using multiple threads:

make -j$(nproc)

Alternative sanitizer configurations:

cmake -DCMAKE_BUILD_TYPE=Debug -DBUSTUB_SANITIZER=thread ..
make -j$(nproc)

Testing Framwork

Execute all test cases using Google Test framework:

cd build
make check-tests

Note that some test may be disabled for future project phases. Tests can be disabled by adding the DISABLED_ prefix in test names.

Code Quality Standards

Ensure code compliance with Google C++ Style Guide using these commands:

make format
make check-lint
make check-clang-tidy-p0

Memory Management

Memory errors are detected using LLVM Address Sanitizer and Leak Sanitizer. Configure CMake in debug mode to enable these tools.

For Valgrind memory checking:

valgrind --error-exitcode=1 --leak-check=full ./test/starter_trie_test

Development Guidelines

Use logging macros instead of printf for debugging:

LOG_INFO("Page count: %d", page_count);
LOG_DEBUG("Loading page %d", page_num);

Enable logging by building in debug mode and include the logger header:

#include "common/logger.h"

For compilation issues, completely remove the build directory and rerun cmake rather than just using make clean.

Submission Requirements

Ensure your submission meets these criteria:

  • Passes all test cases with correct outputs
  • Runs without memory leaks
  • Compleis with code formatting standards

Non-CMU students can access GradeScope using course code PXWVR5 and selecting CMU as the institution during registration.

Tags: bustub CMake Git testing asan

Posted on Wed, 13 May 2026 06:20:18 +0000 by vino4all