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

. ../unittest/unittest.sh

require_test_type short

setup

CONFIG_ID=0

expect_normal_exit $PMEMPOOL$EXESUFFIX\
	create --layout obj_ctl_config obj $DIR/testfile0

while true
do
	UNITTEST_NUM=$CONFIG_ID
	CONFIG_FILE=config$CONFIG_ID

	if [ ! -f $CONFIG_FILE ]; then
		break
	fi

	# skip configs that include comments for env variable test
	if ! grep -q '#' $CONFIG_FILE ; then
		PMEMOBJ_CONF=`cat $CONFIG_FILE`\
			expect_normal_exit\
			./obj_ctl_config$EXESUFFIX $DIR/testfile0
		check
	fi

	PMEMOBJ_CONF_FILE=$CONFIG_FILE\
		expect_normal_exit\
		./obj_ctl_config$EXESUFFIX $DIR/testfile0
	check

	CONFIG_ID=$(($CONFIG_ID+1))
done

pass
