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

#
# src/test/blk_rw/TEST2 -- unit test for pmemblk_read/write/set_zero/set_error
#

. ../unittest/unittest.sh

require_test_type medium
exclude_ppc64

# doesn't make sense to run in local directory
require_fs_type pmem non-pmem
require_unlimited_vm

# this test creates huge file
configure_valgrind force-disable

setup

# multi-arena case
truncate -s 1026G $DIR/testfile1
#
# All reads to an unwritten block pool should return zeros.
# Block 268696557 is out of range and should return EINVAL.
# Attempts to zero uninitialized blocks are nops (should succeed).
#
expect_normal_exit ./blk_rw$EXESUFFIX 4096 $DIR/testfile1 c\
	r:0 r:1 r:4161480 r:268696550 r:268696551 z:0 z:4161480

check_pool $DIR/testfile1

check

pass
