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

#
# src/test/util_sds/TEST4 -- unittest for shutdown state
#

. ../unittest/unittest.sh

require_test_type medium

require_fs_type any

require_build_type debug

setup

export PMEM2_LOG_LEVEL=2
export PMEM2_LOG_FILE=./test$UNITTEST_NUM.log

# fail before setting open flag
expect_normal_exit ./util_sds 1 4 \
				   $DIR/testfile1 5 12 \
				   $DIR/testfile2 7 156 \
				   $DIR/testfile3 9 134

expect_normal_exit ./util_sds 0 0 \
				   $DIR/testfile1 5 12 \
				   $DIR/testfile2 7 156 \
				   $DIR/testfile3 9 134

grep "shutdown_state_check" test$UNITTEST_NUM.log > grep$UNITTEST_NUM.log || true

check

pass
