Skip to content

Merge pull request #269 from WaberZhuang/main #661

Merge pull request #269 from WaberZhuang/main

Merge pull request #269 from WaberZhuang/main #661

Workflow file for this run

name: CMake
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
BUILD_TYPE: Debug
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libgflags-dev libcurl4-openssl-dev libssl-dev libaio-dev libnl-3-dev libnl-genl-3-dev libzstd-dev
sudo apt-get install -y uuid-dev libjson-c-dev libkmod-dev libsystemd-dev autoconf automake libtool libpci-dev nasm
sudo apt-get install -y libext2fs-dev
wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
tar -zxvf release-1.11.0.tar.gz
cd googletest-release-1.11.0/
cmake CMakeLists.txt
make
sudo make install
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
git submodule update --init
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=1 -DENABLE_DSA=1 -DENABLE_ISAL=1
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: make -j64
- name: E2E Test OverlayBD
working-directory: ${{github.workspace}}/build
shell: bash
run: |
sudo make install
sudo cp ${{github.workspace}}/src/example_config/overlaybd-registryv2.json /etc/overlaybd/overlaybd.json
sudo systemctl enable /opt/overlaybd/overlaybd-tcmu.service
sudo systemctl start overlaybd-tcmu
sudo systemctl status overlaybd-tcmu
sudo mkdir -p /var/lib/overlaybd/test/
sudo mkdir -p /sys/kernel/config/target/core/user_1/vol1
echo -n dev_config=overlaybd/${{github.workspace}}/src/example_config/redis.obd.config.json | sudo tee /sys/kernel/config/target/core/user_1/vol1/control
echo -n 1 | sudo tee /sys/kernel/config/target/core/user_1/vol1/enable
sudo mkdir -p /sys/kernel/config/target/loopback/naa.123456789abcdef/tpgt_1/lun/lun_0
echo -n "naa.123456789abcdef" | sudo tee /sys/kernel/config/target/loopback/naa.123456789abcdef/tpgt_1/nexus
sudo ln -s /sys/kernel/config/target/core/user_1/vol1 /sys/kernel/config/target/loopback/naa.123456789abcdef/tpgt_1/lun/lun_0/vol1
lsblk
sudo apt-get install -y lsscsi
dev=`lsscsi | grep TCMU | awk '{print $7}'`
echo $dev
mkdir obd_mp
sudo mount -o ro $dev obd_mp
ls obd_mp
sudo umount obd_mp
ls -l /sys/kernel/config/target/loopback/naa.123456789abcdef/tpgt_1/lun/lun_0/vol1
sudo unlink /sys/kernel/config/target/loopback/naa.123456789abcdef/tpgt_1/lun/lun_0/vol1
wget https://overlaybd.blob.core.windows.net/overlaybd/e2etest.tar.gz
gzip -k -d e2etest.tar.gz
mkdir test_data
tar -zxvf e2etest.tar.gz -C test_data/
truncate -s 2g img1
truncate -s 2g img2
/opt/overlaybd/bin/overlaybd-apply --mkfs --raw e2etest.tar img1
sleep 2
/opt/overlaybd/bin/overlaybd-apply --mkfs --raw e2etest.tar img2
diff img1 img2
sudo mount -o ro img1 obd_mp
ls obd_mp
sudo diff -r --exclude "lost+found" test_data obd_mp
sudo umount obd_mp
- name: E2E Test turboOCIv1
working-directory: ${{github.workspace}}/build
shell: bash
run: |
sudo make install
sudo cp ${{github.workspace}}/src/example_config/overlaybd-registryv2.json /etc/overlaybd/overlaybd.json
sudo systemctl enable /opt/overlaybd/overlaybd-tcmu.service
sudo systemctl start overlaybd-tcmu
sudo systemctl status overlaybd-tcmu
sudo wget https://overlaybd.blob.core.windows.net/overlaybd/e2etest.tar.gz
sudo mkdir -p /var/lib/overlaybd/test/
sudo tar -zxvf e2etest.tar.gz -C /var/lib/overlaybd/test/
sudo mkdir -p /sys/kernel/config/target/core/user_1/vol2
echo -n dev_config=overlaybd//var/lib/overlaybd/test/20/block/config.v1.json | sudo tee /sys/kernel/config/target/core/user_1/vol2/control
echo -n 1 | sudo tee /sys/kernel/config/target/core/user_1/vol2/enable
sudo mkdir -p /sys/kernel/config/target/loopback/naa.987654321abcdef/tpgt_1/lun/lun_0
echo -n "naa.987654321abcdef" | sudo tee /sys/kernel/config/target/loopback/naa.987654321abcdef/tpgt_1/nexus
sudo ln -s /sys/kernel/config/target/core/user_1/vol2 /sys/kernel/config/target/loopback/naa.987654321abcdef/tpgt_1/lun/lun_0/vol2
lsblk
sudo apt-get install -y lsscsi
dev=`lsscsi | grep TCMU | awk '{print $7}'`
echo $dev
sudo mkdir foci_mp
sudo mount -o ro $dev foci_mp
ls foci_mp
sudo umount foci_mp
sudo unlink /sys/kernel/config/target/loopback/naa.987654321abcdef/tpgt_1/lun/lun_0/vol2
- name: Unit Test
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -j8 --output-on-failure -C $BUILD_TYPE