Skip to content

Commit

Permalink
add scripts/Dockerfile_build_environment_ubuntu_2004
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzq50 committed Dec 22, 2023
1 parent 609de82 commit d625dea
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 15 deletions.
21 changes: 11 additions & 10 deletions docs/build_from_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ This section provides instructions on building Infinity from source on Ubuntu 22
### Step1 Download the source code

```shell
$ git clone https://github.com/infiniflow/infinity.git
git clone https://github.com/infiniflow/infinity.git
```

### Step2 Install necessary dependencies

```bash
```shell
sudo apt update && sudo apt install git wget unzip software-properties-common
wget https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz
tar zxvf cmake-3.28.1-linux-x86_64.tar.gz
cp -rf cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin && cp -rf cmake-3.28.1-linux-x86_64/share/* /usr/local/share && rm -rf cmake-3.28.1-linux-x86_64
sudo cp -rf cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin && sudo cp -rf cmake-3.28.1-linux-x86_64/share/* /usr/local/share && rm -rf cmake-3.28.1-linux-x86_64
wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
unzip ninja-linux.zip && cp ninja /usr/local/bin && rm ninja ninja-linux.zip
unzip ninja-linux.zip && sudo cp ninja /usr/local/bin && rm ninja
sudo echo 'deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' > /etc/apt/sources.list.d/llvm17.list
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository -P ppa:ubuntu-toolchain-r/test
sudo add-apt-repository -P ppa:mhier/libboost-latest
Expand All @@ -43,7 +44,7 @@ ninja -j 12
### Step4 Start up the Infinity server

```shell
.build/src/infinity_main
.build/src/infinity
```


Expand All @@ -60,11 +61,11 @@ git clone https://github.com/infiniflow/infinity.git

### Step2 Install dependencies

```bash
```shell
sudo apt update && sudo apt install -y git wget
wget https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz
tar zxvf cmake-3.28.1-linux-x86_64.tar.gz
cp -rf cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin && cp -rf cmake-3.28.1-linux-x86_64/share/* /usr/local/share && rm -rf cmake-3.28.1-linux-x86_64
sudo cp -rf cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin && sudo cp -rf cmake-3.28.1-linux-x86_64/share/* /usr/local/share && rm -rf cmake-3.28.1-linux-x86_64
sudo apt install -y ninja-build clang-17 clang-tools-17 flex libboost1.81-dev liblz4-dev libevent-dev liburing-dev libthrift-dev
ln -s /usr/lib/llvm-17/bin/clang-scan-deps /usr/bin/clang-scan-deps
```
Expand All @@ -74,14 +75,14 @@ ln -s /usr/lib/llvm-17/bin/clang-scan-deps /usr/bin/clang-scan-deps
```shell
git config --global --add safe.directory infinity
cd infinity && mkdir build && cd build
export CC=/usr/bin/clang-18
export CXX=/usr/bin/clang++-18
export CC=/usr/bin/clang-17
export CXX=/usr/bin/clang++-17
cmake -G Ninja ..
ninja -j 12
```

### Step4 Start up Infinity server

```shell
.build/src/infinity_main
.build/src/infinity
```
68 changes: 68 additions & 0 deletions scripts/Dockerfile_build_environment_ubuntu_2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM ubuntu:focal

RUN apt update && apt install -y ca-certificates \
&& sed -i 's@//.*archive.ubuntu.com@//mirrors.tuna.tsinghua.edu.cn@g' /etc/apt/sources.list \
&& apt update

# Install git wget unzip software-properties-common
RUN DEBIAN_FRONTEND=noninteractive apt install -y git wget unzip software-properties-common

# Install cmake-3.28.1
RUN wget https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz \
&& tar zxvf cmake-3.28.1-linux-x86_64.tar.gz \
&& cp -rf cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin \
&& cp -rf cmake-3.28.1-linux-x86_64/share/* /usr/local/share \
&& rm -rf cmake-3.28.1-linux-x86_64

# Install ninja-1.11.1
RUN wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip \
&& unzip ninja-linux.zip && cp ninja /usr/local/bin && rm ninja

# Add apt source for llvm-17
RUN echo 'deb https://mirrors.tuna.tsinghua.edu.cn/llvm-apt/focal/ llvm-toolchain-focal-17 main' > /etc/apt/sources.list.d/llvm17.list \
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc

# Add apt source for g++-13 gcc-13 libstdc++-13-dev libboost1.81-dev liburing-dev
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& add-apt-repository -y ppa:mhier/libboost-latest \
&& add-apt-repository -y ppa:rhansen/qemu

# Install g++-13 clang-17 clang-tools-17 flex libboost1.81-dev liblz4-dev libevent-dev liburing-dev libthrift-dev
RUN apt update \
&& apt install -y g++-13 clang-17 clang-tools-17 flex libboost1.81-dev liblz4-dev libevent-dev liburing-dev libthrift-dev

# Create a symbolic link for clang-scan-deps-17
RUN ln -s /usr/lib/llvm-17/bin/clang-scan-deps /usr/bin/clang-scan-deps

ENV CC=/usr/bin/clang-17
ENV CXX=/usr/bin/clang++-17

# Install curl clang-tidy-17 clang-format-17 vim emacs-nox bison thrift-compiler postgresql-client python3-pip python3-venv tree rpm libgflags-dev
RUN apt install -y curl clang-tidy-17 clang-format-17 vim emacs-nox bison thrift-compiler postgresql-client python3-pip python3-venv tree rpm libgflags-dev
RUN ln -s /usr/bin/clang-format-17 /usr/bin/clang-format \
&& ln -s /usr/bin/clang-tidy-17 /usr/bin/clang-tidy \
&& ln -s /usr/bin/llvm-symbolizer-17 /usr/bin/llvm-symbolizer

# rust, refers to https://rsproxy.cn/
ENV RUSTUP_DIST_SERVER="https://rsproxy.cn"
ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
ENV PATH=/root/.cargo/bin:$PATH
RUN wget -O rustup-init.sh https://rsproxy.cn/rustup-init.sh && sh rustup-init.sh -y
RUN mkdir -vp $HOME/.cargo && echo "[source.crates-io]" >> $HOME/.cargo/config \
&& echo "replace-with = 'rsproxy-sparse'" >> $HOME/.cargo/config \
&& echo "[source.rsproxy]" >> $HOME/.cargo/config \
&& echo "registry = 'https://rsproxy.cn/index/'" >> $HOME/.cargo/config \
&& echo "[source.rsproxy-sparse]" >> $HOME/.cargo/config \
&& echo "registry = 'sparse+https://rsproxy.cn/index/'" >> $HOME/.cargo/config \
&& echo "[registries.rsproxy]" >> $HOME/.cargo/config \
&& echo "index = 'https://rsproxy.cn/crates.io-index'" >> $HOME/.cargo/config \
&& echo "[net]" >> $HOME/.cargo/config \
&& echo "git-fetch-with-cli = true" >> $HOME/.cargo/config

# sqllogictest
RUN cargo install sqllogictest-bin

# Create a python virtual environment. Set PATH so that the shell activate this virtual environment automatically when entering a container from this image.
RUN python3 -m venv /usr/local/venv
ENV PATH="/usr/local/venv/bin:$PATH"

20 changes: 19 additions & 1 deletion src/unit_test/storage/buffer/buffer_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,26 @@ import buffer_manager;
import data_file_worker;
import buffer_obj;
import infinity_exception;
import global_resource_usage;
import infinity_context;

class BufferHandleTest : public BaseTest {
void SetUp() override {
BaseTest::SetUp();
system("rm -rf /tmp/infinity/log /tmp/infinity/data /tmp/infinity/wal");
infinity::GlobalResourceUsage::Init();
std::shared_ptr<std::string> config_path = nullptr;
infinity::InfinityContext::instance().Init(config_path);
}

class BufferHandleTest : public BaseTest {};
void TearDown() override {
infinity::InfinityContext::instance().UnInit();
EXPECT_EQ(infinity::GlobalResourceUsage::GetObjectCount(), 0);
EXPECT_EQ(infinity::GlobalResourceUsage::GetRawMemoryCount(), 0);
infinity::GlobalResourceUsage::UnInit();
BaseTest::TearDown();
}
};

TEST_F(BufferHandleTest, test1) {
using namespace infinity;
Expand Down
18 changes: 17 additions & 1 deletion src/unit_test/storage/buffer/buffer_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,25 @@ import buffer_manager;
import buffer_handle;
import buffer_obj;
import data_file_worker;
import global_resource_usage;
import infinity_context;

class BufferObjTest : public BaseTest {
void SetUp() override { system("rm -rf /tmp/infinity"); }
void SetUp() override {
BaseTest::SetUp();
system("rm -rf /tmp/infinity/log /tmp/infinity/data /tmp/infinity/wal");
infinity::GlobalResourceUsage::Init();
std::shared_ptr<std::string> config_path = nullptr;
infinity::InfinityContext::instance().Init(config_path);
}

void TearDown() override {
infinity::InfinityContext::instance().UnInit();
EXPECT_EQ(infinity::GlobalResourceUsage::GetObjectCount(), 0);
EXPECT_EQ(infinity::GlobalResourceUsage::GetRawMemoryCount(), 0);
infinity::GlobalResourceUsage::UnInit();
BaseTest::TearDown();
}
};

// Test status transfer of buffer handle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# include (NewPlatformDebug)

# For Debug build types, default to "d"-suffix in library names.
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix")
#set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix")

# basic options
foreach(lang IN ITEMS C CXX)
Expand Down
4 changes: 2 additions & 2 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
## start the test

1. run `sudo rm -rf /tmp/infinity/*` to remove all previous data.
2. run `infinity_main`, so the database is ready for test.
2. run `infinity`, so the database is ready for test.
3. run `python3 ./tools/sqllogictest.py` under **the root path of infinity project**.
This python script will first call `generate_big.py`, `generate_fvecs.py` and so on to generate big test file under coresponding directory, then call sqllogictest cli tool to run the test cases. The cli tools will compare the actual result of infinity_main and result in slt file. Difference will be marked **RED**. Only when all slt test is passed, the test is passed.
This python script will first call `generate_big.py`, `generate_fvecs.py` and so on to generate big test file under coresponding directory, then call sqllogictest cli tool to run the test cases. The cli tools will compare the actual result of infinity and result in slt file. Difference will be marked **RED**. Only when all slt test is passed, the test is passed.

0 comments on commit d625dea

Please sign in to comment.