Fix compilation under gcc 7.0.x

This commit is contained in:
Krzysztof Czurylo 2017-02-21 23:05:26 +01:00
parent 5751859d43
commit 8f19e82fab
6 changed files with 66 additions and 362 deletions

View File

@ -1,221 +0,0 @@
From 6396c898e191db0f5998b3713f7a6b65553abe51 Mon Sep 17 00:00:00 2001
From: Pawel Lebioda <pawel.lebioda@intel.com>
Date: Fri, 1 Apr 2016 19:13:25 +0200
Subject: [PATCH] test: fix timeouting obj_tx_add_range test
The obj_tx_add_range was timeouting sometimes because of new scenario
which checks for persistent memory leaks (pmem/issues#162)
---
src/test/obj_tx_add_range/TEST0 | 4 +-
src/test/obj_tx_add_range/TEST1 | 2 +-
src/test/obj_tx_add_range/TEST2 | 50 ++++++++++++++++++++++++
src/test/obj_tx_add_range/err0.log.match | 0
src/test/obj_tx_add_range/err1.log.match | 0
src/test/obj_tx_add_range/obj_tx_add_range.c | 56 ++++++++++++++-------------
src/test/obj_tx_add_range/out0.log.match | 3 --
src/test/obj_tx_add_range/out1.log.match | 3 --
src/test/obj_tx_add_range/valgrind1.log.match | 2 +-
9 files changed, 83 insertions(+), 37 deletions(-)
create mode 100755 src/test/obj_tx_add_range/TEST2
delete mode 100644 src/test/obj_tx_add_range/err0.log.match
delete mode 100644 src/test/obj_tx_add_range/err1.log.match
delete mode 100644 src/test/obj_tx_add_range/out0.log.match
delete mode 100644 src/test/obj_tx_add_range/out1.log.match
diff --git a/src/test/obj_tx_add_range/TEST0 b/src/test/obj_tx_add_range/TEST0
index 2e1526c..b1812cb 100755
--- a/src/test/obj_tx_add_range/TEST0
+++ b/src/test/obj_tx_add_range/TEST0
@@ -42,8 +42,6 @@ export UNITTEST_NUM=0
setup
-expect_normal_exit ./obj_tx_add_range$EXESUFFIX $DIR/testfile1
-
-check
+expect_normal_exit ./obj_tx_add_range$EXESUFFIX $DIR/testfile1 0
pass
diff --git a/src/test/obj_tx_add_range/TEST1 b/src/test/obj_tx_add_range/TEST1
index 09e306d..7d76156 100755
--- a/src/test/obj_tx_add_range/TEST1
+++ b/src/test/obj_tx_add_range/TEST1
@@ -49,7 +49,7 @@ setup
expect_normal_exit valgrind --tool=pmemcheck\
--log-file=valgrind$UNITTEST_NUM.log\
--mult-stores=no\
- ./obj_tx_add_range$EXESUFFIX $DIR/testfile1 $i
+ ./obj_tx_add_range$EXESUFFIX $DIR/testfile1 0
check
diff --git a/src/test/obj_tx_add_range/TEST2 b/src/test/obj_tx_add_range/TEST2
new file mode 100755
index 0000000..afee81e
--- /dev/null
+++ b/src/test/obj_tx_add_range/TEST2
@@ -0,0 +1,50 @@
+#!/bin/bash -e
+#
+# 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.
+#
+
+#
+# src/test/obj_tx_add_range/TEST2 -- unit test for pmemobj_tx_add_range
+#
+export UNITTEST_NAME=obj_tx_add_range/TEST2
+export UNITTEST_NUM=2
+
+# standard unit test setup
+. ../unittest/unittest.sh
+
+memcheck force-disable
+require_fs_type pmem
+
+setup
+
+expect_normal_exit ./obj_tx_add_range$EXESUFFIX $DIR/testfile1 1
+
+pass
diff --git a/src/test/obj_tx_add_range/err0.log.match b/src/test/obj_tx_add_range/err0.log.match
deleted file mode 100644
index e69de29..0000000
diff --git a/src/test/obj_tx_add_range/err1.log.match b/src/test/obj_tx_add_range/err1.log.match
deleted file mode 100644
index e69de29..0000000
diff --git a/src/test/obj_tx_add_range/obj_tx_add_range.c b/src/test/obj_tx_add_range/obj_tx_add_range.c
index 9c1e41d..472fc0e 100644
--- a/src/test/obj_tx_add_range/obj_tx_add_range.c
+++ b/src/test/obj_tx_add_range/obj_tx_add_range.c
@@ -566,39 +566,43 @@ main(int argc, char *argv[])
START(argc, argv, "obj_tx_add_range");
util_init();
- if (argc != 2)
- UT_FATAL("usage: %s [file]", argv[0]);
+ if (argc != 3)
+ UT_FATAL("usage: %s [file] [0|1]", argv[0]);
+
+ int do_reopen = atoi(argv[2]);
PMEMobjpool *pop;
if ((pop = pmemobj_create(argv[1], LAYOUT_NAME, PMEMOBJ_MIN_POOL,
S_IWUSR | S_IRUSR)) == NULL)
UT_FATAL("!pmemobj_create");
- do_tx_add_range_commit(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_abort(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_commit_nested(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_abort_nested(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_abort_after_nested(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_twice_commit(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_twice_abort(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_alloc_commit(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_alloc_abort(pop);
- VALGRIND_WRITE_STATS;
- do_tx_add_range_overlapping(pop);
- VALGRIND_WRITE_STATS;
- pmemobj_close(pop);
-
- /* do not run this on valgrind because it takes too long */
- if (!On_valgrind)
+ if (do_reopen) {
+ pmemobj_close(pop);
do_tx_add_range_reopen(argv[1]);
+ } else {
+ do_tx_add_range_commit(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_abort(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_commit_nested(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_abort_nested(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_abort_after_nested(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_twice_commit(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_twice_abort(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_alloc_commit(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_alloc_abort(pop);
+ VALGRIND_WRITE_STATS;
+ do_tx_add_range_overlapping(pop);
+ VALGRIND_WRITE_STATS;
+ pmemobj_close(pop);
+ }
+
DONE(NULL);
}
diff --git a/src/test/obj_tx_add_range/out0.log.match b/src/test/obj_tx_add_range/out0.log.match
deleted file mode 100644
index f3d6392..0000000
--- a/src/test/obj_tx_add_range/out0.log.match
+++ /dev/null
@@ -1,3 +0,0 @@
-obj_tx_add_range/TEST0: START: obj_tx_add_range
- ./obj_tx_add_range$(nW) $(nW)testfile1
-obj_tx_add_range/TEST0: Done
diff --git a/src/test/obj_tx_add_range/out1.log.match b/src/test/obj_tx_add_range/out1.log.match
deleted file mode 100644
index 82beb3a..0000000
--- a/src/test/obj_tx_add_range/out1.log.match
+++ /dev/null
@@ -1,3 +0,0 @@
-obj_tx_add_range/TEST1: START: obj_tx_add_range
- ./obj_tx_add_range$(nW) $(nW)testfile1
-obj_tx_add_range/TEST1: Done
diff --git a/src/test/obj_tx_add_range/valgrind1.log.match b/src/test/obj_tx_add_range/valgrind1.log.match
index 17e9c72..b612e9e 100644
--- a/src/test/obj_tx_add_range/valgrind1.log.match
+++ b/src/test/obj_tx_add_range/valgrind1.log.match
@@ -1,7 +1,7 @@
==$(nW)== pmemcheck-$(nW), a simple persistent store checker
==$(nW)== Copyright (c) $(nW), Intel Corporation
==$(nW)== Using Valgrind-$(nW) and LibVEX; rerun with -h for copyright info
-==$(nW)== Command: ./obj_tx_add_range$(nW) $(nW)testfile1
+==$(nW)== Command: ./obj_tx_add_range$(nW) $(nW)testfile1 0
==$(nW)== Parent PID: $(nW)
==$(nW)==
==$(nW)== Number of stores not made persistent: 0
--
2.5.0

View File

@ -1,139 +0,0 @@
From 5c5f1c05522ab9b6e7906c1f03fcb0905c7edbaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= <marcin.slusarz@gmail.com>
Date: Sat, 9 Apr 2016 14:27:21 +0200
Subject: [PATCH] all: always append EXTRA_CFLAGS after our CFLAGS
...and add support for EXTRA_CFLAGS_DEBUG and EXTRA_CFLAGS_RELEASE.
---
src/Makefile.inc | 23 ++++++++++++-----------
src/benchmarks/Makefile | 3 ++-
src/test/unittest/Makefile | 3 ++-
src/tools/Makefile.inc | 15 ++++++++-------
4 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/Makefile.inc b/src/Makefile.inc
index 798f514..efe7db7 100644
--- a/src/Makefile.inc
+++ b/src/Makefile.inc
@@ -55,7 +55,6 @@ CFLAGS += -Wconversion
endif
CFLAGS += -pthread
CFLAGS += -fno-common
-CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += -DSRCVERSION=\"$(SRCVERSION)\"
ifeq ($(call check_flag, -Wunreachable-code-return), y)
CFLAGS += -Wunreachable-code-return
@@ -64,6 +63,18 @@ ifeq ($(call check_flag, -Wmissing-variable-declarations), y)
CFLAGS += -Wmissing-variable-declarations
endif
+ifeq ($(DEBUG),1)
+CFLAGS += -O0 -ggdb -DDEBUG $(EXTRA_CFLAGS_DEBUG)
+LIB_SUBDIR = /nvml_debug
+OBJDIR = debug
+else
+CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $(EXTRA_CFLAGS_RELEASE)
+LIB_SUBDIR =
+OBJDIR = nondebug
+endif
+
+CFLAGS += $(EXTRA_CFLAGS)
+
LDFLAGS += -Wl,-z,relro -Wl,--fatal-warnings -Wl,--warn-common $(EXTRA_LDFLAGS)
define arch32_error_msg
@@ -86,16 +97,6 @@ ifneq ($(LP64), 2)
$(error $(arch32_error_msg))
endif
-ifeq ($(DEBUG),1)
-CFLAGS += -O0 -ggdb -DDEBUG
-LIB_SUBDIR = /nvml_debug
-OBJDIR = debug
-else
-CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
-LIB_SUBDIR =
-OBJDIR = nondebug
-endif
-
LIBS_DESTDIR = $(DESTDIR)$(libdir)$(LIB_SUBDIR)
DIRNAME = $(shell basename $(CURDIR))
diff --git a/src/benchmarks/Makefile b/src/benchmarks/Makefile
index a10f23a..6e5d1c9 100644
--- a/src/benchmarks/Makefile
+++ b/src/benchmarks/Makefile
@@ -108,7 +108,6 @@ CFLAGS += -Wmissing-prototypes
CFLAGS += -Wpointer-arith
CFLAGS += -Wunused-macros
CFLAGS += -pthread
-CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += -I../include
CFLAGS += -I../libpmemobj
CFLAGS += -I../common
@@ -140,6 +139,8 @@ ifeq ($(GLIB_SILENCE), y)
CFLAGS += -Wno-unknown-attributes
endif
+CFLAGS += $(EXTRA_CFLAGS)
+
objdir=.
%.o: %.c
diff --git a/src/test/unittest/Makefile b/src/test/unittest/Makefile
index 6b5f7bb..dc7ebd2 100644
--- a/src/test/unittest/Makefile
+++ b/src/test/unittest/Makefile
@@ -55,7 +55,6 @@ CFLAGS += -Wconversion
endif
CFLAGS += -pthread
CFLAGS += -fno-common
-CFLAGS += $(EXTRA_CFLAGS)
ifeq ($(call check_flag, -Wunreachable-code-return), y)
CFLAGS += -Wunreachable-code-return
endif
@@ -72,6 +71,8 @@ endif
CFLAGS += -DUSE_LIBUNWIND
endif
+CFLAGS += $(EXTRA_CFLAGS)
+
all test: $(TARGET)
$(TARGET): $(OBJS)
diff --git a/src/tools/Makefile.inc b/src/tools/Makefile.inc
index f3559d1..e036ef5 100644
--- a/src/tools/Makefile.inc
+++ b/src/tools/Makefile.inc
@@ -51,13 +51,6 @@ ifeq ($(call check_Wconversion), y)
CFLAGS += -Wconversion
endif
CFLAGS += -fno-common
-CFLAGS += $(EXTRA_CFLAGS)
-
-ifeq ($(DEBUG),)
-CFLAGS += -O2 -D_FORTIFY_SOURCE=2
-else
-CFLAGS += -ggdb
-endif
CFLAGS += -DSRCVERSION='"$(SRCVERSION)"'
ifeq ($(call check_flag, -Wunreachable-code-return), y)
@@ -67,6 +60,14 @@ ifeq ($(call check_flag, -Wmissing-variable-declarations), y)
CFLAGS += -Wmissing-variable-declarations
endif
+ifeq ($(DEBUG),1)
+CFLAGS += -ggdb $(EXTRA_CFLAGS_DEBUG)
+else
+CFLAGS += -O2 -D_FORTIFY_SOURCE=2 $(EXTRA_CFLAGS_RELEASE)
+endif
+
+CFLAGS += $(EXTRA_CFLAGS)
+
LDFLAGS += -Wl,-z,relro -Wl,--warn-common -Wl,--fatal-warnings $(EXTRA_LDFLAGS) -L$(TOP)/src/nondebug
TARGET_DIR=$(DESTDIR)$(bindir)
BASH_COMP_FILES ?=
--
2.5.0

View File

@ -0,0 +1,26 @@
From 0fbb5100e1d17e2af3e7bb1ec84ce9b893262c1e Mon Sep 17 00:00:00 2001
From: Krzysztof Czurylo <krzysztof.czurylo@intel.com>
Date: Sat, 18 Feb 2017 17:17:12 +0100
Subject: [PATCH] jemalloc: fix test compilation on Fedora rawhide
Fixes compilation error in jemalloc tests when using gcc 7.0.x.
---
src/jemalloc/test/unit/pool.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jemalloc/test/unit/pool.h b/src/jemalloc/test/unit/pool.h
index eab79753..c584a10a 100644
--- a/src/jemalloc/test/unit/pool.h
+++ b/src/jemalloc/test/unit/pool.h
@@ -224,7 +224,7 @@ TEST_BEGIN(test_pool_check_memory) {
pool = pool_create(mem_pool, pool_size, 0);
assert_ptr_not_null(pool, "Can not create pool!!!");
size_allocated = 0;
- memset(allocs, 0, TEST_ALLOCS_SIZE);
+ memset(allocs, 0, TEST_ALLOCS_SIZE * sizeof(void *));
for (i = 0; i < TEST_ALLOCS_SIZE;++i) {
allocs[i] = pool_malloc(pool, object_size);
--
2.11.1

View File

@ -0,0 +1,32 @@
From 08b82f2dd0ba9333fd62df8aae7de32aa3a70507 Mon Sep 17 00:00:00 2001
From: Krzysztof Czurylo <krzysztof.czurylo@intel.com>
Date: Sat, 18 Feb 2017 17:19:21 +0100
Subject: [PATCH] test: fix cpp test compilation on Fedora rawhide
Adds missing include in obj_cpp_cond_var test.
---
src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp b/src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp
index 44ef676c..2bfb7c19 100644
--- a/src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp
+++ b/src/test/obj_cpp_cond_var/obj_cpp_cond_var.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2016, Intel Corporation
+ * Copyright 2016-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,6 +40,7 @@
#include <libpmemobj++/persistent_ptr.hpp>
#include <libpmemobj++/pool.hpp>
+#include <functional>
#include <mutex>
#include <thread>
#include <vector>
--
2.11.1

BIN
nvml-1.2-3.fc26.src.rpm Normal file

Binary file not shown.

View File

@ -1,11 +1,13 @@
Name: nvml
Version: 1.2
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Non-Volatile Memory Library
License: BSD
URL: http://pmem.io/nvml
Source0: https://github.com/pmem/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: 1.2-0001-jemalloc-fix-test-compilation-on-Fedora-rawhide.patch
Patch1: 1.2-0002-test-fix-cpp-test-compilation-on-Fedora-rawhide.patch
BuildRequires: glibc-devel
BuildRequires: autoconf
@ -527,7 +529,8 @@ Useful applications for administration and diagnosis of persistent memory.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
%patch1 -p1
%build
# Currently, NVML makefiles do not allow to easily override CFLAGS,
@ -582,6 +585,9 @@ make check
%changelog
* Tue Feb 21 2017 Krzysztof Czurylo <krzysztof.czurylo@intel.com> - 1.2-3
- Fix compilation under gcc 7.0.x (RHBZ #14240004)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild