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

#
# src/test/util_file_create/TEST0 -- unit test for util_file_create()
#

. ../unittest/unittest.sh

require_test_type medium

require_fs_type any

setup

MIN_POOL=0x4000

truncate -s 32K $DIR/testfile1
mkdir $DIR/testdir1
ln -s $DIR/testfile0 $DIR/testlink1
ln -s $DIR/testfile1 $DIR/testlink2
ln -s $DIR/testdir1 $DIR/testlink3
ln -s /dev/zero $DIR/testlink4

expect_normal_exit ./util_file_create$EXESUFFIX $MIN_POOL \
    $MIN_POOL:$DIR/testdir1\
    $MIN_POOL:/dev/zero\
    $MIN_POOL:$DIR/testlink1\
    $MIN_POOL:$DIR/testlink2\
    $MIN_POOL:$DIR/testlink3\
    $MIN_POOL:$DIR/testlink4\
    $MIN_POOL:$DIR/testfile1\
    0x1000:$DIR/testfile2\
    $MIN_POOL:$DIR/testfile3

check

pass
