diff --git a/.github/workflows/test-build.yaml b/.github/workflows/test.yaml similarity index 59% rename from .github/workflows/test-build.yaml rename to .github/workflows/test.yaml index e25afa0a..7e26b62a 100644 --- a/.github/workflows/test-build.yaml +++ b/.github/workflows/test.yaml @@ -27,3 +27,19 @@ jobs: - name: Build run: | make debug + + - name: Install Ceph + run: | + sudo ./ci/setup_ceph.sh + + - name: Run tests + run: | + mkdir -p /tmp/lsvd-read + mkdir -p /tmp/lsvd-write + + cd build-dbg + sudo meson test + + - name: Logs + run: | + cat build-dbg/meson-logs/testlog.txt diff --git a/Makefile b/Makefile index 4a00bb32..1e0d3d76 100644 --- a/Makefile +++ b/Makefile @@ -19,4 +19,4 @@ clean: install-deps: sudo apt install -y meson libfmt-dev libaio-dev librados-dev mold \ libtcmalloc-minimal4 libboost-dev libradospp-dev \ - liburing-dev + liburing-dev pkg-config uuid-dev diff --git a/ci/setup_ceph.sh b/ci/setup_ceph.sh new file mode 100755 index 00000000..8593d93a --- /dev/null +++ b/ci/setup_ceph.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Lifted over from https://github.com/nerc-project/coldfront-plugin-cloud + +set -ex + +OSD_BIN_DIR=/tmp + + +function install_pkgs() { + apt-get update + apt-get install -y cephadm lvm2 ipcalc jq iproute2 +} + +function init_ceph() { + DEFAULT_DEVICE=$(ip -j route show default | jq -r '.[0].dev') + IP=$(ip -j add show dev $DEFAULT_DEVICE | jq -r '.[0].addr_info[0].local') + PREFIX=$(ip -j add show dev $DEFAULT_DEVICE | jq -r '.[0].addr_info[0].prefixlen') + NETWORK=$(ipcalc $IP/$PREFIX | grep -i network: | awk '{ print $2 }') + + cephadm bootstrap \ + --cluster-network $NETWORK \ + --mon-ip $IP \ + --allow-fqdn-hostname \ + --single-host-defaults \ + --log-to-file \ + --skip-firewalld \ + --skip-dashboard \ + --skip-monitoring-stack \ + --allow-overwrite +} + +function osd_setup() { + OSD1_BIN=$OSD_BIN_DIR/osd0.bin + OSD2_BIN=$OSD_BIN_DIR/osd1.bin + dd if=/dev/zero of=$OSD1_BIN bs=512M count=8 + dd if=/dev/zero of=$OSD2_BIN bs=512M count=8 + OSD1_DEV=$(losetup -f) + losetup $OSD1_DEV $OSD1_BIN + OSD2_DEV=$(losetup -f) + losetup $OSD2_DEV $OSD2_BIN + pvcreate $OSD1_DEV + pvcreate $OSD2_DEV + vgcreate rgw $OSD1_DEV $OSD2_DEV + lvcreate -n rgw-ceph-osd0 -L 4000M rgw + lvcreate -n rgw-ceph-osd1 -L 4000M rgw + cephadm shell ceph orch daemon add osd $HOSTNAME:/dev/rgw/rgw-ceph-osd0 + cephadm shell ceph orch daemon add osd $HOSTNAME:/dev/rgw/rgw-ceph-osd1 +} + +function rgw_setup() { + cephadm shell ceph orch apply rgw test --placement=1 +} + +install_pkgs +init_ceph +osd_setup +rgw_setup diff --git a/test/meson.build b/test/meson.build index 5713f15a..07affe36 100644 --- a/test/meson.build +++ b/test/meson.build @@ -24,5 +24,5 @@ unit1 = executable( # executable('lsvd_rnd_test', 'lsvd_rnd_test.cc', include_directories: lsvd_inc, link_with: liblsvd, dependencies: lsvd_deps) test('Sequential write/read', seq) -test('Misc unit tests', unit1) -test('RADOS performance test?', rados) +# test('Misc unit tests', unit1) +# test('RADOS performance test?', rados) diff --git a/test/test-seq.cc b/test/test-seq.cc index f6bad2b5..197922de 100644 --- a/test/test-seq.cc +++ b/test/test-seq.cc @@ -9,6 +9,13 @@ const size_t LSVD_BLOCK_SIZE = 4096; using comp_buf = std::array; + +#ifdef __cplusplus +extern "C" +#endif +const char* __asan_default_options() { return "detect_leaks=0"; } + + /** * Usage: * hexDump(desc, addr, len, perLine); @@ -104,8 +111,8 @@ void run_test(rados_ioctx_t ctx) log_info("Removing old image if one exists"); rbd_remove(ctx, "random-test-img"); - size_t img_size = 1 * 1024 * 1024 * 1024; - // size_t img_size = 100 * 1024 * 1024; + // size_t img_size = 1 * 1024 * 1024 * 1024; + size_t img_size = 100 * 1024 * 1024; // create the image for our own use log_info("Creating image {} of size {}", "random-test-img", img_size); @@ -162,14 +169,14 @@ void run_test(rados_ioctx_t ctx) int main(int argc, char *argv[]) { // config options - setenv("LSVD_RCACHE_DIR", "/mnt/nvme/lsvd-read/", 1); - setenv("LSVD_WCACHE_DIR", "/mnt/nvme-remote/lsvd-write/", 1); + setenv("LSVD_RCACHE_DIR", "/tmp/nvme/lsvd-read", 1); + setenv("LSVD_WCACHE_DIR", "/tmp/nvme/lsvd-write", 1); setenv("LSVD_CACHE_SIZE", "2147483648", 1); std::string pool_name = "pone"; rados_t cluster; - int err = rados_create2(&cluster, "ceph", "client.lsvd", 0); + int err = rados_create2(&cluster, "ceph", "client.admin", 0); check_ret_neg(err, "Failed to create cluster handle"); err = rados_conf_read_file(cluster, "/etc/ceph/ceph.conf");