From 37ac0275ab0e636f3678486dc74dea8fe2fbf46a Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Mon, 4 Jun 2018 11:39:52 +0200 Subject: [PATCH] examples: add build system --- CMakeLists.txt | 18 ++- examples/CMakeLists.txt | 109 ++++++++++++++++ examples/README | 12 +- examples/doc_snippets/doc_snippets.vcxproj | 69 ----------- .../doc_snippets/doc_snippets.vcxproj.filters | 26 ---- examples/map_cli/.gitignore | 1 - examples/map_cli/ctree_map_persistent.hpp | 11 +- examples/map_cli/ctree_map_transient.hpp | 11 +- examples/map_cli/map_cli.cpp | 4 +- examples/map_cli/map_cli.vcxproj | 65 ---------- examples/map_cli/map_cli.vcxproj.filters | 21 ---- examples/objcpp_examples_common.hpp | 93 ++++++++++++++ .../{list.hpp => objcpp_examples_list.hpp} | 5 + examples/panaconda/.gitignore | 1 - examples/panaconda/Makefile | 60 --------- examples/panaconda/README | 4 - examples/panaconda/panaconda.hpp | 11 +- examples/pman/.gitignore | 1 - examples/pman/Makefile | 53 -------- examples/pman/README | 4 - examples/pman/pman.cpp | 2 +- examples/pmpong/.gitignore | 5 - examples/pmpong/Ball.hpp | 8 +- examples/pmpong/GameConstants.hpp | 6 +- examples/pmpong/GameController.hpp | 7 +- examples/pmpong/GameOverView.hpp | 9 +- examples/pmpong/GameView.hpp | 9 +- examples/pmpong/Makefile | 70 ----------- examples/pmpong/MenuView.hpp | 8 +- examples/pmpong/Paddle.hpp | 8 +- examples/pmpong/PongGameStatus.hpp | 8 +- examples/pmpong/Pool.hpp | 9 +- examples/pmpong/README | 4 - examples/pmpong/View.hpp | 9 +- examples/pmpong/pmpong.vcxproj | 117 ------------------ examples/pmpong/pmpong.vcxproj.filters | 77 ------------ examples/queue/.gitignore | 1 - examples/queue/Makefile | 39 ------ examples/queue/queue.cpp | 4 +- examples/queue/queue.vcxproj | 57 --------- examples/queue/queue.vcxproj.filters | 13 -- tests/CMakeLists.txt | 24 +++- .../Makefile => tests/ex-pman/ex-pman_0.cmake | 22 ++-- .../ex-pman/prepare_input.sh | 16 +-- .../ex-queue/ex-queue_0.cmake | 21 ++-- .../out0.log.match | 0 tests/ex_libpmemobj_cpp/Makefile | 51 -------- tests/ex_libpmemobj_cpp/TEST0 | 60 --------- tests/ex_libpmemobj_cpp/TEST0.PS1 | 55 -------- tests/ex_libpmemobj_cpp/TEST1 | 67 ---------- .../ex_libpmemobj_cpp.vcxproj | 78 ------------ .../ex_libpmemobj_cpp.vcxproj.filters | 19 --- tests/helpers.cmake | 10 ++ utils/docker/images/Dockerfile.fedora-25 | 2 + utils/docker/images/Dockerfile.ubuntu-16.04 | 2 + 55 files changed, 360 insertions(+), 1116 deletions(-) create mode 100644 examples/CMakeLists.txt delete mode 100644 examples/doc_snippets/doc_snippets.vcxproj delete mode 100644 examples/doc_snippets/doc_snippets.vcxproj.filters delete mode 100644 examples/map_cli/.gitignore delete mode 100644 examples/map_cli/map_cli.vcxproj delete mode 100644 examples/map_cli/map_cli.vcxproj.filters create mode 100644 examples/objcpp_examples_common.hpp rename examples/{list.hpp => objcpp_examples_list.hpp} (97%) delete mode 100644 examples/panaconda/.gitignore delete mode 100644 examples/panaconda/Makefile delete mode 100644 examples/pman/.gitignore delete mode 100644 examples/pman/Makefile delete mode 100644 examples/pmpong/.gitignore delete mode 100644 examples/pmpong/Makefile delete mode 100644 examples/pmpong/pmpong.vcxproj delete mode 100644 examples/pmpong/pmpong.vcxproj.filters delete mode 100644 examples/queue/.gitignore delete mode 100644 examples/queue/Makefile delete mode 100644 examples/queue/queue.vcxproj delete mode 100644 examples/queue/queue.vcxproj.filters rename examples/doc_snippets/Makefile => tests/ex-pman/ex-pman_0.cmake (79%) rename examples/Makefile => tests/ex-pman/prepare_input.sh (85%) mode change 100644 => 100755 rename examples/map_cli/Makefile => tests/ex-queue/ex-queue_0.cmake (76%) rename tests/{ex_libpmemobj_cpp => ex-queue}/out0.log.match (100%) delete mode 100644 tests/ex_libpmemobj_cpp/Makefile delete mode 100755 tests/ex_libpmemobj_cpp/TEST0 delete mode 100644 tests/ex_libpmemobj_cpp/TEST0.PS1 delete mode 100755 tests/ex_libpmemobj_cpp/TEST1 delete mode 100644 tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj delete mode 100644 tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj.filters diff --git a/CMakeLists.txt b/CMakeLists.txt index dc73be305a..79108e1d74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,15 @@ function(join SEP OUT VALUES) set(${OUT} "${JOIN_TMP}" PARENT_SCOPE) endfunction() +# prepends prefix to list of strings +function(prepend var prefix) + set(listVar "") + foreach(f ${ARGN}) + list(APPEND listVar "${prefix}/${f}") + endforeach(f) + set(${var} "${listVar}" PARENT_SCOPE) +endfunction() + # Checks whether flag is supported by current C++ compiler and appends # it to the relevant cmake variable. # 1st argument is a flag @@ -264,6 +273,9 @@ endif(DEVELOPER_MODE) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.hpp") +install(DIRECTORY examples/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples + FILES_MATCHING PATTERN "*.*pp") + configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" @@ -343,4 +355,8 @@ if(BUILD_DOC) add_subdirectory(doc) endif() -#XXX: examples +if(BUILD_EXAMPLES AND NO_GCC_VARIADIC_TEMPLATE_BUG) + add_subdirectory(examples) +elseif(BUILD_EXAMPLES) + message(WARNING "Skipping build of examples because of compiler issue") +endif() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..82ad108920 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,109 @@ +# +# Copyright 2018, 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. + +include_directories(${PMEMOBJ_INCLUDE_DIRS} .) +link_directories(${PMEMOBJ_LIBRARY_DIRS}) + +add_cppstyle(examples-common ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) +add_check_whitespace(examples-common ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) + +function(add_example name srcs) + prepend(srcs ${CMAKE_CURRENT_SOURCE_DIR} ${srcs}) + add_executable(example-${name} ${srcs}) + add_cppstyle(examples-${name} ${srcs}) + add_check_whitespace(examples-${name} ${srcs}) +endfunction() + +if(PKG_CONFIG_FOUND) + pkg_check_modules(CURSES QUIET ncurses) +else() + # Specifies that we want FindCurses to find ncurses and not just any + # curses library + set(CURSES_NEED_NCURSES TRUE) + find_package(Curses QUIET) +endif() + +if(PKG_CONFIG_FOUND) + pkg_check_modules(SFML QUIET sfml-all>=2.4) +else() + find_package(SFML 2.4 QUIET all) +endif() + +add_example(queue queue/queue.cpp) +target_link_libraries(example-queue ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + +if(CURSES_FOUND) + add_example(pman pman/pman.cpp) + target_include_directories(example-pman PUBLIC ${CURSES_INCLUDE_DIR}) + target_link_libraries(example-pman ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURSES_LIBRARIES}) +else() + message(WARNING "ncurses not found - pman won't be build") +endif() + +if(SFML_FOUND) + add_example(pmpong pmpong/Ball.cpp pmpong/GameController.cpp pmpong/GameOverView.cpp + pmpong/GameView.cpp pmpong/MainGame.cpp pmpong/MenuView.cpp pmpong/Paddle.cpp + pmpong/PongGameStatus.cpp pmpong/Pool.cpp) + target_include_directories(example-pmpong PUBLIC ${SFML_INCLUDE_DIR}) + target_link_libraries(example-pmpong ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${SFML_LIBRARIES}) + + if(NOT WIN32) + execute_process(COMMAND uname -s OUTPUT_VARIABLE SYSTEM_TYPE) + if(SYSTEM_TYPE STREQUAL "FreeBSD") + set(FONTDIR "/usr/local/share/fonts") + else() + set(FONTDIR "/usr/share/fonts") + endif() + file(GLOB_RECURSE fonts ${FONTDIR}/*.ttf) + list(GET fonts 0 font) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fontConf ${font}) + endif() +else() + message(WARNING "SFML 2.4 or newer not found - pmpong won't be build") +endif() + +if(CURSES_FOUND) + add_example(panaconda panaconda/panaconda.cpp) + target_include_directories(example-panaconda PUBLIC ${CURSES_INCLUDE_DIR}) + target_link_libraries(example-panaconda ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURSES_LIBRARIES}) +else() + message(WARNING "ncurses not found - panaconda won't be build") +endif() + +add_example(map_cli map_cli/map_cli.cpp) +target_link_libraries(example-map_cli ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + +#XXX : fix compile error on clang +#add_library(doc_snippets_persistent OBJECT doc_snippets/persistent.cpp) +add_library(doc_snippets_make_persistent OBJECT doc_snippets/make_persistent.cpp) +add_library(doc_snippets_mutex OBJECT doc_snippets/mutex.cpp) +add_library(doc_snippets_pool OBJECT doc_snippets/pool.cpp) +add_library(doc_snippets_transaction OBJECT doc_snippets/transaction.cpp) diff --git a/examples/README b/examples/README index 00e3b3d664..f616436fb9 100644 --- a/examples/README +++ b/examples/README @@ -1,17 +1,7 @@ -Persistent Memory Development Kit - -This is examples/libpmemobj++/README. - -This directory contains examples for libpmemobj++, the library providing +This directory contains examples for libpmemobj-cpp, the library providing a transactional object store for pmem. Some of these examples are explained in more detail here: http://pmem.io/pmdk/cpp_obj/ -To build these examples: - make - -These examples can be built against an installed system using: - make LIBDIR=/usr/lib INCDIR=/usr/include - If you're looking for documentation to get you started using PMDK, start here: http://pmem.io/pmdk and follow the links to examples and man pages. diff --git a/examples/doc_snippets/doc_snippets.vcxproj b/examples/doc_snippets/doc_snippets.vcxproj deleted file mode 100644 index 1374825c14..0000000000 --- a/examples/doc_snippets/doc_snippets.vcxproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {8DB4158E-96EE-4DE5-A425-C9638F50B9ED} - pmemobj - 10.0.16299.0 - - - - StaticLibrary - true - v140 - - - StaticLibrary - false - v140 - true - - - - - - - - - - $(solutionDir)include;$(IncludePath);$(WindowsSDK_IncludePath); - - - - ..\..\LongPath.manifest - - - - - 4101 - - - true - - - - - 4101 - - - true - - - - - - - - - - - \ No newline at end of file diff --git a/examples/doc_snippets/doc_snippets.vcxproj.filters b/examples/doc_snippets/doc_snippets.vcxproj.filters deleted file mode 100644 index 55a726b3cb..0000000000 --- a/examples/doc_snippets/doc_snippets.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/examples/map_cli/.gitignore b/examples/map_cli/.gitignore deleted file mode 100644 index 7265119039..0000000000 --- a/examples/map_cli/.gitignore +++ /dev/null @@ -1 +0,0 @@ -map_cli diff --git a/examples/map_cli/ctree_map_persistent.hpp b/examples/map_cli/ctree_map_persistent.hpp index 8a129a339a..6edbec92af 100644 --- a/examples/map_cli/ctree_map_persistent.hpp +++ b/examples/map_cli/ctree_map_persistent.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, Intel Corporation + * Copyright 2016-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,10 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EXAMPLES_CTREE_MAP_PERSISTENT_HPP -#define EXAMPLES_CTREE_MAP_PERSISTENT_HPP +#ifndef OBJCPP_EXAMPLES_CTREE_MAP_PERSISTENT_HPP +#define OBJCPP_EXAMPLES_CTREE_MAP_PERSISTENT_HPP + #include -#include #include #include @@ -44,6 +44,7 @@ #include #include #include +#include #define BIT_IS_SET(n, i) (!!((n) & (1ULL << (i)))) @@ -442,4 +443,4 @@ class ctree_map_p { } /* namespace examples */ -#endif /* EXAMPLES_CTREE_MAP_PERSISTENT_HPP */ +#endif /* OBJCPP_EXAMPLES_CTREE_MAP_PERSISTENT_HPP */ diff --git a/examples/map_cli/ctree_map_transient.hpp b/examples/map_cli/ctree_map_transient.hpp index 459ab790cb..d51abe5674 100644 --- a/examples/map_cli/ctree_map_transient.hpp +++ b/examples/map_cli/ctree_map_transient.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, Intel Corporation + * Copyright 2016-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,12 +30,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EXAMPLES_CTREE_MAP_VOLATILE_HPP -#define EXAMPLES_CTREE_MAP_VOLATILE_HPP +#ifndef OBJCPP_EXAMPLES_CTREE_MAP_VOLATILE_HPP +#define OBJCPP_EXAMPLES_CTREE_MAP_VOLATILE_HPP + #include -#include #include #include +#include #ifdef _WIN32 #include #endif @@ -411,4 +412,4 @@ class ctree_map_transient { } /* namespace examples */ -#endif /* EXAMPLES_CTREE_MAP_VOLATILE_HPP */ +#endif /* OBJCPP_EXAMPLES_CTREE_MAP_VOLATILE_HPP */ diff --git a/examples/map_cli/map_cli.cpp b/examples/map_cli/map_cli.cpp index a99ca28d3d..0673050040 100644 --- a/examples/map_cli/map_cli.cpp +++ b/examples/map_cli/map_cli.cpp @@ -30,12 +30,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "ctree_map_persistent.hpp" #include "ctree_map_transient.hpp" -#include -#include #include #include #include +#include #include namespace diff --git a/examples/map_cli/map_cli.vcxproj b/examples/map_cli/map_cli.vcxproj deleted file mode 100644 index a1149f8ee2..0000000000 --- a/examples/map_cli/map_cli.vcxproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {9D1C3F29-1268-4241-BEFB-89D2859C62D3} - pmemobj_cpp - 10.0.16299.0 - - - - {1baa1617-93ae-4196-8a1a-bd492fb18aef} - - - {9e9e3d25-2139-4a5d-9200-18148ddead45} - - - - - Application - true - v140 - - - Application - false - v140 - true - - - - .;$(ProjectDir)..\..\;$(solutionDir)include;$(IncludePath);$(WindowsSDK_IncludePath); - - - - ..\..\..\LongPath.manifest - - - - - - - - - - - CompileAsCpp - - - - - - - - - - \ No newline at end of file diff --git a/examples/map_cli/map_cli.vcxproj.filters b/examples/map_cli/map_cli.vcxproj.filters deleted file mode 100644 index 3c36ed10e4..0000000000 --- a/examples/map_cli/map_cli.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {18ad259a-a231-4ac5-95b1-42c10fc3df57} - - - {cd05d003-c025-4e56-92d4-592230215034} - - - - - Source Files - - - - - Header Files - - - \ No newline at end of file diff --git a/examples/objcpp_examples_common.hpp b/examples/objcpp_examples_common.hpp new file mode 100644 index 0000000000..372d3e52c5 --- /dev/null +++ b/examples/objcpp_examples_common.hpp @@ -0,0 +1,93 @@ +/* + * Copyright 2018, 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. + */ + +#ifndef OBJCPP_EXAMPLES_COMMON_HPP +#define OBJCPP_EXAMPLES_COMMON_HPP + +#include + +#ifndef _WIN32 + +#include + +#define CREATE_MODE_RW (S_IWUSR | S_IRUSR) + +/* + * file_exists -- checks if file exists + */ +static inline int +file_exists(char const *file) +{ + return access(file, F_OK); +} + +/* + * find_last_set_64 -- returns last set bit position or -1 if set bit not found + */ +static inline int +find_last_set_64(uint64_t val) +{ + return 64 - __builtin_clzll(val) - 1; +} + +#else + +#include + +#define CREATE_MODE_RW (S_IWRITE | S_IREAD) + +/* + * file_exists -- checks if file exists + */ +static inline int +file_exists(char const *file) +{ + return _access(file, 0); +} + +/* + * find_last_set_64 -- returns last set bit position or -1 if set bit not found + */ +static inline int +find_last_set_64(uint64_t val) +{ + DWORD lz = 0; + + if (BitScanReverse64(&lz, val)) + return (int)lz; + else + return -1; +} + +#endif + +#endif /* OBJCPP_EXAMPLES_COMMON_HPP */ diff --git a/examples/list.hpp b/examples/objcpp_examples_list.hpp similarity index 97% rename from examples/list.hpp rename to examples/objcpp_examples_list.hpp index 40fbdf0b1a..7558b6d082 100644 --- a/examples/list.hpp +++ b/examples/objcpp_examples_list.hpp @@ -34,6 +34,9 @@ * list.hpp -- Implementation of list */ +#ifndef OBJCPP_EXAMPLES_LIST_HPP +#define OBJCPP_EXAMPLES_LIST_HPP + #include #include #include @@ -181,3 +184,5 @@ class list { pmem::obj::persistent_ptr tail; }; }; + +#endif /* OBJCPP_EXAMPLES_LIST_HPP */ diff --git a/examples/panaconda/.gitignore b/examples/panaconda/.gitignore deleted file mode 100644 index da27f662aa..0000000000 --- a/examples/panaconda/.gitignore +++ /dev/null @@ -1 +0,0 @@ -panaconda diff --git a/examples/panaconda/Makefile b/examples/panaconda/Makefile deleted file mode 100644 index 0295a9a81c..0000000000 --- a/examples/panaconda/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright 2016-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. -# - -# -# examples/libpmemobj/panaconda/Makefile -- build panaconda -# -TOP := $(dir $(lastword $(MAKEFILE_LIST)))../../../../ -include $(TOP)/src/common.inc - -NCURSES := $(call check_package, ncurses) -ifeq ($(NCURSES),y) -PROGS = panaconda -else -$(info NOTE: Skipping panaconda because ncurses is missing \ --- see src/examples/libpmemobj/panaconda/README for details.) -endif - -LIBS = -lpmemobj -lpmem -pthread -ifeq ($(shell uname -s),FreeBSD) -LIBS += -lc -endif - -ifeq ($(NCURSES),y) -LIBS += $(shell $(PKG_CONFIG) --libs ncurses) -endif - -COMPILE_LANG = cpp -include ../../Makefile.inc -INCS += -I../ - -panaconda: panaconda.o diff --git a/examples/panaconda/README b/examples/panaconda/README index bd07b574d7..bbd7a246cb 100644 --- a/examples/panaconda/README +++ b/examples/panaconda/README @@ -1,7 +1,3 @@ -Persistent Memory Development Kit - -This is examples/libpmemobj++/panconda/README. - This directory contains an example application implemented using libpmemobj, it's a game in which all the objects are stored on persistent memory. This means that the game process can be safely killed and then resumed. diff --git a/examples/panaconda/panaconda.hpp b/examples/panaconda/panaconda.hpp index b7af586e71..426acd94cb 100644 --- a/examples/panaconda/panaconda.hpp +++ b/examples/panaconda/panaconda.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017, Intel Corporation + * Copyright 2016-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,15 +34,14 @@ * panaconda.hpp -- example usage of libpmemobj C++ bindings */ -#ifndef PANACONDA_HPP -#define PANACONDA_HPP +#ifndef OBJCPP_EXAMPLES_PANACONDA_HPP +#define OBJCPP_EXAMPLES_PANACONDA_HPP #include #include #include #include - -#include "list.hpp" +#include class board_element; @@ -234,4 +233,4 @@ class game { int parse_conf_create_dynamic_layout(void); }; -#endif /* PANACONDA_HPP */ +#endif /* OBJCPP_EXAMPLES_PANACONDA_HPP */ diff --git a/examples/pman/.gitignore b/examples/pman/.gitignore deleted file mode 100644 index 3aa60a1c6d..0000000000 --- a/examples/pman/.gitignore +++ /dev/null @@ -1 +0,0 @@ -pman diff --git a/examples/pman/Makefile b/examples/pman/Makefile deleted file mode 100644 index 19e46b8786..0000000000 --- a/examples/pman/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# 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. -# -TOP := $(dir $(lastword $(MAKEFILE_LIST)))../../../../ -include $(TOP)/src/common.inc - -NCURSES := $(call check_package, ncurses) -ifeq ($(NCURSES),y) -PROGS = pman -else -$(info NOTE: Skipping pman because ncurses is missing \ --- see src/examples/libpmemobj/pman/README for details.) -endif - -LIBS = -lpmemobj -lpmem -pthread - -ifeq ($(NCURSES),y) -LIBS += $(shell $(PKG_CONFIG) --libs ncurses) -endif - -COMPILE_LANG = cpp -include ../../Makefile.inc -INCS += -I../ - -pman: pman.o diff --git a/examples/pman/README b/examples/pman/README index e940e4d8cf..adb598af5e 100644 --- a/examples/pman/README +++ b/examples/pman/README @@ -1,7 +1,3 @@ -Persistent Memory Development Kit - -This is examples/libpmemobj++/pman/README. - This directory contains an example application implemented using libpmemobj, it's a game in which all the objects are stored on persistent memory. This means that the game process can be safely killed and then resumed. diff --git a/examples/pman/pman.cpp b/examples/pman/pman.cpp index 3fe7bf940b..c913c87a54 100644 --- a/examples/pman/pman.cpp +++ b/examples/pman/pman.cpp @@ -34,7 +34,6 @@ * pman.cpp -- example usage of libpmemobj C++ bindings */ -#include "list.hpp" #include #include #include @@ -45,6 +44,7 @@ #else #include #endif +#include #define LAYOUT_NAME "pman" #define SIZE 40 diff --git a/examples/pmpong/.gitignore b/examples/pmpong/.gitignore deleted file mode 100644 index cb158c1078..0000000000 --- a/examples/pmpong/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -pmpong -fontConf -*.dll -lib -include diff --git a/examples/pmpong/Ball.hpp b/examples/pmpong/Ball.hpp index e8b60675c4..cd56e00170 100644 --- a/examples/pmpong/Ball.hpp +++ b/examples/pmpong/Ball.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef BALL_H_ -#define BALL_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_BALL_HPP +#define OBJCPP_EXAMPLES_PMPONG_BALL_HPP #include "GameConstants.hpp" #include @@ -64,4 +64,4 @@ class Ball { pmem::obj::persistent_ptr velocity; }; -#endif /* BALL_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_BALL_HPP */ diff --git a/examples/pmpong/GameConstants.hpp b/examples/pmpong/GameConstants.hpp index 61cd638324..e0d4992825 100644 --- a/examples/pmpong/GameConstants.hpp +++ b/examples/pmpong/GameConstants.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GAMECONSTANTS_H_ -#define GAMECONSTANTS_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_GAMECONSTANTS_HPP +#define OBJCPP_EXAMPLES_PMPONG_GAMECONSTANTS_HPP #include #include diff --git a/examples/pmpong/GameController.hpp b/examples/pmpong/GameController.hpp index ea98580736..fdea1ca341 100644 --- a/examples/pmpong/GameController.hpp +++ b/examples/pmpong/GameController.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GAMECONTROLLER_H_ -#define GAMECONTROLLER_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_GAMECONTROLLER_HPP +#define OBJCPP_EXAMPLES_PMPONG_GAMECONTROLLER_HPP + #include "GameConstants.hpp" #include "GameOverView.hpp" #include "GameView.hpp" diff --git a/examples/pmpong/GameOverView.hpp b/examples/pmpong/GameOverView.hpp index 0203e7fda7..e54c30c4de 100644 --- a/examples/pmpong/GameOverView.hpp +++ b/examples/pmpong/GameOverView.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GAMEOVERVIEW_H_ -#define GAMEOVERVIEW_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_GAMEOVERVIEW_HPP +#define OBJCPP_EXAMPLES_PMPONG_GAMEOVERVIEW_HPP + #include "GameConstants.hpp" #include "PongGameStatus.hpp" #include "View.hpp" @@ -51,4 +52,4 @@ class GameOverView : public View { sf::Text entContinue; }; -#endif /* GAMEOVERVIEW_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_GAMEOVERVIEW_HPP */ diff --git a/examples/pmpong/GameView.hpp b/examples/pmpong/GameView.hpp index 1274d83946..d47caeb352 100644 --- a/examples/pmpong/GameView.hpp +++ b/examples/pmpong/GameView.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GAMEVIEW_H_ -#define GAMEVIEW_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_GAMEVIEW_HPP +#define OBJCPP_EXAMPLES_PMPONG_GAMEVIEW_HPP + #include "GameConstants.hpp" #include "PongGameStatus.hpp" #include "View.hpp" @@ -61,4 +62,4 @@ class GameView : public View { sf::RectangleShape rightPaddleShape; }; -#endif /* GAMEVIEW_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_GAMEVIEW_HPP */ diff --git a/examples/pmpong/Makefile b/examples/pmpong/Makefile deleted file mode 100644 index c9d6e65632..0000000000 --- a/examples/pmpong/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright 2017-2018, 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. - -TOP := $(dir $(lastword $(MAKEFILE_LIST)))../../../../ -include $(TOP)/src/common.inc - -SFML := $(call check_package, sfml-all --atleast-version 2.4) -ifeq ($(SFML),y) -ifeq ($(shell uname -s),FreeBSD) -FONTDIR=/usr/local/share/fonts -else -FONTDIR=/usr/share/fonts -endif -PROGS = pmpong -else -$(info NOTE: Skipping pmpong because sfml is missing \ --- see src/examples/libpmemobj/pmpong/README for details.) -endif - -LIBS = -lpmemobj -lpmem - -ifeq ($(SFML),y) -LIBS += $(shell $(PKG_CONFIG) --libs sfml-all) -endif - -COMPILE_LANG = cpp -include ../../Makefile.inc -INCS += -I../ - -pmpong: MainGame.o Paddle.o Ball.o PongGameStatus.o GameController.o Pool.o GameView.o MenuView.o GameOverView.o - -rm-fontconf: - rm -f fontConf - -clobber: rm-fontconf - -clean: rm-fontconf - -fontConf: - find $(FONTDIR) -name *.ttf | head -n 1 > fontConf - -all: fontConf diff --git a/examples/pmpong/MenuView.hpp b/examples/pmpong/MenuView.hpp index 7027eda444..6f3148bc62 100644 --- a/examples/pmpong/MenuView.hpp +++ b/examples/pmpong/MenuView.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MENUVIEW_H_ -#define MENUVIEW_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_MENUVIEW_HPP +#define OBJCPP_EXAMPLES_PMPONG_MENUVIEW_HPP #include "GameConstants.hpp" #include "PongGameStatus.hpp" #include "View.hpp" @@ -51,4 +51,4 @@ class MenuView : public View { sf::Text menuItems[MENU_ITEMS]; }; -#endif /* MENUVIEW_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_MENUVIEW_HPP */ diff --git a/examples/pmpong/Paddle.hpp b/examples/pmpong/Paddle.hpp index 74d2dcbdf2..80610d856f 100644 --- a/examples/pmpong/Paddle.hpp +++ b/examples/pmpong/Paddle.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PADDLE_H_ -#define PADDLE_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_PADDLE_HPP +#define OBJCPP_EXAMPLES_PMPONG_PADDLE_HPP #include "Ball.hpp" #include "GameConstants.hpp" #include @@ -69,4 +69,4 @@ class Paddle { void setX(int xArg); }; -#endif /* PADDLE_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_PADDLE_HPP */ diff --git a/examples/pmpong/PongGameStatus.hpp b/examples/pmpong/PongGameStatus.hpp index cd5e8567cd..90e0e83acd 100644 --- a/examples/pmpong/PongGameStatus.hpp +++ b/examples/pmpong/PongGameStatus.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PONGGAMESTATUS_H_ -#define PONGGAMESTATUS_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_PONGGAMESTATUS_HPP +#define OBJCPP_EXAMPLES_PMPONG_PONGGAMESTATUS_HPP #include "Ball.hpp" #include "GameConstants.hpp" #include "Paddle.hpp" @@ -81,4 +81,4 @@ class PongGameStatus { pmem::obj::p isGameToResume; pmem::obj::p actualGameState; }; -#endif /* PONGGAMESTATUS_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_PONGGAMESTATUS_HPP */ diff --git a/examples/pmpong/Pool.hpp b/examples/pmpong/Pool.hpp index 00ce74341e..ef061e89f9 100644 --- a/examples/pmpong/Pool.hpp +++ b/examples/pmpong/Pool.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POOL_H_ -#define POOL_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_POOL_HPP +#define OBJCPP_EXAMPLES_PMPONG_POOL_HPP + #include "GameController.hpp" #include #include @@ -62,4 +63,4 @@ class Pool { Pool &operator=(const Pool &); }; -#endif /* POOL_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_POOL_HPP */ diff --git a/examples/pmpong/README b/examples/pmpong/README index 38878acda5..bad7f1ff73 100644 --- a/examples/pmpong/README +++ b/examples/pmpong/README @@ -1,7 +1,3 @@ - Persistent Memory Development Kit - -This is examples/libpmemobj++/pmpong/README. - This directory contains an example application implemented using libpmemobj, it's a game in which all the objects are stored on persistent memory. This means that the game process can be safely killed and then resumed. diff --git a/examples/pmpong/View.hpp b/examples/pmpong/View.hpp index 82e6708fa8..001190396b 100644 --- a/examples/pmpong/View.hpp +++ b/examples/pmpong/View.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2017, Intel Corporation + * Copyright 2017-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,8 +30,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef VIEW_H_ -#define VIEW_H_ +#ifndef OBJCPP_EXAMPLES_PMPONG_VIEW_HPP +#define OBJCPP_EXAMPLES_PMPONG_VIEW_HPP + #include "GameConstants.hpp" #include "PongGameStatus.hpp" #include @@ -43,4 +44,4 @@ class View { virtual void displayView(sf::RenderWindow *gameWindow) = 0; }; -#endif /* VIEW_H_ */ +#endif /* OBJCPP_EXAMPLES_PMPONG_VIEW_HPP */ diff --git a/examples/pmpong/pmpong.vcxproj b/examples/pmpong/pmpong.vcxproj deleted file mode 100644 index fbb46e6af1..0000000000 --- a/examples/pmpong/pmpong.vcxproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {C6E9D8C2-D5C1-441B-95ED-378E10DC5723} - Win32Proj - pmemobj - 10.0.16299.0 - - - - {1baa1617-93ae-4196-8a1a-bd492fb18aef} - - - {9e9e3d25-2139-4a5d-9200-18148ddead45} - - - - - Application - true - v140 - - - Application - false - v140 - true - - - - - ..\..\..\LongPath.manifest - - - - - - - - - - - true - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(solutionDir)include;$(IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ - - - false - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(solutionDir)include;$(IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\ - - - - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(ProjectDir)\include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)\lib;%(AdditionalLibraryDirectories) - sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - PowerShell -ExecutionPolicy RemoteSigned -file $(ProjectDir)buildScript.ps1 - - - - - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(ProjectDir)\include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)\lib;%(AdditionalLibraryDirectories) - sfml-graphics.lib;sfml-window.lib;sfml-system.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - PowerShell -ExecutionPolicy RemoteSigned -file $(ProjectDir)buildScript.ps1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/pmpong/pmpong.vcxproj.filters b/examples/pmpong/pmpong.vcxproj.filters deleted file mode 100644 index 39222b446d..0000000000 --- a/examples/pmpong/pmpong.vcxproj.filters +++ /dev/null @@ -1,77 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - \ No newline at end of file diff --git a/examples/queue/.gitignore b/examples/queue/.gitignore deleted file mode 100644 index 1fff7bceef..0000000000 --- a/examples/queue/.gitignore +++ /dev/null @@ -1 +0,0 @@ -queue diff --git a/examples/queue/Makefile b/examples/queue/Makefile deleted file mode 100644 index 0ee18d246e..0000000000 --- a/examples/queue/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright 2015-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. -# -PROGS = queue - -LIBS = -lpmemobj -lpmem -pthread - -COMPILE_LANG = cpp -include ../../Makefile.inc - -queue: queue.o diff --git a/examples/queue/queue.cpp b/examples/queue/queue.cpp index 48bf78686c..deb989d192 100644 --- a/examples/queue/queue.cpp +++ b/examples/queue/queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017, Intel Corporation + * Copyright 2015-2018, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,7 +36,6 @@ * Please see pmem.io blog posts for more details. */ -#include #include #include #include @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include diff --git a/examples/queue/queue.vcxproj b/examples/queue/queue.vcxproj deleted file mode 100644 index 0b06690a23..0000000000 --- a/examples/queue/queue.vcxproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {A6CC801B-CF30-4703-BC54-3E21F90B787D} - pmemobj_cpp - 10.0.16299.0 - - - - {1baa1617-93ae-4196-8a1a-bd492fb18aef} - - - {9e9e3d25-2139-4a5d-9200-18148ddead45} - - - - - Application - true - v140 - - - Application - false - v140 - true - - - - $(ProjectDir)..\..\;$(solutionDir)include;$(IncludePath);$(WindowsSDK_IncludePath); - - - - ..\..\..\LongPath.manifest - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/queue/queue.vcxproj.filters b/examples/queue/queue.vcxproj.filters deleted file mode 100644 index af63c615b6..0000000000 --- a/examples/queue/queue.vcxproj.filters +++ /dev/null @@ -1,13 +0,0 @@ - - - - - {cba2d0d1-54c5-4fc4-9770-886749ac95b8} - - - - - Source Files - - - \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 77647e06af..9f03646d87 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -126,7 +126,26 @@ else() endif() if(NO_GCC_VARIADIC_TEMPLATE_BUG) - # XXX: Ex libpmemobj cpp + if(PKG_CONFIG_FOUND) + pkg_check_modules(CURSES QUIET ncurses) + else() + # Specifies that we want FindCurses to find ncurses and not just any + # curses library + set(CURSES_NEED_NCURSES TRUE) + find_package(Curses QUIET) + endif() + + add_executable(ex-queue ../examples/queue/queue.cpp) + target_include_directories(ex-queue PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../examples) + target_link_libraries(ex-queue ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) + + if(CURSES_FOUND AND NOT WIN32) + add_executable(ex-pman ../examples/pman/pman.cpp) + target_include_directories(ex-pman PUBLIC ${CURSES_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../examples) + target_link_libraries(ex-pman ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURSES_LIBRARIES}) + else() + message(WARNING "ncurses not found - pman test won't be build") + endif() else() message(WARNING "Skipping examples tests because of compiler issue") endif() @@ -249,6 +268,9 @@ add_test_generic(cond_var_posix pmemcheck) add_test_generic(deque none) add_test_generic(deque pmemcheck) +add_test_generic(ex-queue none) +add_test_generic(ex-pman none) + add_test_generic(list none) add_test_generic(list pmemcheck) diff --git a/examples/doc_snippets/Makefile b/tests/ex-pman/ex-pman_0.cmake similarity index 79% rename from examples/doc_snippets/Makefile rename to tests/ex-pman/ex-pman_0.cmake index 427003c929..9436c02baf 100644 --- a/examples/doc_snippets/Makefile +++ b/tests/ex-pman/ex-pman_0.cmake @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, Intel Corporation +# Copyright 2018, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -28,18 +28,18 @@ # 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. -# -include ../../Makefile.inc +include(${SRC_DIR}/../helpers.cmake) -TARGETS = persistent.o make_persistent.o pool.o transaction.o +setup() -ifeq ($(call check_cxx_chrono), y) -TARGETS += mutex.o -else -$(info NOTE: Skipping C++ chrono examples because of compiler/stdc++ issues) -endif +execute_process(COMMAND tty OUTPUT_FILE /dev/null RESULT_VARIABLE result) -all: $(TARGETS) +if (result EQUAL 0) + execute(${SRC_DIR}/prepare_input.sh ${DIR}/input) + execute(${TEST_EXECUTABLE} ${DIR}/testfile ${SRC_DIR}/../../examples/pman/map INPUT_FILE ${DIR}/input) +else() + message(WARNING "Skip: stdout is not terminal") +endif() -libsnippets.o: $(TARGETS) +cleanup() diff --git a/examples/Makefile b/tests/ex-pman/prepare_input.sh old mode 100644 new mode 100755 similarity index 85% rename from examples/Makefile rename to tests/ex-pman/prepare_input.sh index 74988a0fe6..2d5e4645a5 --- a/examples/Makefile +++ b/tests/ex-pman/prepare_input.sh @@ -1,5 +1,5 @@ # -# Copyright 2014-2018, Intel Corporation +# Copyright 2018, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,12 +29,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +set -e -# -# examples/libpmemobj++/Makefile -- build the libpmemobj++ examples -# -include ../../common.inc - -DIRS = queue pman map_cli panaconda pmpong doc_snippets +# prepares input for ex-pman test +# usage: ./prepare_input.sh input_file -include ../Makefile.inc +dd if=/dev/zero bs=64 count=1 2>>/dev/null >> $1 +echo -n slkiiijjbjjii >> $1 +dd if=/dev/zero bs=128 count=1 2>>/dev/null >> $1 +echo -n q >> $1 diff --git a/examples/map_cli/Makefile b/tests/ex-queue/ex-queue_0.cmake similarity index 76% rename from examples/map_cli/Makefile rename to tests/ex-queue/ex-queue_0.cmake index 2998b29972..4d281d16f3 100644 --- a/examples/map_cli/Makefile +++ b/tests/ex-queue/ex-queue_0.cmake @@ -1,5 +1,5 @@ # -# Copyright 2015-2016, Intel Corporation +# Copyright 2018, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -28,12 +28,19 @@ # 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. -# -PROGS = map_cli -LIBS = -lpmemobj -lpmem -pthread +include(${SRC_DIR}/../helpers.cmake) + +setup() + +execute(${TEST_EXECUTABLE} ${DIR}/testfile push 1) +execute(${TEST_EXECUTABLE} ${DIR}/testfile push 2) +execute(${TEST_EXECUTABLE} ${DIR}/testfile push 3) +execute_ignore_output(${TEST_EXECUTABLE} ${DIR}/testfile pop) +execute_with_output("out0.log" ${TEST_EXECUTABLE} ${DIR}/testfile show) + +check_file_exists(${DIR}/testfile) -COMPILE_LANG = cpp -include ../../Makefile.inc +match(out0.log ${SRC_DIR}/out0.log.match) -map_cli: map_cli.o +cleanup() diff --git a/tests/ex_libpmemobj_cpp/out0.log.match b/tests/ex-queue/out0.log.match similarity index 100% rename from tests/ex_libpmemobj_cpp/out0.log.match rename to tests/ex-queue/out0.log.match diff --git a/tests/ex_libpmemobj_cpp/Makefile b/tests/ex_libpmemobj_cpp/Makefile deleted file mode 100644 index 0661ad9669..0000000000 --- a/tests/ex_libpmemobj_cpp/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright 2016-2018, 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/ex_libpmemobj_cpp/Makefile -- build ex_libpmemobj_cpp unittest -# - -all: $(EXAMPLES) - $(MAKE) -C $(EX_LIBPMEMOBJCPP) - -include ../Makefile.inc - -EXAMPLES=$(EX_LIBPMEMOBJCPP)/queue/queue - -NCURSES := $(call check_package, ncurses) - -ifeq ($(NCURSES),y) -EXAMPLES += $(EX_LIBPMEMOBJCPP)/pman/pman -else -$(info NOTE: Skipping pman test because ncurses is missing \ --- see src/examples/libpmemobj++/pman/README for details.) -endif diff --git a/tests/ex_libpmemobj_cpp/TEST0 b/tests/ex_libpmemobj_cpp/TEST0 deleted file mode 100755 index cf393ad53d..0000000000 --- a/tests/ex_libpmemobj_cpp/TEST0 +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2015-2018, 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/ex_libpmemobj_cpp/TEST0 -- unit test for libpmemobj cpp examples -# - -# standard unit test setup -. ../unittest/unittest.sh - -require_test_type medium - -require_build_type debug nondebug - -require_cxx11 - -setup - -EX_PATH=../../examples/libpmemobj++/queue - -expect_normal_exit $EX_PATH/queue $DIR/testfile1 push 1 -expect_normal_exit $EX_PATH/queue $DIR/testfile1 push 2 -expect_normal_exit $EX_PATH/queue $DIR/testfile1 push 3 -expect_normal_exit $EX_PATH/queue $DIR/testfile1 pop > /dev/null -expect_normal_exit $EX_PATH/queue $DIR/testfile1 show \ - > out$UNITTEST_NUM.log 2>&1 - -check - -pass diff --git a/tests/ex_libpmemobj_cpp/TEST0.PS1 b/tests/ex_libpmemobj_cpp/TEST0.PS1 deleted file mode 100644 index f82b905f0d..0000000000 --- a/tests/ex_libpmemobj_cpp/TEST0.PS1 +++ /dev/null @@ -1,55 +0,0 @@ -# -# Copyright 2015-2018, 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/ex_libpmemobj_cpp/TEST0 -- unit test for libpmemobj cpp examples -# - -# standard unit test setup -. ..\unittest\unittest.PS1 - -require_test_type medium -require_build_type debug nondebug -require_no_unicode - -setup - -expect_normal_exit $Env:EXE_DIR\ex_pmemobj_cpp_queue $DIR\testfile1 push 1 -expect_normal_exit $Env:EXE_DIR\ex_pmemobj_cpp_queue $DIR\testfile1 push 2 -expect_normal_exit $Env:EXE_DIR\ex_pmemobj_cpp_queue $DIR\testfile1 push 3 -expect_normal_exit $Env:EXE_DIR\ex_pmemobj_cpp_queue $DIR\testfile1 pop > $null -expect_normal_exit $Env:EXE_DIR\ex_pmemobj_cpp_queue $DIR\testfile1 show ` - > out$Env:UNITTEST_NUM.log 2>&1 - -check - -pass diff --git a/tests/ex_libpmemobj_cpp/TEST1 b/tests/ex_libpmemobj_cpp/TEST1 deleted file mode 100755 index 59c57ea032..0000000000 --- a/tests/ex_libpmemobj_cpp/TEST1 +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2015-2018, 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/ex_libpmemobj_cpp/TEST1 -- unit test for libpmemobj cpp examples -# - -# standard unit test setup -. ../unittest/unittest.sh - -require_test_type medium - -require_build_type debug nondebug -require_fs_type pmem -require_pkg ncurses -require_tty - -require_cxx11 - -setup - -EX_PATH=../../examples/libpmemobj++/pman -INPUT=$DIR/input.txt - -dd if=/dev/zero bs=64 count=1 2>>prep$UNITTEST_NUM.log >> $INPUT -echo -n slkiiijjbjjii >> $INPUT -dd if=/dev/zero bs=128 count=1 2>>prep$UNITTEST_NUM.log >> $INPUT -echo -n q >> $INPUT - -if [ -t 1 -a -z "$NOTTY" ] -then - expect_normal_exit $EX_PATH/pman $DIR/testfile1 $EX_PATH/map < $INPUT -else - expect_normal_exit $EX_PATH/pman $DIR/testfile1 $EX_PATH/map >/dev/null 2>/dev/null < $INPUT -fi - -pass diff --git a/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj b/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj deleted file mode 100644 index 4127b9368a..0000000000 --- a/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - {a6cc801b-cf30-4703-bc54-3e21f90b787d} - - - - - - - - {48A3AE10-200B-454E-9D82-EC1A88CF1151} - ex_libpmemobj_cpp - 10.0.16299.0 - - - - Application - true - v140 - - - Application - false - v140 - - - - - - - - - - - - - - - - - - Level3 - Disabled - - - true - NTDDI_VERSION=NTDDI_WIN10_RS1;_MBCS;%(PreprocessorDefinitions) - - - - - Level3 - MaxSpeed - true - true - - - true - NTDDI_VERSION=NTDDI_WIN10_RS1;_MBCS;%(PreprocessorDefinitions) - - - - - - - \ No newline at end of file diff --git a/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj.filters b/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj.filters deleted file mode 100644 index 76a244b608..0000000000 --- a/tests/ex_libpmemobj_cpp/ex_libpmemobj_cpp.vcxproj.filters +++ /dev/null @@ -1,19 +0,0 @@ - - - - - {b7d9fc2e-949d-4e29-840a-977c514a3ace} - - - {69c8e99a-d0b9-4288-a418-1b2674e8fa5d} - - - - - Match Files - - - Test Scripts - - - \ No newline at end of file diff --git a/tests/helpers.cmake b/tests/helpers.cmake index f1607d9bed..6f014d3ef5 100644 --- a/tests/helpers.cmake +++ b/tests/helpers.cmake @@ -81,6 +81,16 @@ function(execute_with_output out cmd) endif() endfunction() +# Generic command executor which handles failures but ignores output. +function(execute_ignore_output cmd) + execute_process(COMMAND ${cmd} ${ARGN} + OUTPUT_QUIET + RESULT_VARIABLE res) + if(res) + message(FATAL_ERROR "${cmd} ${ARGN} > ${out} failed: ${res}") + endif() +endfunction() + # Executes command expecting it to fail. function(execute_expect_failure cmd) execute_process(COMMAND ${cmd} ${ARGN} diff --git a/utils/docker/images/Dockerfile.fedora-25 b/utils/docker/images/Dockerfile.fedora-25 index 7e5a80333a..472ed33c58 100644 --- a/utils/docker/images/Dockerfile.fedora-25 +++ b/utils/docker/images/Dockerfile.fedora-25 @@ -52,9 +52,11 @@ RUN dnf update -y \ libunwind-devel \ make \ man \ + ncurses-devel \ passwd \ perl-Text-Diff \ rpm-build \ + SFML-devel \ sudo \ tar \ which \ diff --git a/utils/docker/images/Dockerfile.ubuntu-16.04 b/utils/docker/images/Dockerfile.ubuntu-16.04 index 56abcbd1d0..b4391250f9 100644 --- a/utils/docker/images/Dockerfile.ubuntu-16.04 +++ b/utils/docker/images/Dockerfile.ubuntu-16.04 @@ -48,6 +48,7 @@ RUN apt-get update \ debhelper \ devscripts \ doxygen \ + libncurses5-dev \ gcc \ gdb \ git \ @@ -55,6 +56,7 @@ RUN apt-get update \ libunwind8-dev \ libtext-diff-perl \ pkg-config \ + # SFML-2.4 (not available in ubuntu 16.04) sudo \ whois \ && rm -rf /var/lib/apt/lists/*