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

#
# src/test/blk_recovery/TEST0 -- unit test for pmemblk recovery
#

. ../unittest/unittest.sh

require_test_type medium

# doesn't make sense to run in local directory
require_fs_type pmem non-pmem
require_build_type nondebug static-nondebug

setup

# single arena case
truncate -s 2G $DIR/testfile1

#
# Simple case, one write interrupted.  pmemblk_check() should note
# that testfile1 is consistent (after recovery steps were taken).
#
expect_abnormal_exit ./blk_recovery$EXESUFFIX 4096 $DIR/testfile1 5 10 2>/dev/null
mv out0.log interrupted0.log

expect_normal_exit ./blk_recovery$EXESUFFIX 4096 $DIR/testfile1
mv out0.log check0.log

check_pool $DIR/testfile1

check

pass
