#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2023, Intel Corporation
#
#
# pmempool_check/TEST27 -- test for checking pools with device dax
#
# Same as TEST14, but run on a pool set that spans two Device DAX devices
# with 2M alignment.
#

. ../unittest/unittest.sh

require_test_type medium
require_fs_type any

require_dax_device_alignments 2097152 2097152 # 2MiB

# memcheck covered by TEST23, pmemcheck takes too long
configure_valgrind force-disable $PMEMPOOL$EXESUFFIX

setup

LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

POOLSET=$DIR/testset1
create_poolset $POOLSET AUTO:${DEVICE_DAX_PATH[0]} AUTO:${DEVICE_DAX_PATH[1]} \
	O SINGLEHDR

expect_normal_exit $PMEMPOOL$EXESUFFIX rm $POOLSET
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOLSET
expect_normal_exit $PMEMPOOL$EXESUFFIX check -v $POOLSET >> $LOG
expect_normal_exit $PMEMPOOL$EXESUFFIX info $POOLSET &> /dev/null

#remove the pools in the poolset while preserving the file itself
expect_normal_exit $PMEMPOOL$EXESUFFIX rm -s $POOLSET
#verify that the poolset still exists
check_files $POOLSET

check

pass
