#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2018, Intel Corporation
#
#
# libpmempool_rm/TEST2 -- test for pmempool_rm with non-pool files
#

. ../unittest/unittest.sh

require_test_type medium

require_fs_type any

setup

enable_log_append

echo -n TEST > $DIR/file.1
echo TEST > $DIR/file.2
touch $DIR/file.3
echo NOTAPMEMPOOLSET > $DIR/file.4

check_files $DIR/file.1 $DIR/file.2 $DIR/file.3 $DIR/file.4

# this should remove all the files
expect_normal_exit ./libpmempool_rm$EXESUFFIX $DIR/file.1 $DIR/file.2 $DIR/file.3 $DIR/file.4

# check if all pool files are removed
check_no_files $DIR/file.1 $DIR/file.2 $DIR/file.3 $DIR/file.4

# this should report errors for all files
expect_normal_exit ./libpmempool_rm$EXESUFFIX $DIR/file.1 $DIR/file.2 $DIR/file.3 $DIR/file.4
# this should ignore all errors
expect_normal_exit ./libpmempool_rm$EXESUFFIX -f $DIR/file.1 $DIR/file.2 $DIR/file.3 $DIR/file.4

check

pass
