From 167c5175ee1e8e467ae8f77f9982cbfb35ac4e6d Mon Sep 17 00:00:00 2001
From: Pawel Lebioda <pawel.lebioda@intel.com>
Date: Tue, 21 Mar 2017 15:44:25 +0100
Subject: [PATCH] pool: fix removing pool with remote replica

Loading symbols from librpmem was missing.

Ref: pmem/issues#499
---
 src/libpmempool/libpmempool.c            |  2 +
 src/libpmempool/rm.c                     |  6 ++
 src/test/Makefile                        |  3 +-
 src/test/libpmempool_rm/Makefile.inc     | 42 +++++++++++++
 src/test/libpmempool_rm_remote/Makefile  | 41 +++++++++++++
 src/test/libpmempool_rm_remote/TEST0     | 75 +++++++++++++++++++++++
 src/test/libpmempool_rm_remote/TEST1     | 74 +++++++++++++++++++++++
 src/test/libpmempool_rm_remote/TEST2     | 73 ++++++++++++++++++++++
 src/test/libpmempool_rm_remote/TEST3     | 77 ++++++++++++++++++++++++
 src/test/libpmempool_rm_remote/config.sh | 41 +++++++++++++
 src/test/unittest/unittest.sh            | 23 +++++++
 11 files changed, 456 insertions(+), 1 deletion(-)
 create mode 100644 src/test/libpmempool_rm/Makefile.inc
 create mode 100644 src/test/libpmempool_rm_remote/Makefile
 create mode 100755 src/test/libpmempool_rm_remote/TEST0
 create mode 100755 src/test/libpmempool_rm_remote/TEST1
 create mode 100755 src/test/libpmempool_rm_remote/TEST2
 create mode 100755 src/test/libpmempool_rm_remote/TEST3
 create mode 100644 src/test/libpmempool_rm_remote/config.sh

diff --git a/src/libpmempool/libpmempool.c b/src/libpmempool/libpmempool.c
index cd28bc576..4cacb4c59 100644
--- a/src/libpmempool/libpmempool.c
+++ b/src/libpmempool/libpmempool.c
@@ -69,6 +69,7 @@ libpmempool_init(void)
 	LOG(3, NULL);
 #ifdef USE_RPMEM
 	util_remote_init();
+	util_remote_load();
 	rpmem_util_cmds_init();
 #endif
 }
@@ -84,6 +85,7 @@ libpmempool_fini(void)
 {
 	LOG(3, NULL);
 #ifdef USE_RPMEM
+	util_remote_unload();
 	util_remote_fini();
 	rpmem_util_cmds_fini();
 #endif
diff --git a/src/libpmempool/rm.c b/src/libpmempool/rm.c
index 79f6880c7..f1e82cf0e 100644
--- a/src/libpmempool/rm.c
+++ b/src/libpmempool/rm.c
@@ -101,6 +101,12 @@ rm_local(const char *path, int flags, int is_part_file)
 static int
 rm_remote(const char *node, const char *path, int flags)
 {
+	if (!Rpmem_remove) {
+		ERR_F(flags, "cannot remove remote replica"
+			" -- missing librpmem");
+		return -1;
+	}
+
 	int rpmem_flags = 0;
 	if (CHECK_FLAG(flags, FORCE))
 		rpmem_flags |= RPMEM_REMOVE_FORCE;
diff --git a/src/test/Makefile b/src/test/Makefile
index ac006dfea..7f6fd7bd7 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -306,7 +306,8 @@ REMOTE_TESTS = \
 	$(OBJ_REMOTE_TESTS)\
 	$(RPMEM_TESTS)\
 	pmempool_sync_remote\
-	pmempool_transform_remote
+	pmempool_transform_remote\
+	libpmempool_rm_remote
 
 ifeq ($(filter n,$(call check_cxx_flags, -std=c++11) $(call check_clang_template_bug)),)
 LOCAL_TESTS += $(OBJ_CPP_TESTS)
diff --git a/src/test/libpmempool_rm/Makefile.inc b/src/test/libpmempool_rm/Makefile.inc
new file mode 100644
index 000000000..a296b721e
--- /dev/null
+++ b/src/test/libpmempool_rm/Makefile.inc
@@ -0,0 +1,42 @@
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# src/test/libpmempool_rm/Makefile.inc -- build libpmempool_rm test
+#
+
+include ../Makefile.inc
+
+../libpmempool_rm/libpmempool_rm:
+	$(MAKE) -C ../libpmempool_rm all
+
+all: ../libpmempool_rm/libpmempool_rm
diff --git a/src/test/libpmempool_rm_remote/Makefile b/src/test/libpmempool_rm_remote/Makefile
new file mode 100644
index 000000000..88a09b450
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# src/test/libpmempool_rm_remote/Makefile -- unit test for pmempool_rm
+# with remote replica
+#
+SCP_TO_REMOTE_NODES = y
+SCP_TARGET = libpmempool_rm
+SCP_SRC_DIR = ../libpmempool_rm
+
+include ../libpmempool_rm/Makefile.inc
diff --git a/src/test/libpmempool_rm_remote/TEST0 b/src/test/libpmempool_rm_remote/TEST0
new file mode 100755
index 000000000..ac42fdfb9
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/TEST0
@@ -0,0 +1,75 @@
+#!/bin/bash -e
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# libpmempool_rm_remote/TEST0 -- test for pmempool_rm with remote replica
+#
+# Remove pool, do not remove local and remote pool sets.
+#
+export UNITTEST_NAME=libpmempool_rm_remote/TEST0
+export UNITTEST_NUM=0
+
+# standard unit test setup
+. ../unittest/unittest.sh
+
+require_test_type medium
+
+setup
+
+require_nodes 2
+
+require_node_libfabric 0 $RPMEM_PROVIDER
+require_node_libfabric 1 $RPMEM_PROVIDER
+
+init_rpmem_on_node 1 0
+
+create_poolset $DIR/pool.set 8M:$(get_node_dir 1)/pool.1:x \
+        m ${NODE_ADDR[0]}:remote.set
+create_poolset $DIR/remote.set 8M:$(get_node_dir 0)/remote.1:x
+
+copy_files_to_node 0 . $DIR/remote.set
+copy_files_to_node 1 . $DIR/pool.set
+
+rm_files_from_node 0 remote.1
+rm_files_from_node 1 pool.1
+
+expect_normal_exit run_on_node 1 ../pmempool create obj pool.set
+check_files_on_node 1 pool.set pool.1
+check_files_on_node 0 remote.set remote.1
+
+expect_normal_exit run_on_node 1 ./libpmempool_rm$EXESUFFIX pool.set
+check_files_on_node 1 pool.set
+check_files_on_node 0 remote.set
+check_no_files_on_node 1 pool.1
+check_no_files_on_node 0 remote.1
+
+pass
diff --git a/src/test/libpmempool_rm_remote/TEST1 b/src/test/libpmempool_rm_remote/TEST1
new file mode 100755
index 000000000..6f6e981be
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/TEST1
@@ -0,0 +1,74 @@
+#!/bin/bash -e
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# libpmempool_rm_remote/TEST1 -- test for pmempool_rm with remote replica
+#
+# Remove pool and local pool set, do not remove remote pool set.
+#
+export UNITTEST_NAME=libpmempool_rm_remote/TEST1
+export UNITTEST_NUM=1
+
+# standard unit test setup
+. ../unittest/unittest.sh
+
+require_test_type medium
+
+setup
+
+require_nodes 2
+
+require_node_libfabric 0 $RPMEM_PROVIDER
+require_node_libfabric 1 $RPMEM_PROVIDER
+
+init_rpmem_on_node 1 0
+
+create_poolset $DIR/pool.set 8M:$(get_node_dir 1)/pool.1:x \
+        m ${NODE_ADDR[0]}:remote.set
+create_poolset $DIR/remote.set 8M:$(get_node_dir 0)/remote.1:x
+
+copy_files_to_node 0 . $DIR/remote.set
+copy_files_to_node 1 . $DIR/pool.set
+
+rm_files_from_node 0 remote.1
+rm_files_from_node 1 pool.1
+
+expect_normal_exit run_on_node 1 ../pmempool create obj pool.set
+check_files_on_node 1 pool.set pool.1
+check_files_on_node 0 remote.set remote.1
+
+expect_normal_exit run_on_node 1 ./libpmempool_rm$EXESUFFIX -l pool.set
+check_files_on_node 0 remote.set
+check_no_files_on_node 1 pool.set pool.1
+check_no_files_on_node 0 remote.1
+
+pass
diff --git a/src/test/libpmempool_rm_remote/TEST2 b/src/test/libpmempool_rm_remote/TEST2
new file mode 100755
index 000000000..4c63d22f3
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/TEST2
@@ -0,0 +1,73 @@
+#!/bin/bash -e
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# libpmempool_rm_remote/TEST2 -- test for pmempool_rm with remote replica
+#
+# Remove pool, local and remote pool sets.
+#
+export UNITTEST_NAME=libpmempool_rm_remote/TEST2
+export UNITTEST_NUM=2
+
+# standard unit test setup
+. ../unittest/unittest.sh
+
+require_test_type medium
+
+setup
+
+require_nodes 2
+
+require_node_libfabric 0 $RPMEM_PROVIDER
+require_node_libfabric 1 $RPMEM_PROVIDER
+
+init_rpmem_on_node 1 0
+
+create_poolset $DIR/pool.set 8M:$(get_node_dir 1)/pool.1:x \
+        m ${NODE_ADDR[0]}:remote.set
+create_poolset $DIR/remote.set 8M:$(get_node_dir 0)/remote.1:x
+
+copy_files_to_node 0 . $DIR/remote.set
+copy_files_to_node 1 . $DIR/pool.set
+
+rm_files_from_node 0 remote.1
+rm_files_from_node 1 pool.1
+
+expect_normal_exit run_on_node 1 ../pmempool create obj pool.set
+check_files_on_node 1 pool.set pool.1
+check_files_on_node 0 remote.set remote.1
+
+expect_normal_exit run_on_node 1 ./libpmempool_rm$EXESUFFIX -l -r pool.set
+check_no_files_on_node 1 pool.set pool.1
+check_no_files_on_node 0 remote.set remote.1
+
+pass
diff --git a/src/test/libpmempool_rm_remote/TEST3 b/src/test/libpmempool_rm_remote/TEST3
new file mode 100755
index 000000000..ffbc7dbc9
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/TEST3
@@ -0,0 +1,77 @@
+#!/bin/bash -e
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# libpmempool_rm_remote/TEST3 -- test for pmempool_rm with remote replica
+#
+# Remove pool, do not remove local and remote pool sets.
+#
+export UNITTEST_NAME=libpmempool_rm_remote/TEST3
+export UNITTEST_NUM=3
+
+# standard unit test setup
+. ../unittest/unittest.sh
+
+require_test_type medium
+
+setup
+
+require_nodes 2
+
+require_node_libfabric 0 $RPMEM_PROVIDER
+require_node_libfabric 1 $RPMEM_PROVIDER
+require_node_dax_device 0
+
+init_rpmem_on_node 1 0
+
+create_poolset $DIR/pool.set 8M:$(get_node_dir 1)/pool.1:x \
+        m ${NODE_ADDR[0]}:remote.set
+create_poolset $DIR/remote.set AUTO:${NODE_DEVICE_DAX_PATH[0]}
+
+copy_files_to_node 0 . $DIR/remote.set
+copy_files_to_node 1 . $DIR/pool.set
+
+expect_normal_exit run_on_node 1 ./libpmempool_rm$EXESUFFIX -f pool.set
+
+expect_normal_exit run_on_node 1 ../pmempool create obj pool.set
+check_files_on_node 1 pool.set pool.1
+check_files_on_node 0 remote.set
+
+expect_normal_exit run_on_node 1 ./libpmempool_rm$EXESUFFIX pool.set
+check_files_on_node 1 pool.set
+check_files_on_node 0 remote.set
+check_no_files_on_node 1 pool.1
+
+# Verify that we can create pool on device dax after removing it.
+expect_normal_exit run_on_node 1 ../pmempool create obj pool.set
+
+pass
diff --git a/src/test/libpmempool_rm_remote/config.sh b/src/test/libpmempool_rm_remote/config.sh
new file mode 100644
index 000000000..40effdec5
--- /dev/null
+++ b/src/test/libpmempool_rm_remote/config.sh
@@ -0,0 +1,41 @@
+#!/bin/bash -e
+#
+# Copyright 2017, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#
+#     * Neither the name of the copyright holder nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# libpmempool_rm_remote/config.sh -- test configuration
+#
+
+CONF_GLOBAL_FS_TYPE=any
+CONF_GLOBAL_BUILD_TYPE="debug nondebug"
+
+CONF_GLOBAL_RPMEM_PROVIDER=all
+CONF_GLOBAL_RPMEM_PMETHOD=all
diff --git a/src/test/unittest/unittest.sh b/src/test/unittest/unittest.sh
index 3c6018d41..9a58f344e 100644
--- a/src/test/unittest/unittest.sh
+++ b/src/test/unittest/unittest.sh
@@ -1275,6 +1275,7 @@ function run_command()
 	fi
 }
 
+
 #
 # validate_node_number -- validate a node number
 #
@@ -1479,6 +1480,28 @@ function require_nodes() {
 	return 0
 }
 
+#
+# check_files_on_node -- check if specified files exist on given node
+#
+function check_files_on_node() {
+	validate_node_number $1
+	local N=$1
+	shift
+	local REMOTE_DIR=${NODE_WORKING_DIR[$N]}/$curtestdir
+	run_command ssh $SSH_OPTS ${NODE[$N]} "for f in $*; do if [ ! -f $REMOTE_DIR/\$f ]; then echo \"Missing file \$f on node #$N\" 1>&2; exit 1; fi; done"
+}
+
+#
+# check_no_files_on_node -- check if specified files does not exist on given node
+#
+function check_no_files_on_node() {
+	validate_node_number $1
+	local N=$1
+	shift
+	local REMOTE_DIR=${NODE_WORKING_DIR[$N]}/$curtestdir
+	run_command ssh $SSH_OPTS ${NODE[$N]} "for f in $*; do if [ -f $REMOTE_DIR/\$f ]; then echo \"Not deleted file \$f on node #$N\" 1>&2; exit 1; fi; done"
+}
+
 #
 # copy_files_to_node -- copy all required files to the given remote node
 #    usage: copy_files_to_node <node> <destination dir> <file_1> [<file_2>] ...
-- 
GitLab