Skip to content

Commit

Permalink
test: scp files once at the beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
ldorau committed Sep 1, 2016
1 parent 668370d commit d641cdd
Show file tree
Hide file tree
Showing 39 changed files with 410 additions and 70 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
#
# Use "make doc" to build documentation.
#
# Use "make test" to build unit tests.
# Use "make test" to build unit tests. Add "SKIP_SYNC_REMOTES=y" to skip
# or "FORCE_SYNC_REMOTES=y" to force syncing remote nodes if any is defined.
#
# Use "make check" to run unit tests.
#
Expand Down
2 changes: 2 additions & 0 deletions src/test/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ testfile*
*.static-debug
*.static-nondebug
libs.tar
*.synced
.sync-dir
34 changes: 33 additions & 1 deletion src/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,16 @@ ifeq ($(CHECK_POOL),y)
CHECK_POOL_OPT="-c"
endif

DIR_SYNC=$(TOP)/src/test/.sync-dir
SYNC_EXT=synced

all test cstyle format: $(TESTS_BUILD)

test: sync-remotes

clean clobber: $(TESTS_BUILD)
$(RM) -r $(DIR_SYNC)
$(RM) *.$(SYNC_EXT)

$(TESTS) $(OBJ_DEPS) $(LIBPMEMPOOL_DEPS): $(TEST_DEPS)

Expand Down Expand Up @@ -411,7 +418,32 @@ pcheck-remote: TARGET = pcheck
pcheck-remote: $(REMOTE_TESTS)
@echo "No failures."

TESTCONFIG=$(TOP)/src/test/testconfig.sh

$(TESTCONFIG):

SUPP_SYNC_FILES=$(shell echo *.supp | sed s/supp/$(SYNC_EXT)/g)

%.$(SYNC_EXT): %.supp $(TESTCONFIG)
cp $^ $(DIR_SYNC)
@touch $@

# sync remote nodes
sync-remotes:
ifeq ($(FORCE_SYNC_REMOTES),y)
@touch $(TESTCONFIG)
endif
ifneq ($(SKIP_SYNC_REMOTES),y)
@rm -rf $(DIR_SYNC) && mkdir -p $(DIR_SYNC)
$(MAKE) $(SUPP_SYNC_FILES)
$(MAKE) -C tools $@
$(MAKE) -C ../tools $@
$(MAKE) -C sync-remotes $@
$(foreach test, $(REMOTE_TESTS), $(MAKE) -C $(test) sync-test;)
@rm -rf $(DIR_SYNC)
endif

.PHONY: all check clean clobber cstyle pcheck pcheck-blk pcheck-log pcheck-obj\
pcheck-other pcheck-pmem pcheck-pmempool pcheck-vmem pcheck-vmmalloc\
test unittest tools check-remote format pcheck-libpmempool\
pcheck-rpmem pcheck-local pcheck-remote $(TESTS_BUILD)
pcheck-rpmem pcheck-local pcheck-remote sync-remotes $(TESTS_BUILD)
29 changes: 24 additions & 5 deletions src/test/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ TARGET_STATIC_NONDEBUG=$(TARGET).static-nondebug
endif
endif

SCP=../sync-remotes/copy-to-remote-nodes.sh
TESTCONFIG=../testconfig.sh
SYNC_FILE=.synced

ifdef TARGET
SCP_TARGET=$(TARGET)
SCP_SRC_DIR=.
endif

MAKEFILE_DEPS=Makefile ../Makefile.inc $(TOP)/src/common.inc

all: $(TARGET) $(TARGET_STATIC_DEBUG) $(TARGET_STATIC_NONDEBUG)
Expand Down Expand Up @@ -252,26 +261,36 @@ objdir=.
$(create-deps)

clean:
$(RM) *.o */*.o core a.out *.log testfile*
$(RM) *.o */*.o core a.out *.log testfile* $(SYNC_FILE)

clobber: clean
$(RM) $(TARGET) $(TARGET_STATIC_DEBUG) $(TARGET_STATIC_NONDEBUG)
$(RM) -r .deps

$(TESTCONFIG):

$(SYNC_FILE): $(TARGET) $(TESTCONFIG)
ifeq ($(SCP_TO_REMOTE_NODES), y)
$(SCP) test $(SCP_SRC_DIR)/$(SCP_TARGET) $(SCP_SRC_DIR)/$(SCP_TARGET).static-debug $(SCP_SRC_DIR)/$(SCP_TARGET).static-nondebug
@touch $(SYNC_FILE)
endif

sync-test: all $(SYNC_FILE) $(TESTCONFIG)

TST=$(shell basename `pwd`)
TSTCHECKS=$(shell ls -1 TEST* | grep -v -i -e "\.ps1" | sort -V)

$(TSTCHECKS): all
$(TSTCHECKS): all sync-test
@cd .. && ./RUNTESTS ${TST} -b $(TEST_BUILD) -t $(TEST_TYPE) -f $(TEST_FS) -o $(TEST_TIME) -m $(MEMCHECK) -p $(PMEMCHECK) -e $(HELGRIND) -d $(DRD) -s $@

check: all
check: all sync-test
@cd .. && ./RUNTESTS ${TST} -b $(TEST_BUILD) -t $(TEST_TYPE) -f $(TEST_FS) -o $(TEST_TIME) -m $(MEMCHECK) -p $(PMEMCHECK) -e $(HELGRIND) -d $(DRD)

pcheck: export NOTTY=1

pcheck: $(TSTCHECKS)

test: all
test: all sync-test

TOOLS=../tools

Expand Down Expand Up @@ -308,6 +327,6 @@ $(TOOLS)/pmemdetect/pmemdetect.static-nondebug:

all: $(TOOLS)/pmemdetect/pmemdetect.static-nondebug

.PHONY: all check clean clobber pcheck test $(TSTCHECKS)
.PHONY: all check clean clobber pcheck test sync-test $(TSTCHECKS)

-include .deps/*.P
4 changes: 2 additions & 2 deletions src/test/obj_basic_integration/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
# unit tests
#

include ../Makefile.inc

../obj_basic_integration/obj_basic_integration:
$(MAKE) -C ../obj_basic_integration all

all: ../obj_basic_integration/obj_basic_integration

include ../Makefile.inc
3 changes: 3 additions & 0 deletions src/test/obj_rpmem_basic_integration/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
# src/test/obj_rpmem_basic_integration/Makefile -- unit test for LIBPMEMOBJ
# basic operations using remote replication (LIBRPMEM)
#
SCP_TO_REMOTE_NODES = y
SCP_TARGET = obj_basic_integration
SCP_SRC_DIR = ../obj_basic_integration

include ../obj_basic_integration/Makefile.inc
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_basic_integration/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 $TEST_FILE_REMOTE
rm_files_from_node 1 $TEST_FILE_LOCAL
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_basic_integration/TEST1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 $TEST_FILE_REMOTE
rm_files_from_node 1 $TEST_FILE_LOCAL
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_basic_integration/TEST2
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ create_poolset $DIR/$TEST_SET_LOCAL \
create_poolset $DIR/$TEST_SET_REMOTE 18M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 $TEST_FILE_REMOTE
rm_files_from_node 1 $TEST_FILE_LOCAL part1 part2
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_basic_integration/TEST3
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ create_poolset $DIR/$TEST_SET_REMOTE \
8M:${NODE_DIRS[0]}/${TEST_FILE_REMOTE}1:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 ${TEST_FILE_REMOTE}0 ${TEST_FILE_REMOTE}1
rm_files_from_node 1 ${TEST_FILE_LOCAL}0 ${TEST_FILE_LOCAL}1
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_basic_integration/TEST4
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ create_poolset $DIR/$TEST_SET_REMOTE \
r 12M:${NODE_DIRS[0]}/${TEST_FILE_REMOTE}1:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 $TEST_FILE_REMOTE
rm_files_from_node 1 $TEST_FILE_LOCAL
Expand Down
3 changes: 3 additions & 0 deletions src/test/obj_rpmem_constructor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
#
# src/test/obj_rpmem_constructor/Makefile -- build obj_rpmem_constructor test
#
SCP_TO_REMOTE_NODES = y
SCP_TARGET = obj_constructor
SCP_SRC_DIR = ../obj_constructor

include ../obj_constructor/Makefile.inc
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_constructor/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

# create remote holey pool files
create_holey_file_on_node 1 8M ${NODE_DIRS[1]}/$TEST_FILE_LOCAL
Expand Down
3 changes: 3 additions & 0 deletions src/test/obj_rpmem_heap_interrupt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
# src/test/obj_rpmem_heap_interrupt/Makefile -- build obj_rpmem_heap_interrupt
# test
#
SCP_TO_REMOTE_NODES = y
SCP_TARGET = obj_heap_interrupt
SCP_SRC_DIR = ../obj_heap_interrupt

include ../obj_heap_interrupt/Makefile.inc
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_heap_interrupt/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

# create remote holey pool files
create_holey_file_on_node 1 8M ${NODE_DIRS[1]}/$TEST_FILE_LOCAL
Expand Down
3 changes: 3 additions & 0 deletions src/test/obj_rpmem_heap_state/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
#
# src/test/obj_rpmem_heap_state/Makefile -- build obj_rpmem_heap_state test
#
SCP_TO_REMOTE_NODES = y
SCP_TARGET = obj_heap_state
SCP_SRC_DIR = ../obj_heap_state

include ../obj_heap_state/Makefile.inc
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_heap_state/TEST0
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

# create remote holey pool files
create_holey_file_on_node 1 8M ${NODE_DIRS[1]}/$TEST_FILE_LOCAL
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_heap_state/TEST1
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ create_poolset $DIR/$TEST_SET_REMOTE \
16M:${NODE_DIRS[0]}/${TEST_FILE_REMOTE}_part2:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

rm_files_from_node 0 "${TEST_FILE_REMOTE} ${TEST_FILE_REMOTE}_part1 ${TEST_FILE_REMOTE}_part2"
rm_files_from_node 1 "${TEST_FILE_LOCAL} ${TEST_FILE_LOCAL}_part1 ${TEST_FILE_LOCAL}_part2"
Expand Down
2 changes: 1 addition & 1 deletion src/test/obj_rpmem_heap_state/TEST2
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ create_poolset $DIR/$TEST_SET_LOCAL 8M:${NODE_DIRS[1]}/$TEST_FILE_LOCAL:x \
create_poolset $DIR/$TEST_SET_REMOTE 9M:${NODE_DIRS[0]}/$TEST_FILE_REMOTE:x

copy_files_to_node 0 . $DIR/$TEST_SET_REMOTE
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL ../$EXE/$EXE$EXESUFFIX
copy_files_to_node 1 . $DIR/$TEST_SET_LOCAL

PMEM_IS_PMEM_FORCE=1
export_vars_node 1 PMEM_IS_PMEM_FORCE
Expand Down
2 changes: 2 additions & 0 deletions src/test/remote_basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/remote_basic/Makefile -- build remote_basic unit test
#
SCP_TO_REMOTE_NODES = y

TARGET = remote_basic
OBJS = remote_basic.o

Expand Down
2 changes: 2 additions & 0 deletions src/test/remote_obj_basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/remote_obj_basic/Makefile -- build remote_obj_basic unit test
#
SCP_TO_REMOTE_NODES = y

TARGET = remote_obj_basic
OBJS = remote_obj_basic.o

Expand Down
2 changes: 2 additions & 0 deletions src/test/rpmem_basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/rpmem_basic/Makefile -- build rpmem_basic test
#
SCP_TO_REMOTE_NODES = y

include ../../common.inc

vpath %.c ../../common
Expand Down
2 changes: 2 additions & 0 deletions src/test/rpmem_fip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/rpmem_fip/Makefile -- build rpmem_fip test
#
SCP_TO_REMOTE_NODES = y

include ../../common.inc

vpath %.c ../../librpmem/
Expand Down
2 changes: 2 additions & 0 deletions src/test/rpmem_obc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/rpmem_obc/Makefile -- build rpmem_obc test
#
SCP_TO_REMOTE_NODES = y

vpath %.c ../../librpmem/
vpath %.c ../../rpmem_common/

Expand Down
2 changes: 2 additions & 0 deletions src/test/rpmem_obc_int/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/rpmem_obc_int/Makefile -- build rpmem_obc_int test
#
SCP_TO_REMOTE_NODES = y

vpath %.c ../../librpmem/
vpath %.c ../../rpmem_common/
vpath %.c ../../tools/rpmemd
Expand Down
2 changes: 2 additions & 0 deletions src/test/rpmemd_obc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#
# src/test/rpmemd_obc/Makefile -- build rpmemd_obc test
#
SCP_TO_REMOTE_NODES = y

vpath %.c ../../tools/rpmemd
vpath %.c ../../rpmem_common
vpath %.c ../../librpmem
Expand Down
43 changes: 43 additions & 0 deletions src/test/sync-remotes/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright 2016, 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/sync-remote/Makefile -- copy common files to remote nodes
#

DIR_SYNC=../.sync-dir

# sync remote nodes
sync-remotes:
@./copy-to-remote-nodes.sh common $(DIR_SYNC)

.PHONY: sync-remotes
Loading

0 comments on commit d641cdd

Please sign in to comment.