#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2019, Intel Corporation

#
# src/test/util_poolset_parse/TEST2 -- unit test for parsing a pool set file
#

. ../unittest/unittest.sh

require_test_type medium

require_build_type debug
require_fs_type any
require_dax_device_alignments 4096 4096

setup

export PARSER_LOG_LEVEL=4
export PARSER_LOG_FILE=./parser$UNITTEST_NUM.log

create_poolset $DIR/testset1 AUTO:${DEVICE_DAX_PATH[0]}

create_poolset $DIR/testset2 AUTO:${DEVICE_DAX_PATH[1]}

create_poolset $DIR/testset3 AUTO:${DEVICE_DAX_PATH[0]} 100G:$DIR/testfile1:x

create_poolset $DIR/testset4 AUTO:${DEVICE_DAX_PATH[0]} AUTO:${DEVICE_DAX_PATH[1]}

POOLSETS="$DIR/testset1 $DIR/testset2 $DIR/testset3 $DIR/testset4"

expect_normal_exit ./util_poolset_parse$EXESUFFIX t $POOLSETS

$GREP -e "<[14]>.*\[.*util_poolset_parse\]" ./parser$UNITTEST_NUM.log | \
	sed -e "s/^.*util_poolset_parse][ ]*//g" > grep$UNITTEST_NUM.log

check

pass
