#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2019, Intel Corporation
#
#
# pmempool_sync/TEST13 -- test for pools with device dax and SINGLEHDR option
#
# Device DAX devices: 2 x 2MB alignment + 2 x 4KB alignment.
# 1st variant of alignment configuration
#

. ../unittest/unittest.sh

require_test_type medium
require_fs_type any

# the test takes too long under pmemcheck
configure_valgrind pmemcheck force-disable

require_dax_device_alignments $SIZE_2MB $SIZE_2MB $SIZE_2MB $SIZE_4KB

setup

dax_device_zero

LOG=out${UNITTEST_NUM}.log

POOLSET=$DIR/poolset
create_poolset $POOLSET \
	O SINGLEHDR \
	AUTO:${DEVICE_DAX_PATH[0]} \
	AUTO:${DEVICE_DAX_PATH[1]} \
	R \
	AUTO:${DEVICE_DAX_PATH[2]} \
	AUTO:${DEVICE_DAX_PATH[3]}

expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOLSET
expect_normal_exit $PMEMPOOL$EXESUFFIX rm -f ${DEVICE_DAX_PATH[0]}
expect_normal_exit $PMEMPOOL$EXESUFFIX rm -f ${DEVICE_DAX_PATH[1]}
expect_normal_exit $PMEMPOOL$EXESUFFIX sync $POOLSET > $LOG
expect_normal_exit $PMEMPOOL$EXESUFFIX info $POOLSET &> /dev/null

pass
