#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2014-2023, Intel Corporation
#
#
# magic/TEST0 -- test for magic file script
#

. ../unittest/unittest.sh

require_test_type medium

require_build_type nondebug

# There is no point in testing the file command using memcheck
# because even if it does report any problems we can't fix it
configure_valgrind force-disable

require_command file

setup

POOL=$DIR/file.pool
LOG=out${UNITTEST_NUM}.log
MAGIC=../../../utils/pmdk.magic
rm -f $LOG && touch $LOG

rm -f $POOL
expect_normal_exit $PMEMPOOL create obj $POOL
expect_normal_exit file -m $MAGIC $POOL >> $LOG

rm -f $POOL
create_poolset $POOL 32M:file.part1:x 32M:file.part2:x
expect_normal_exit file -m $MAGIC $POOL >> $LOG

rm -f $POOL
create_poolset $POOL 32M:file.part1:x 32M:file.part2:x R 32M:file.rep1:x 32M:file.rep2:x
expect_normal_exit file -m $MAGIC $POOL >> $LOG

check

pass
