Skip to content

Commit f0b4fe9

Browse files
fanquakejanus
authored andcommitted
Squashed 'src/univalue/' changes from 98fadc0909..a44caf65fe
a44caf65fe Merge bitcoin-core/univalue-subtree#28: Import fixes for sanitizer reported issues 135254331e Import fixes for sanitizer reported issues d5fb86940e refactor: use c++11 range based for loop in checkObject ff9c379304 refactor: Use nullptr (c++11) instead of NULL 08a99754d5 build: use ax_cxx_compile_stdcxx.m4 to check for C++11 support 66d3713ce7 Merge bitcoin-core/univalue-subtree#29: ci: travis -> cirrus 808d487292 ci: travis -> cirrus c390ac375f Merge bitcoin-core/univalue-subtree#19: Split sources for easier buildsystem integration 4a5b0a1c65 build: Move source entries out to sources.mk 6c7d94b33c build: cleanup wonky gen usage a222637c6d Merge #23: Merge changes from jgarzik/univalue@1ae6a23 f77d0f718d Merge commit '1ae6a231a0169938eb3972c1d48dd17cba5947e1' into HEAD 1ae6a231a0 Merge pull request #57 from MarcoFalke/test_fix 92bdd11f0b univalue_write: remove unneeded sstream.h include ffb621c130 Merge pull request #56 from drodil/remove_sstream_header f33acf9fe8 Merge commit '7890db9~' into HEAD 66e0adec4d Remove unnecessary sstream header from univalue.h 88967f6586 Version 1.0.4 1dc113dbef Merge pull request #50 from luke-jr/pushKV_bool 72392fb227 [tests] test pushKV for boolean values c23132bcf4 Pushing boolean value to univalue correctly 81faab26a1 Merge pull request #48 from fwolfst/47-UPDATE_MIT_LINK_TO_HTTPS b17634ef24 Update URLs to MIT license. 88ab64f6b5 Merge pull request #46 from jasonbcox/master 35ed96da31 Merge pull request #44 from MarcoFalke/Mf1709-univalue-cherrypick-explicit 420c226290 Merge pull request #45 from MarcoFalke/Mf1710-univalue-revert-test git-subtree-dir: src/univalue git-subtree-split: a44caf65fe55b9dd8ddb08f04c0f70409efd53b3
1 parent d0976fc commit f0b4fe9

15 files changed

+438
-967
lines changed

.cirrus.yml

+32-431
Large diffs are not rendered by default.

Makefile.am

+40-258
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright (c) 2013-2020 The Bitcoin Core developers
2-
# Distributed under the MIT software license, see the accompanying
3-
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
1+
include sources.mk
2+
ACLOCAL_AMFLAGS = -I build-aux/m4
3+
.PHONY: gen FORCE
4+
.INTERMEDIATE: $(GENBIN)
45

5-
# AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
6-
# which does not have an explicit foo_CFLAGS variable set.
7-
AM_CFLAGS = $(SECP_CFLAGS)
6+
include_HEADERS = $(UNIVALUE_DIST_HEADERS_INT)
7+
noinst_HEADERS = $(UNIVALUE_LIB_HEADERS_INT)
88

99
lib_LTLIBRARIES = libsecp256k1.la
1010
include_HEADERS = include/secp256k1.h
@@ -70,268 +70,50 @@ export PYTHONPATH
7070

7171
if BUILD_BGL_LIBS
7272
pkgconfigdir = $(libdir)/pkgconfig
73-
pkgconfig_DATA = libBGLconsensus.pc
74-
endif
75-
76-
libsecp256k1_la_SOURCES = src/secp256k1.c
77-
libsecp256k1_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
78-
libsecp256k1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)
79-
80-
empty :=
81-
space := $(empty) $(empty)
82-
83-
noinst_PROGRAMS =
84-
if USE_BENCHMARK
85-
noinst_PROGRAMS += bench_verify bench_sign bench_internal bench_ecmult
86-
bench_verify_SOURCES = src/bench_verify.c
87-
bench_verify_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
88-
# SECP_TEST_INCLUDES are only used here for CRYPTO_CPPFLAGS
89-
bench_verify_CPPFLAGS = $(SECP_TEST_INCLUDES)
90-
bench_sign_SOURCES = src/bench_sign.c
91-
bench_sign_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
92-
bench_internal_SOURCES = src/bench_internal.c
93-
bench_internal_LDADD = $(SECP_LIBS) $(COMMON_LIB)
94-
bench_internal_CPPFLAGS = $(SECP_INCLUDES)
95-
bench_ecmult_SOURCES = src/bench_ecmult.c
96-
bench_ecmult_LDADD = $(SECP_LIBS) $(COMMON_LIB)
97-
bench_ecmult_CPPFLAGS = $(SECP_INCLUDES)
98-
endif
99-
100-
TESTS =
101-
if USE_TESTS
102-
noinst_PROGRAMS += tests
103-
tests_SOURCES = src/tests.c
104-
tests_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
105-
if VALGRIND_ENABLED
106-
tests_CPPFLAGS += -DVALGRIND
107-
noinst_PROGRAMS += valgrind_ctime_test
108-
valgrind_ctime_test_SOURCES = src/valgrind_ctime_test.c
109-
valgrind_ctime_test_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
110-
endif
111-
if !ENABLE_COVERAGE
112-
tests_CPPFLAGS += -DVERIFY
113-
endif
114-
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
115-
tests_LDFLAGS = -static
116-
TESTS += tests
117-
endif
118-
119-
if USE_EXHAUSTIVE_TESTS
120-
noinst_PROGRAMS += exhaustive_tests
121-
exhaustive_tests_SOURCES = src/tests_exhaustive.c
122-
exhaustive_tests_CPPFLAGS = -I$(top_srcdir)/src $(SECP_INCLUDES)
123-
if !ENABLE_COVERAGE
124-
exhaustive_tests_CPPFLAGS += -DVERIFY
125-
endif
126-
127-
if TARGET_WINDOWS
128-
deploy: $(BGL_WIN_INSTALLER)
129-
endif
130-
131-
$(BGL_QT_BIN): FORCE
132-
$(MAKE) -C src qt/$(@F)
133-
134-
gen_context_OBJECTS = gen_context.o
135-
gen_context_BIN = gen_context$(BUILD_EXEEXT)
136-
gen_%.o: src/gen_%.c src/libsecp256k1-config.h
137-
$(CC_FOR_BUILD) $(DEFS) $(CPPFLAGS_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@
138-
139-
$(gen_context_BIN): $(gen_context_OBJECTS)
140-
$(CC_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@
141-
142-
$(BGL_TX_BIN): FORCE
143-
$(MAKE) -C src $(@F)
144-
145-
$(BGL_UTIL_BIN): FORCE
146-
$(MAKE) -C src $(@F)
147-
148-
$(BGL_WALLET_BIN): FORCE
149-
$(MAKE) -C src $(@F)
150-
151-
$(BGL_NODE_BIN): FORCE
152-
$(MAKE) -C src $(@F)
153-
154-
$(BGL_GUI_BIN): FORCE
155-
$(MAKE) -C src $(@F)
156-
157-
if USE_LCOV
158-
LCOV_FILTER_PATTERN = \
159-
-p "/usr/local/" \
160-
-p "/usr/include/" \
161-
-p "/usr/lib/" \
162-
-p "/usr/lib64/" \
163-
-p "src/leveldb/" \
164-
-p "src/crc32c/" \
165-
-p "src/bench/" \
166-
-p "src/univalue" \
167-
-p "src/crypto/ctaes" \
168-
-p "src/secp256k1" \
169-
-p "depends"
170-
171-
DIR_FUZZ_SEED_CORPUS ?= qa-assets/fuzz_seed_corpus
73+
pkgconfig_DATA = pc/libunivalue.pc
17274

173-
$(COV_TOOL_WRAPPER):
174-
@echo 'exec $(COV_TOOL) "$$@"' > $(COV_TOOL_WRAPPER)
175-
@chmod +x $(COV_TOOL_WRAPPER)
75+
libunivalue_la_SOURCES = $(UNIVALUE_LIB_SOURCES_INT)
17676

177-
baseline.info: $(COV_TOOL_WRAPPER)
178-
$(LCOV) -c -i -d $(abs_builddir)/src -o $@
77+
libunivalue_la_LDFLAGS = \
78+
-version-info $(LIBUNIVALUE_CURRENT):$(LIBUNIVALUE_REVISION):$(LIBUNIVALUE_AGE) \
79+
-no-undefined
80+
libunivalue_la_CXXFLAGS = -I$(top_srcdir)/include
17981

180-
baseline_filtered.info: baseline.info
181-
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
182-
$(LCOV) -a $@ $(LCOV_OPTS) -o $@
82+
TESTS = test/object test/unitester test/no_nul
18383

184-
fuzz.info: baseline_filtered.info
185-
@TIMEOUT=15 test/fuzz/test_runner.py $(DIR_FUZZ_SEED_CORPUS) -l DEBUG
186-
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t fuzz-tests -o $@
187-
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
84+
GENBIN = gen/gen$(BUILD_EXEEXT)
85+
GEN_SRCS = gen/gen.cpp
18886

189-
fuzz_filtered.info: fuzz.info
190-
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
191-
$(LCOV) -a $@ $(LCOV_OPTS) -o $@
87+
$(GENBIN): $(GEN_SRCS)
88+
@echo Building $@
89+
$(AM_V_at)c++ -I$(top_srcdir)/include -o $@ $<
19290

193-
test_BGL.info: baseline_filtered.info
194-
$(MAKE) -C src/ check
195-
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src -t test_BGL -o $@
196-
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
91+
gen: $(GENBIN) FORCE
92+
@echo Updating lib/univalue_escapes.h
93+
$(AM_V_at)$(GENBIN) > lib/univalue_escapes.h
19794

198-
test_BGL_filtered.info: test_BGL.info
199-
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
200-
$(LCOV) -a $@ $(LCOV_OPTS) -o $@
95+
noinst_PROGRAMS = $(TESTS) test/test_json
20196

202-
functional_test.info: test_BGL_filtered.info
203-
@TIMEOUT=15 test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS)
204-
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t functional-tests -o $@
205-
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src
97+
test_unitester_SOURCES = $(UNIVALUE_TEST_UNITESTER_INT)
98+
test_unitester_LDADD = libunivalue.la
99+
test_unitester_CXXFLAGS = -I$(top_srcdir)/include -DJSON_TEST_SRC=\"$(srcdir)/$(UNIVALUE_TEST_DATA_DIR_INT)\"
100+
test_unitester_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
206101

207-
functional_test_filtered.info: functional_test.info
208-
$(abs_builddir)/contrib/filter-lcov.py $(LCOV_FILTER_PATTERN) $< $@
209-
$(LCOV) -a $@ $(LCOV_OPTS) -o $@
102+
test_test_json_SOURCES = $(UNIVALUE_TEST_JSON_INT)
103+
test_test_json_LDADD = libunivalue.la
104+
test_test_json_CXXFLAGS = -I$(top_srcdir)/include
105+
test_test_json_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
210106

211-
fuzz_coverage.info: fuzz_filtered.info
212-
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a fuzz_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
107+
test_no_nul_SOURCES = $(UNIVALUE_TEST_NO_NUL_INT)
108+
test_no_nul_LDADD = libunivalue.la
109+
test_no_nul_CXXFLAGS = -I$(top_srcdir)/include
110+
test_no_nul_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
213111

214-
test_BGL_coverage.info: baseline_filtered.info test_BGL_filtered.info
215-
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_BGL_filtered.info -o $@
112+
test_object_SOURCES = $(UNIVALUE_TEST_OBJECT_INT)
113+
test_object_LDADD = libunivalue.la
114+
test_object_CXXFLAGS = -I$(top_srcdir)/include
115+
test_object_LDFLAGS = -static $(LIBTOOL_APP_LDFLAGS)
216116

217-
total_coverage.info: test_BGL_filtered.info functional_test_filtered.info
218-
$(LCOV) -a $(LCOV_OPTS) baseline_filtered.info -a test_BGL_filtered.info -a functional_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
117+
TEST_FILES = $(UNIVALUE_TEST_FILES_INT)
219118

220-
fuzz.coverage/.dirstamp: fuzz_coverage.info
221-
$(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
222-
@touch $@
223-
224-
test_BGL.coverage/.dirstamp: test_BGL_coverage.info
225-
$(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
226-
@touch $@
227-
228-
total.coverage/.dirstamp: total_coverage.info
229-
$(GENHTML) -s $(LCOV_OPTS) $< -o $(@D)
230-
@touch $@
231-
232-
cov_fuzz: fuzz.coverage/.dirstamp
233-
234-
cov: test_BGL.coverage/.dirstamp total.coverage/.dirstamp
235-
236-
endif
237-
238-
dist_noinst_SCRIPTS = autogen.sh
239-
240-
EXTRA_DIST = $(DIST_SHARE) $(DIST_CONTRIB) $(WINDOWS_PACKAGING) $(OSX_PACKAGING) $(BIN_CHECKS)
241-
242-
EXTRA_DIST += \
243-
test/functional
244-
245-
EXTRA_DIST += \
246-
test/util/test_runner.py \
247-
test/util/data/BGL-util-test.json \
248-
test/util/data/blanktxv1.hex \
249-
test/util/data/blanktxv1.json \
250-
test/util/data/blanktxv2.hex \
251-
test/util/data/blanktxv2.json \
252-
test/util/data/tt-delin1-out.hex \
253-
test/util/data/tt-delin1-out.json \
254-
test/util/data/tt-delout1-out.hex \
255-
test/util/data/tt-delout1-out.json \
256-
test/util/data/tt-locktime317000-out.hex \
257-
test/util/data/tt-locktime317000-out.json \
258-
test/util/data/tx394b54bb.hex \
259-
test/util/data/txcreate1.hex \
260-
test/util/data/txcreate1.json \
261-
test/util/data/txcreate2.hex \
262-
test/util/data/txcreate2.json \
263-
test/util/data/txcreatedata1.hex \
264-
test/util/data/txcreatedata1.json \
265-
test/util/data/txcreatedata2.hex \
266-
test/util/data/txcreatedata2.json \
267-
test/util/data/txcreatedata_seq0.hex \
268-
test/util/data/txcreatedata_seq0.json \
269-
test/util/data/txcreatedata_seq1.hex \
270-
test/util/data/txcreatedata_seq1.json \
271-
test/util/data/txcreatemultisig1.hex \
272-
test/util/data/txcreatemultisig1.json \
273-
test/util/data/txcreatemultisig2.hex \
274-
test/util/data/txcreatemultisig2.json \
275-
test/util/data/txcreatemultisig3.hex \
276-
test/util/data/txcreatemultisig3.json \
277-
test/util/data/txcreatemultisig4.hex \
278-
test/util/data/txcreatemultisig4.json \
279-
test/util/data/txcreatemultisig5.json \
280-
test/util/data/txcreateoutpubkey1.hex \
281-
test/util/data/txcreateoutpubkey1.json \
282-
test/util/data/txcreateoutpubkey2.hex \
283-
test/util/data/txcreateoutpubkey2.json \
284-
test/util/data/txcreateoutpubkey3.hex \
285-
test/util/data/txcreateoutpubkey3.json \
286-
test/util/data/txcreatescript1.hex \
287-
test/util/data/txcreatescript1.json \
288-
test/util/data/txcreatescript2.hex \
289-
test/util/data/txcreatescript2.json \
290-
test/util/data/txcreatescript3.hex \
291-
test/util/data/txcreatescript3.json \
292-
test/util/data/txcreatescript4.hex \
293-
test/util/data/txcreatescript4.json \
294-
test/util/data/txcreatescript5.hex \
295-
test/util/data/txcreatescript6.hex \
296-
test/util/data/txcreatesignv1.hex \
297-
test/util/data/txcreatesignv1.json \
298-
test/util/data/txcreatesignv2.hex \
299-
test/util/rpcauth-test.py
300-
301-
CLEANFILES = $(OSX_DMG) $(BGL_WIN_INSTALLER)
302-
303-
DISTCHECK_CONFIGURE_FLAGS = --enable-man
304-
305-
doc/doxygen/.stamp: doc/Doxyfile FORCE
306-
$(MKDIR_P) $(@D)
307-
$(DOXYGEN) $^
308-
$(AM_V_at) touch $@
309-
310-
if HAVE_DOXYGEN
311-
docs: doc/doxygen/.stamp
312-
else
313-
docs:
314-
@echo "error: doxygen not found"
315-
endif
316-
317-
clean-docs:
318-
rm -rf doc/doxygen
319-
320-
clean-local: clean-docs
321-
rm -rf coverage_percent.txt test_BGL.coverage/ total.coverage/ fuzz.coverage/ test/tmp/ cache/ $(OSX_APP)
322-
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__
323-
rm -rf osx_volname dist/ dpi36.background.tiff dpi72.background.tiff
324-
325-
test-security-check:
326-
if TARGET_DARWIN
327-
$(AM_V_at) CC='$(CC)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-security-check.py TestSecurityChecks.test_MACHO
328-
$(AM_V_at) CC='$(CC)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_MACHO
329-
endif
330-
if TARGET_WINDOWS
331-
$(AM_V_at) CC='$(CC)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-security-check.py TestSecurityChecks.test_PE
332-
$(AM_V_at) CC='$(CC)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_PE
333-
endif
334-
if TARGET_LINUX
335-
$(AM_V_at) CC='$(CC)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-security-check.py TestSecurityChecks.test_ELF
336-
$(AM_V_at) CC='$(CC)' CPPFILT='$(CPPFILT)' $(PYTHON) $(top_srcdir)/contrib/devtools/test-symbol-check.py TestSymbolChecks.test_ELF
337-
endif
119+
EXTRA_DIST=$(UNIVALUE_TEST_FILES_INT) $(GEN_SRCS)

build-aux/m4/ax_cxx_compile_stdcxx.m4

+13-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# The second argument, if specified, indicates whether you insist on an
1717
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
1818
# -std=c++11). If neither is specified, you get whatever works, with
19-
# preference for an extended mode.
19+
# preference for no added switch, and then for an extended mode.
2020
#
2121
# The third argument, if specified 'mandatory' or if left unspecified,
2222
# indicates that baseline support for the specified C++ standard is
@@ -35,13 +35,14 @@
3535
# Copyright (c) 2015 Moritz Klammler <[email protected]>
3636
# Copyright (c) 2016, 2018 Krzesimir Nowak <[email protected]>
3737
# Copyright (c) 2019 Enji Cooper <[email protected]>
38+
# Copyright (c) 2020 Jason Merrill <[email protected]>
3839
#
3940
# Copying and distribution of this file, with or without modification, are
4041
# permitted in any medium without royalty provided the copyright notice
4142
# and this notice are preserved. This file is offered as-is, without any
4243
# warranty.
4344

44-
#serial 11
45+
#serial 12
4546

4647
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
4748
dnl (serial version number 13).
@@ -62,6 +63,16 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
6263
AC_LANG_PUSH([C++])dnl
6364
ac_success=no
6465
66+
m4_if([$2], [], [dnl
67+
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
68+
ax_cv_cxx_compile_cxx$1,
69+
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
70+
[ax_cv_cxx_compile_cxx$1=yes],
71+
[ax_cv_cxx_compile_cxx$1=no])])
72+
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
73+
ac_success=yes
74+
fi])
75+
6576
m4_if([$2], [noext], [], [dnl
6677
if test x$ac_success = xno; then
6778
for alternative in ${ax_cxx_compile_alternatives}; do

0 commit comments

Comments
 (0)