Skip to content

Commit

Permalink
test: introduce DAOS dtx tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Michalski <jan.michalski@intel.com>
  • Loading branch information
janekmi committed Sep 30, 2024
1 parent d9fa506 commit 435008d
Show file tree
Hide file tree
Showing 20 changed files with 1,426 additions and 0 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/daos_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2024, Intel Corporation
#

name: DAOS tests

on:
push:

permissions: {}

env:
DAOS_BUILD: 0
DAOS_PATH: /opt/daos

jobs:
daos_test:
name: DAOS tests
runs-on: ubuntu-latest
steps:
- name: Clone the DAOS repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: daos-stack/daos
ref: release/2.6
path: daos

- name: Clone the PMDK repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: pmem/pmdk
path: pmdk

- name: Apply DAOS patches
if: ${{ env.DAOS_BUILD == 1 }}
working-directory: daos
run: git apply ../pmdk/src/test/daos_dtx/*.patch

- name: Install DAOS' dependencies
working-directory: daos
run: |
sudo pip install -r requirements-build.txt
sudo utils/scripts/install-ubuntu.sh
# https://go.dev/doc/install
- name: Update the golang package
if: ${{ env.DAOS_BUILD == 1 }}
env:
GOLANG_VER: go1.23.1 # >= 1.21 because of https://go.dev/doc/toolchain
run: |
sudo apt-get remove golang-go
wget https://go.dev/dl/${{ env.GOLANG_VER }}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf ${{ env.GOLANG_VER }}.linux-amd64.tar.gz
- name: Install Valgrind
working-directory: pmdk/utils/docker/images/
run: sudo ./install-valgrind.sh

- name: Generate ${{ env.OPTS_FILE }}
if: ${{ env.DAOS_BUILD == 1 }}
working-directory: daos
env:
OPTS_FILE: daos.conf
run: |
cat <<-EOF >> ${{ env.OPTS_FILE }}
BUILD_TYPE = 'debug'
TARGET_TYPE = 'debug'
PREFIX = '${{ env.DAOS_PATH }}'
GO_BIN = '/usr/local/go/bin/go'
EOF
cat ${{ env.OPTS_FILE }}
- name: Build DAOS
if: ${{ env.DAOS_BUILD == 1 }}
working-directory: daos
run: |
git submodule init
git submodule update
scons install -j16 --build-deps=yes
- name: Save ${{ env.DAOS_PATH }} as cache
if: ${{ env.DAOS_BUILD == 1 }}
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.DAOS_PATH }}
key: opt_daos

- name: Restore ${{ env.DAOS_PATH }} from cache
if: ${{ env.DAOS_BUILD == 0 }}
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.DAOS_PATH }}
key: opt_daos

- name: Install PMDK's dependencies
run: sudo apt-get install libndctl-dev libdaxctl-dev pandoc

- name: Build PMDK
working-directory: pmdk
env:
PMDK_BUILD_DAOS_TESTS: y
DAOS_INSTALL_PATH: ${{ env.DAOS_PATH }}
run: |
export DAOS_SRC_PATH=$(realpath ../daos)
utils/gha-runners/build-pmdk.sh
- name: Create testconfig files
working-directory: pmdk
env:
PMEM_FS_DIR: /dev/shm
PMEM_FS_DIR_FORCE_PMEM: 1
run: |
utils/create-testconfig.sh
for testconfig in src/test/testconfig.{sh,py}; do
echo "$testconfig"
cat $testconfig
echo
done
- name: Run daos_dtx tests (1/2)
working-directory: pmdk/src/test
env:
LD_LIBRARY_PATH: ${{ env.DAOS_PATH }}/prereq/debug/ofi/lib
run: |
export PATH=${{ env.DAOS_PATH }}/bin:$PATH
./RUNTESTS.py daos_dtx
- name: Run daos_dtx tests (2/2)
working-directory: pmdk/src/test
env:
PMEMOBJ_CONF: sds.at_create=0
run: |
export PATH=${{ env.DAOS_PATH }}/bin:$PATH
./RUNTESTS.sh daos_dtx 2> daos_dtx/err.log
- name: Upload test results as artifact
if: success() || failure()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: daos_dtx
path: pmdk/src/test/daos_dtx
1 change: 1 addition & 0 deletions src/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ OTHER_TESTS = \
compat_incompat_features\
ctl_prefault\
ctl_cow\
daos_dtx\
magic\
out_err\
out_err_mt\
Expand Down
1 change: 1 addition & 0 deletions src/test/daos_dtx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
daos_dtx
172 changes: 172 additions & 0 deletions src/test/daos_dtx/00_harmonize_VOS_pool_path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
diff --git a/src/vos/tests/vts_common.c b/src/vos/tests/vts_common.c
index 618f9feddd..7452ba2a34 100644
--- a/src/vos/tests/vts_common.c
+++ b/src/vos/tests/vts_common.c
@@ -52,11 +52,22 @@ vts_file_exists(const char *filename)
}

int
-vts_alloc_gen_fname(char **fname)
+vts_alloc_gen_fname(char *po_uuid_str, char **fname)
{
int rc;

- rc = asprintf(fname, "%s/vpool.%d", vos_path, gc++);
+ assert(*fname == NULL);
+ rc = asprintf(fname, "%s/%s/", vos_path, po_uuid_str);
+ if (rc < 0) {
+ *fname = NULL;
+ print_error("Failed to allocate memory for fname: rc = %d\n", rc);
+ return rc;
+ }
+ rc = mkdir(*fname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+ assert(rc == 0 || errno == EEXIST);
+ free(*fname);
+
+ rc = asprintf(fname, "%s/%s/vpool.%d", vos_path, po_uuid_str, gc++);
if (rc < 0) {
*fname = NULL;
print_error("Failed to allocate memory for fname: rc = %d\n", rc);
@@ -71,9 +82,9 @@ vts_pool_fallocate(char **fname)
{
int ret = 0, fd;

- ret = vts_alloc_gen_fname(fname);
- if (ret)
- return ret;
+ // ret = vts_alloc_gen_fname(fname);
+ // if (ret)
+ // return ret;

fd = open(*fname, O_CREAT | O_TRUNC | O_RDWR, 0666);
if (fd < 0) {
@@ -92,10 +103,17 @@ int
vts_ctx_init(struct vos_test_ctx *tcx, size_t psize)
{
int rc;
+ char uuid_str[] = "dd6728be-696a-11ef-a059-a4bf0165c389";
+ char uuid_str2[] = "591d19e4-69fe-11ef-b13d-a4bf0165c389";

memset(tcx, 0, sizeof(*tcx));
+
+ uuid_parse(uuid_str, tcx->tc_po_uuid);
+ // uuid_generate_time_safe(tcx->tc_po_uuid);
+ // uuid_unparse(tcx->tc_po_uuid, uuid_str);
+
oid_cnt = 0;
- rc = vts_alloc_gen_fname(&tcx->tc_po_name);
+ rc = vts_alloc_gen_fname(uuid_str, &tcx->tc_po_name);
assert_int_equal(rc, 0);

if (vts_file_exists(tcx->tc_po_name)) {
@@ -103,8 +121,8 @@ vts_ctx_init(struct vos_test_ctx *tcx, size_t psize)
assert_int_equal(rc, 0);
}

- uuid_generate_time_safe(tcx->tc_po_uuid);
- uuid_generate_time_safe(tcx->tc_co_uuid);
+ // uuid_generate_time_safe(tcx->tc_co_uuid);
+ uuid_parse(uuid_str2, tcx->tc_co_uuid);

/* specify @psize as both NVMe size and SCM size */
rc = vos_pool_create(tcx->tc_po_name, tcx->tc_po_uuid, psize, psize, 0, 0 /* version */,
@@ -155,14 +173,14 @@ vts_ctx_fini(struct vos_test_ctx *tcx)
assert_rc_equal(rc, 0);
/* fallthrough */
case TCX_CO_CREATE:
- rc = vos_cont_destroy(tcx->tc_po_hdl, tcx->tc_co_uuid);
- assert_rc_equal(rc, 0);
+ // rc = vos_cont_destroy(tcx->tc_po_hdl, tcx->tc_co_uuid);
+ // assert_rc_equal(rc, 0);
/* fallthrough */
case TCX_PO_CREATE_OPEN:
rc = vos_pool_close(tcx->tc_po_hdl);
assert_rc_equal(rc, 0);
- rc = vos_pool_destroy(tcx->tc_po_name, tcx->tc_po_uuid);
- assert_rc_equal(rc, 0);
+ // rc = vos_pool_destroy(tcx->tc_po_name, tcx->tc_po_uuid);
+ // assert_rc_equal(rc, 0);
free(tcx->tc_po_name);
/* fallthrough */
}
diff --git a/src/vos/tests/vts_common.h b/src/vos/tests/vts_common.h
index 2a08cbd8ff..b7dc09dcfe 100644
--- a/src/vos/tests/vts_common.h
+++ b/src/vos/tests/vts_common.h
@@ -83,7 +83,7 @@ bool
vts_file_exists(const char *filename);

int
-vts_alloc_gen_fname(char **fname);
+vts_alloc_gen_fname(char *po_uuid, char **fname);

int
vts_pool_fallocate(char **fname);
diff --git a/src/vos/tests/vts_io.c b/src/vos/tests/vts_io.c
index 5ec1bb08f7..abc269b1f6 100644
--- a/src/vos/tests/vts_io.c
+++ b/src/vos/tests/vts_io.c
@@ -956,7 +956,7 @@ io_obj_cache_test(void **state)
struct vos_object *obj1, *obj2;
daos_epoch_range_t epr = {0, 1};
daos_unit_oid_t oids[2];
- char *po_name;
+ char *po_name = "";
uuid_t pool_uuid;
daos_handle_t l_poh, l_coh;
struct daos_lru_cache *old_cache;
@@ -970,8 +970,8 @@ io_obj_cache_test(void **state)
old_cache = tls->vtl_ocache;
tls->vtl_ocache = occ;

- rc = vts_alloc_gen_fname(&po_name);
- assert_int_equal(rc, 0);
+ // rc = vts_alloc_gen_fname(&po_name);
+ // assert_int_equal(rc, 0);

uuid_generate_time_safe(pool_uuid);
rc = vos_pool_create(po_name, pool_uuid, VPOOL_256M, 0, 0, 0 /* version */, &l_poh);
@@ -1105,7 +1105,7 @@ io_obj_cache_test(void **state)
assert_rc_equal(rc, 0);
vos_obj_cache_destroy(occ);
tls->vtl_ocache = old_cache;
- free(po_name);
+ // free(po_name);
}

static void
diff --git a/src/vos/tests/vts_pool.c b/src/vos/tests/vts_pool.c
index acfd4e46a8..8e2fe3742c 100644
--- a/src/vos/tests/vts_pool.c
+++ b/src/vos/tests/vts_pool.c
@@ -49,7 +49,7 @@ static int
pool_file_setup(void **state)
{
struct vp_test_args *arg = *state;
- int ret = 0;
+ // int ret = 0;

D_ALLOC(arg->fname, sizeof(char *));
assert_ptr_not_equal(arg->fname, NULL);
@@ -57,8 +57,8 @@ pool_file_setup(void **state)
D_ALLOC_ARRAY(arg->poh, 10);
assert_ptr_not_equal(arg->poh, NULL);

- ret = vts_alloc_gen_fname(&arg->fname[0]);
- assert_int_equal(ret, 0);
+ // ret = vts_alloc_gen_fname(&arg->fname[0]);
+ // assert_int_equal(ret, 0);
return 0;
}

@@ -153,8 +153,8 @@ pool_ops_run(void **state)
VPOOL_TEST_WAL_SZ, 0,
0 /* version */, poh);
} else {
- ret = vts_alloc_gen_fname(&arg->fname[j]);
- assert_int_equal(ret, 0);
+ // ret = vts_alloc_gen_fname(&arg->fname[j]);
+ // assert_int_equal(ret, 0);
ret = vos_pool_create_ex(arg->fname[j], arg->uuid[j],
VPOOL_256M, 0, VPOOL_TEST_WAL_SZ,
0, 0 /* version */, poh);
Loading

0 comments on commit 435008d

Please sign in to comment.