#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2023, Intel Corporation
#
#
# libpmempool_backup/TEST7 -- test backup to pool which already exists
#

. ../unittest/unittest.sh

require_test_type medium

require_fs_type pmem non-pmem

setup

. ./common.sh

backup_cleanup

POOLFILE=$DIR/pool.obj
rm -f $POOLFILE

# create source poolset
expect_normal_exit $PMEMPOOL$EXESUFFIX create obj \
	"--layout test_layout" --size 20M $POOLFILE

# create backup pool file
truncate -s 20M $POOLFILE$BACKUP
backup_and_compare $POOLFILE

# create too small backup pool file
truncate -s 10M $POOLFILE$BACKUP
backup_and_compare $POOLFILE

mv $OUT_TEMP $OUT

check

pass
