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

#
# src/test/pmem_map_file/TEST2 -- unit test for pmem_map_file
#

. ../unittest/unittest.sh

require_test_type medium
require_dax_devices 1
require_fs_type any

configure_valgrind memcheck force-disable

setup

# this test invokes sigsegvs by design
export ASAN_OPTIONS=handle_segv=0

# <path> <size> <flags> <mode> <use_mlen> <use_is_pmem> <err_code>

# pass the file of zero length
expect_normal_exit ./pmem_map_file$EXESUFFIX\
    $DEVICE_DAX_PATH 0 D 0666 1 1 0\
    $DEVICE_DAX_PATH 0 DSC 0666 1 1 0\
    $DEVICE_DAX_PATH 0 DT 0666 1 1 0\
    $DEVICE_DAX_PATH 0 DCE 0666 1 1 0\
    $DEVICE_DAX_PATH 0 DC 0666 1 1 0\
    $DEVICE_DAX_PATH 2097152 DC 0666 1 1 0\ # len != 0

check

pass
