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

#
# src/test/obj_pool/TEST32 -- unit test for pmemobj_open
#                             with a bad block recovery file
#

. ../unittest/unittest.sh

require_test_type medium

setup

#
# TEST32 existing file, file size >= min required size,
#        layout matches the value from pool header
#
expect_normal_exit ./obj_pool$EXESUFFIX c $DIR/testfile "test" 20 0640

# create a bad block recovery file
create_recovery_file $DIR/testfile_r0_p0_badblocks.txt

turn_on_checking_bad_blocks $DIR/testfile

# pmemobj_open() should fail, because the bad block recovery file exists
expect_normal_exit ./obj_pool$EXESUFFIX o $DIR/testfile "test"

check

pass
