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

#
# src/test/obj_sds/TEST6 -- unittest for shutdown state
#

. ../unittest/unittest.sh

require_test_type medium

require_fs_type any

require_build_type debug

require_sds ./obj_sds

setup

POOLSET=$DIR/pool.set

# Create poolset file
create_poolset $POOLSET \
			   20M:$DIR/testfile01:x \
			   20M:$DIR/testfile02:x \
			   20M:$DIR/testfile03:x \
			   R \
			   40M:$DIR/testfile14:x \
			   20M:$DIR/testfile15:x

# no error
expect_normal_exit ./obj_sds 1 0 $POOLSET\
				   5 0 7 0 9 0 11 0 12 0

# the pool closed and ADR failure
expect_abnormal_exit ./obj_sds 0 1 $POOLSET\
				   5 1 7 1 9 1 11 0 12 0

PMEMOBJ_LOG_LEVEL=4

# the pool not closed and pool moved
expect_abnormal_exit ./obj_sds 0 0 $POOLSET\
				   43 0 11 0 23 0 11 0 12 0
pass
