Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
5a14f57
VDB-4799 commented out an unused schema fn
aboshkin Oct 16, 2024
dea0d85
VDB-4799 fixed install code
aboshkin Oct 30, 2024
c807b2c
VDB-4796 saving work
aboshkin Nov 27, 2024
9851791
VDB-4796 saving work
aboshkin Dec 5, 2024
3e5e2bb
VDB-4796 saving work
aboshkin Dec 5, 2024
e4f5b87
VDB-4796 saving work
aboshkin Dec 6, 2024
8a90cee
VDB-4796 saving work
aboshkin Dec 6, 2024
2331ad2
VDB-4796 saving work
aboshkin Dec 12, 2024
31d2729
VDB-4796 saving work
aboshkin Dec 12, 2024
17b1ecf
VDB-4796 saving work
aboshkin Dec 14, 2024
4fb26e6
VDB-4796 skipping core file testing on non-Ubuntu Linux
aboshkin Dec 18, 2024
6ea4df4
VDB-4796 saving work
aboshkin Dec 19, 2024
301db44
Merge branch 'engineering' into VDB-4796
aboshkin Dec 19, 2024
c21db93
Merge branch 'engineering' into VDB-4796
aboshkin Dec 19, 2024
ff5d087
VDB-4796 saving work
aboshkin Dec 19, 2024
0e3d05d
VDB-4796 saving work
aboshkin Dec 20, 2024
0dc48af
VDB-4796 saving work
aboshkin Dec 26, 2024
d6d0cb4
VDB-4796 added kapp to a test link
aboshkin Dec 26, 2024
44359a1
VDB-4796 fixed argv allocation issue
aboshkin Dec 27, 2024
fe273b1
VDB-4796 version of test programs is now 0.0.0
aboshkin Dec 27, 2024
48aec4c
VDB-4796 Windows fix
aboshkin Dec 27, 2024
7b8d348
VDB-4796 Windows fix, bad indirection
aboshkin Dec 27, 2024
cd5700a
VDB-5901: Toolkit Release Version 3.2.1
klymenko Mar 12, 2025
92b7367
Merge pull request #157 from ncbi/VDB-4799
aboshkin Mar 19, 2025
441eb74
VDB-4228, VDB-5895: restore VResolverCaching state before exiting Fin…
klymenko Mar 21, 2025
b41a974
VDB-4228, VDB-5895: restore VResolverCaching state before exiting Fin…
klymenko Mar 21, 2025
f86eead
VDB-5901: 3.2.2-dev release
klymenko Mar 21, 2025
49a9b3a
Merge branch 'engineering' into VDB-4796
aboshkin Mar 26, 2025
ce1037e
Merge branch 'VDB-5895' into engineering
klymenko Apr 2, 2025
79173d8
VDB-4796 renamed VDB::VdbApp to VDB::Application
aboshkin Apr 2, 2025
8007846
VDB-4796 saving work
aboshkin Apr 3, 2025
55242ae
Removed strchrnul
durbrow Apr 4, 2025
4206fa5
VDB-4796 removed unnecessary kapp-related functions from test projects
aboshkin Apr 4, 2025
fd9519c
Make it more obviously moved
durbrow Apr 7, 2025
e6a2e34
Merge pull request #181 from ncbi/VDB-5946
durbrow Apr 7, 2025
b11b331
VDB-4796 saving work
aboshkin Apr 8, 2025
7dd2667
VDB-5947 upgraded zlib to v. 1.3.1.
aboshkin Apr 8, 2025
54a5cfa
VDB-4796 new test
aboshkin Apr 8, 2025
bfb02c8
Merge pull request #182 from ncbi/VDB-5947
aboshkin Apr 8, 2025
1f60253
VDB-4796 using WinAPI for conversions between wchar and utf8
aboshkin Apr 8, 2025
3d518cf
VDB-4796 added .gitignore
aboshkin Apr 8, 2025
4bda62b
Merge branch 'engineering' into VDB-4796
aboshkin Apr 9, 2025
5e2ef0f
Merge pull request #175 from ncbi/VDB-4796
aboshkin Apr 9, 2025
a0b5b12
Changed sprintf to snprintf in tests
durbrow Apr 11, 2025
1c5242e
Replace sprintf with snprintf
durbrow Apr 11, 2025
b771f9d
Detect missing reference sequences
durbrow Apr 16, 2025
c5dec4e
Added test
durbrow Apr 16, 2025
7a6c532
VDB-5945: avoid running setup.py directly
klymenko Apr 17, 2025
80f957d
Warn but all import of bad reference, but error on use.
durbrow Apr 17, 2025
ddf53cd
VDB-5936 removed KMain and wmain from test projects
aboshkin Apr 18, 2025
7cafffd
VDB-5936 fixed Ubuntu issues
aboshkin Apr 18, 2025
ebcd930
added #include <klib/status.h>
klymenko Apr 18, 2025
72e5a4f
VDB-5936 KMain removed from non-Windows tests
aboshkin Apr 22, 2025
ba90aea
VDB-5961 removed KMain and dependencies (moving to sra-tools)
aboshkin Apr 22, 2025
2f85177
VDB-5961 moved sysmain.c's to sra-tools
aboshkin Apr 22, 2025
21006a5
VDB-5961 fixed a missing #include
aboshkin Apr 22, 2025
6cdce84
VDB-5961 fixing a Mac issue
aboshkin Apr 22, 2025
14dbbef
VDB-5961 fixed #includes
aboshkin Apr 23, 2025
5aecb98
VDB-5961 removed kapp from dll link tests
aboshkin Apr 23, 2025
0eb685c
VDB-5960 fixed lost app version
aboshkin Apr 23, 2025
88ae6bf
VDB-5960 fixed KNS tests involving app version
aboshkin Apr 23, 2025
29173c7
VDB-5961 fixing a Windows issue
aboshkin Apr 24, 2025
ddcfa90
VDB-5961 dealing with a Windows file removal issue
aboshkin Apr 24, 2025
71d12d1
Merge branch 'VDB-5961' of https://github.com/ncbi/ncbi-vdb into VDB-…
aboshkin Apr 24, 2025
44bb7d7
Merge pull request #185 from ncbi/VDB-5960
aboshkin Apr 25, 2025
c84fd09
Merge branch 'engineering' into VDB-5936
aboshkin Apr 29, 2025
508c3b4
VDB-5936 debugging merge
aboshkin Apr 29, 2025
4d9c740
VDB-5936 debugging merge
aboshkin Apr 29, 2025
73cbb71
Merge pull request #184 from ncbi/VDB-5936
aboshkin Apr 29, 2025
901e57b
Merge branch 'engineering' into VDB-5961
aboshkin Apr 29, 2025
d98d2a0
Merge pull request #186 from ncbi/VDB-5961
aboshkin Apr 30, 2025
8b9185a
VDB-5956: KFile read observer to calculate md5
klymenko Apr 30, 2025
0ea5ce2
VDB-5956: tests KFile read observer to calculate md5
klymenko May 1, 2025
359b16a
VDB-5956: memcpy -> memmove
klymenko May 1, 2025
2dba9ea
VDB-5956: mac fix
klymenko May 1, 2025
9be52c0
VDB-5956: windows fix
klymenko May 1, 2025
7763fda
VDB-5956: fix of windows fix
klymenko May 1, 2025
fdfab7b
Merge branch 'engineering' into VDB-5956
klymenko May 1, 2025
ea645de
VDB-5936: KMain removed from non-Windows tests
klymenko May 1, 2025
214e20c
check for failures
klymenko May 1, 2025
5d3adbb
fixed file permissions
klymenko May 1, 2025
045c2f6
VDB-5695 saving work
aboshkin May 2, 2025
797143e
Make RC silent
durbrow May 5, 2025
a9c548e
Merge branch 'engineering' into VDB-5959
durbrow May 5, 2025
786ee12
VDB-5956: extracted ObserverTest
klymenko May 6, 2025
95a46e9
VDB-5956: typo
klymenko May 6, 2025
f73f624
Merge branch 'VDB-5956' into engineering
klymenko May 7, 2025
b93e45a
VDB-5965 saving work
aboshkin May 7, 2025
01fbb3e
Fix atomic
durbrow May 8, 2025
76fd7b9
Fix atomic
durbrow May 8, 2025
16f07ef
Remove sprintf
durbrow May 8, 2025
7847f23
Fix atomic
durbrow May 8, 2025
da3c6b2
Fix leaking thread
durbrow May 8, 2025
2fcbd6e
Fix copy/paste error
durbrow May 8, 2025
a835920
VDB-5965 saving work
aboshkin May 9, 2025
5c568db
Fix sanitizer tests
durbrow May 9, 2025
295f956
Remove cxx atomic template hack
durbrow May 9, 2025
00e6c7d
Fix sanitizer tests
durbrow May 9, 2025
220e734
There's no architecture dependency in the atomics
durbrow May 9, 2025
d451cd5
Merge remote-tracking branch 'origin/engineering' into VDB-5959
durbrow May 12, 2025
06f4549
VDB-5965 push for TC
aboshkin May 13, 2025
b685c3a
Fixed memory leak
kdurbrow May 16, 2025
7b04a77
Merge pull request #191 from ncbi/VDB-5988
durbrow May 18, 2025
b55618b
Merge pull request #189 from ncbi/VDB-5959
durbrow May 19, 2025
d73486e
Merge pull request #183 from ncbi/VDB-5931
durbrow May 19, 2025
0cc160c
Needed to print out the RC
durbrow May 19, 2025
54ed4cd
VDB-5989 fixed memory leak in ksf/arc.c
aboshkin May 20, 2025
8c758bf
Incomplete conversion, some function were missed?
durbrow May 20, 2025
69b1a4f
Merge pull request #192 from ncbi/VDB-5989
durbrow May 20, 2025
6e4906f
VDB-5951: reenable tests of libncbi-vdb; accept dependency on the C++…
klymenko May 22, 2025
960760e
VDB-5885 replaced asserts with clamping
aboshkin May 22, 2025
86c4cbd
The reference needs to be properly retained/released
durbrow May 22, 2025
73cda33
VDB-5995 fixed clang warnings
aboshkin May 23, 2025
c2fae80
Merge pull request #193 from ncbi/VDB-4910
durbrow May 23, 2025
135fac2
Update ASTBuilder.cpp
durbrow May 23, 2025
90b602e
Moved to sra-tools
durbrow May 23, 2025
68a5a0f
Moved to sra-tools
durbrow May 23, 2025
daf35df
Merge pull request #194 from ncbi/VDB-5995
aboshkin May 27, 2025
a50dc16
Merge pull request #195 from ncbi/VDB-5885
aboshkin May 27, 2025
5b7114b
fixed missing block
klymenko May 27, 2025
671662a
VDB-5965 simplyfing conversion of rc to OS exot code
aboshkin May 28, 2025
5cb541f
VDB-5965 a final touch; merge from engineering
aboshkin May 29, 2025
0e96f28
Merge pull request #190 from ncbi/VDB-5965
aboshkin May 30, 2025
cad9259
VDB-4939: memleak fixed
klymenko May 30, 2025
5a8e249
do not fix AD repository configuration if it is disabled
klymenko May 30, 2025
2c749a4
VDB-5997: keep '.exe' in User-Agent header on Windows; fixed compiler…
klymenko Jun 3, 2025
79ab9fe
fixed misleading indents
klymenko Jun 3, 2025
baba33c
Merge pull request #196 from ncbi/VDB-5996
durbrow Jun 3, 2025
9aab14e
Merge branch 'VDB-5997' into engineering
klymenko Jun 4, 2025
95cf7cd
VDB-6015: improved python test
klymenko Jun 18, 2025
10112e1
VDB-5096 disabling sanitizer tests if ASAN is not detected
aboshkin Jun 25, 2025
be677a7
Merge pull request #200 from ncbi/VDB-5096
aboshkin Jun 25, 2025
4d3554b
fixing Windows compiler warnings
klymenko Jun 30, 2025
6de2375
VDB-6033 done, need to merge with VDB-5096
aboshkin Jul 1, 2025
4c74cb0
Revert "VDB-6033 done, need to merge with VDB-5096"
aboshkin Jul 1, 2025
c5a5b34
VDB-6033 done, need to merge with VDB-5096
aboshkin Jul 1, 2025
9f117de
VDB-5096 second attempt
aboshkin Jul 1, 2025
33e6c26
VDB-5096 now using execute_process() to check for sanitizers
aboshkin Jul 2, 2025
189a2b6
VDB-6033 fixed sanitizer detection logic
aboshkin Jul 2, 2025
1075faf
VDB-6035 removed memory leaks in CLOUD test code
aboshkin Jul 2, 2025
3d2de30
VDB-6048: improve verbosity of cache tee file
klymenko Jul 2, 2025
cc7e5db
VDB-6048: improve verbosity of cache tee file: added include
klymenko Jul 2, 2025
0d35168
Merge pull request #201 from ncbi/VDB-6033
aboshkin Jul 3, 2025
9d1be74
Merge pull request #202 from ncbi/VDB-6035
aboshkin Jul 3, 2025
c93b48b
VDB-6034 disabled the test for multi-threaded access to cacheteefile.…
aboshkin Jul 3, 2025
9a3d998
Merge branch 'VDB-6048' into engineering
klymenko Jul 8, 2025
292da2b
VDB-6045: allow to include version stamp
klymenko Jul 9, 2025
21103a3
VDB-6036 removed memory leak in test
aboshkin Jul 11, 2025
1dc3673
VDB-6037 removed leak in test fixture
aboshkin Jul 15, 2025
1fae43e
VDB-6038 remove memory leaks in tests; some previously known leaks re…
aboshkin Jul 16, 2025
3d031c8
fixed .so link check (observing @CXXABI, not @@CXXABI on an Ubuntu host)
aboshkin Jul 17, 2025
b39c7d6
Merge branch 'engineering' into VDB-6038
aboshkin Jul 18, 2025
aa6f192
Merge pull request #205 from ncbi/VDB-6036
aboshkin Jul 22, 2025
07983ff
VDB-6038 removed memory leaks from VDB and tests
aboshkin Jul 23, 2025
089c306
Merge pull request #206 from ncbi/VDB-6037
aboshkin Jul 24, 2025
8b32828
VDB-6038 fixed read access to a refcount to be atomic
aboshkin Jul 24, 2025
41c18b3
Merge pull request #207 from ncbi/VDB-6038
aboshkin Jul 24, 2025
fb574cf
VDB-6039 fixed data races; replaced gethostbyname_r with getaddrinfo …
aboshkin Jul 29, 2025
a5fdbe9
VDB-6039 promoted linux/sysendpoint to unix/
aboshkin Jul 29, 2025
daabd90
VDB-6039: fixed sanitizer warning
klymenko Jul 29, 2025
a6f7666
VDB-6039 replaced gethostbyname with getaddrinfo on Windows
aboshkin Jul 29, 2025
5196e89
VDB-6040 simplified a test to avoid unnecessary races
aboshkin Jul 30, 2025
9d1fac8
Merge branch 'VDB-6039' into VDB-6040
aboshkin Jul 30, 2025
0e3006d
Merge pull request #203 from ncbi/VDB-6034
aboshkin Jul 30, 2025
f36e538
Merge branch 'engineering' into VDB-6040
aboshkin Jul 30, 2025
6642cb6
fixed a bad fix in a test
aboshkin Jul 30, 2025
c26633f
Merge branch 'engineering' into VDB-6040
aboshkin Jul 30, 2025
29cb0f9
VDB-6074 fixed undefined behavior in btree.c; refactored sanitizer co…
aboshkin Jul 31, 2025
bac3370
VDB-6074 removed races; restricted memory-hogging test suite to TeamC…
aboshkin Aug 1, 2025
1b4e020
Merge pull request #209 from ncbi/VDB-6040
aboshkin Aug 1, 2025
168fa03
Merge branch 'VDB-6045' into engineering
klymenko Aug 4, 2025
904a8e6
VDB-6074 fixed sanitizer-reported problems
aboshkin Aug 6, 2025
aabd425
VDB-6074 fixed threading problems
aboshkin Aug 6, 2025
8aead87
VDB-6074 fixed memory leaks
aboshkin Aug 6, 2025
8a9fa8a
VDB-6079: fixed KMDataNodeVDropChild to work with complex nodes
klymenko Aug 7, 2025
710ee98
VDB-6079: added KMDataNodeDropChild test
klymenko Aug 7, 2025
4e66295
don't start version with '\n'
klymenko Aug 12, 2025
5a22384
VDB-6083: fixed verification of minimum size when loading P_BSTree
klymenko Aug 15, 2025
5bcf868
VDB-6083: validate Metadata before flushing it
klymenko Aug 15, 2025
eb711d5
VDB-6083: reformatted
klymenko Aug 15, 2025
5d62b8c
VDB-6083: don't check meta to be saved when it was partially flushed …
klymenko Aug 18, 2025
909caea
Check Release-s rc-s in VDatabaseWhack
klymenko Aug 18, 2025
38fb40a
VDB-6083: added Test_VDB_TooBigMeta
klymenko Aug 18, 2025
cc204ed
VDB-6083: added Test_VDB_TooBigMeta: fixed
klymenko Aug 18, 2025
bba08eb
VDB-6083: added Test_VDB_TooBigMeta: fixed
klymenko Aug 18, 2025
19fe53c
VDB-6078: fixed deprecation
klymenko Aug 19, 2025
b21eda5
VDB-4430, VDB-6078: fixed to work on all UNIX platforms
klymenko Aug 20, 2025
528e020
Remove possible use-after-free
durbrow Aug 21, 2025
73929ff
Merge remote-tracking branch 'origin/VDB-6080' into VDB-6026
aboshkin Aug 22, 2025
970ea72
VDB-6026 removed memory leaks from kns
aboshkin Aug 22, 2025
42e140d
VDB-6026 fixed an uninitialized variable
aboshkin Aug 22, 2025
a94c222
Merge pull request #212 from ncbi/VDB-6080
aboshkin Aug 22, 2025
a86cd65
Merge branch 'VDB-6078' into engineering
klymenko Aug 22, 2025
4d82d3a
www.nlm.nih.gov -> usa.gov
klymenko Aug 27, 2025
23751d3
Merge pull request #213 from ncbi/VDB-6026
aboshkin Aug 27, 2025
f50cece
VDB-6027 simplified schema tests
aboshkin Aug 29, 2025
2850406
VDB-6027 removed memory leak
aboshkin Aug 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 29 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
----
PUBLIC DOMAIN NOTICE
National Center for Biotechnology Information

This software/database is a "United States Government Work" under the
terms of the United States Copyright Act. It was written as part of
the author's official duties as a United States Government employee and
thus cannot be copyrighted. This software/database is freely available
to the public for use. The National Library of Medicine and the U.S.
Government have not placed any restriction on its use or reproduction.

Although all reasonable efforts have been taken to ensure the accuracy
and reliability of the software and data, the NLM and the U.S.
Government do not and cannot warrant the performance or results that
may be obtained by using this software or data. The NLM and the U.S.
Government disclaim all warranties, express or implied, including
warranties of performance, merchantability or fitness for any particular
purpose.

Please cite the author in any work or product based on this material.

----
# NCBI External Developer Release:


## NCBI VDB 3.2.1
**March 18, 2025**

**fasterq-dump, kns, sratools, vdb, vfs**: fixed failure of fasterq-dump when accessing run via HTTP
**kdb**: fixed memory leak


## NCBI VDB 3.2.0
**January 14, 2025**

Expand Down
2 changes: 1 addition & 1 deletion build/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ld.linux.exe_cmd.sh
Makefile.config*
COMP.*

a.out
2 changes: 2 additions & 0 deletions build/Makefile.env
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ endif

unexport TOP SRCDIR

export OS_DISTRIBUTOR

# CPP comes from Makefile.config.$(OS_ARCH)
# TODO: simplify Makefile.config.$(OS_ARCH) generated by ./configure - switch from using LD to a new variable
CMAKEFLAGS = \
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.vers
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
# ===========================================================================

# NCBI-VDB and library version
VERSION = 3.2.1
VERSION = 3.2.2
19 changes: 13 additions & 6 deletions build/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ function( MSVS_DLLRuntime name )
endif()
endfunction()

#
# sanitizer settings
# address sanitizer: stop and fail the test if undefined behavior is detected
set( asan_defs "-fsanitize=address" "-fsanitize=undefined" "-fno-sanitize-recover=undefined" )
set( tsan_defs "-fsanitize=thread" )
#

function( GenerateStaticLibsWithDefs target_name sources compile_defs )
add_library( ${target_name} STATIC ${sources} )
if( NOT "" STREQUAL "${compile_defs}" )
Expand All @@ -54,15 +61,13 @@ function( GenerateStaticLibsWithDefs target_name sources compile_defs )
endif()

if( RUN_SANITIZER_TESTS )
set( asan_defs "-fsanitize=address" "-fsanitize=undefined" )
add_library( "${target_name}-asan" STATIC ${sources} )
if( NOT "" STREQUAL "${compile_defs}" )
target_compile_definitions( "${target_name}-asan" PRIVATE ${compile_defs} )
endif()
target_compile_options( "${target_name}-asan" PUBLIC ${asan_defs} )
target_link_options( "${target_name}-asan" PUBLIC ${asan_defs} )

set( tsan_defs "-fsanitize=thread" "-fsanitize=undefined" )
add_library( "${target_name}-tsan" STATIC ${sources} )
if( NOT "" STREQUAL "${compile_defs}" )
target_compile_definitions( "${target_name}-tsan" PRIVATE ${compile_defs} )
Expand Down Expand Up @@ -198,9 +203,13 @@ endfunction()

function( BuildExecutableForTest exe_name sources libraries )
add_executable( ${exe_name} ${sources} )
if(NOT _NCBIVDB_CFG_PACKAGING)
if( WIN32 )
target_link_options( ${exe_name} PRIVATE "/ENTRY:mainCRTStartup" )
endif()

if(NOT _NCBIVDB_CFG_PACKAGING)
MSVS_StaticRuntime( ${exe_name} )
endif()
endif()
target_link_libraries( ${exe_name} ${libraries} )
endfunction()

Expand All @@ -209,13 +218,11 @@ function( AddExecutableTest test_name sources libraries )
add_test( NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )

if( RUN_SANITIZER_TESTS )
set( asan_defs "-fsanitize=address" "-fsanitize=undefined" )
BuildExecutableForTest( "${test_name}_asan" "${sources}" "${libraries}" )
target_compile_options( "${test_name}_asan" PRIVATE ${asan_defs} )
target_link_options( "${test_name}_asan" PRIVATE ${asan_defs} )
add_test( NAME "${test_name}_asan" COMMAND "${test_name}_asan" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )

set( tsan_defs "-fsanitize=thread" "-fsanitize=undefined" )
BuildExecutableForTest( "${test_name}_tsan" "${sources}" "${libraries}" )
target_compile_options( "${test_name}_tsan" PRIVATE ${tsan_defs} )
target_link_options( "${test_name}_tsan" PRIVATE ${tsan_defs} )
Expand Down
62 changes: 41 additions & 21 deletions build/env.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -389,31 +389,51 @@ if ( SINGLE_CONFIG )
)
endif()

if( NOT SINGLE_CONFIG )
if( RUN_SANITIZER_TESTS )
message( "RUN_SANITIZER_TESTS (${RUN_SANITIZER_TESTS}) cannot be turned on in a non single config mode - overriding to OFF" )
endif()
set( RUN_SANITIZER_TESTS OFF )
endif()
execute_process( COMMAND sh -c "${CMAKE_CXX_COMPILER} -fsanitize=address test.cpp && ./a.out"
RESULT_VARIABLE ASAN_WORKS
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/build )
execute_process( COMMAND sh -c "${CMAKE_CXX_COMPILER} -fsanitize=thread test.cpp && ./a.out"
RESULT_VARIABLE TSAN_WORKS
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/build )

if( ASAN_WORKS EQUAL 0 AND TSAN_WORKS EQUAL 0 )

if( NOT SINGLE_CONFIG AND RUN_SANITIZER_TESTS )
message( "RUN_SANITIZER_TESTS (${RUN_SANITIZER_TESTS}) cannot be turned on in a non single config mode - overriding to OFF" )
set( RUN_SANITIZER_TESTS OFF )
endif()

if( RUN_SANITIZER_TESTS )
find_program(LSB_RELEASE_EXEC lsb_release)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("LSB_RELEASE_ID_SHORT: ${LSB_RELEASE_ID_SHORT}")
if( LSB_RELEASE_ID_SHORT STREQUAL "Ubuntu" )
message("Disabling sanitizer tests on Ubuntu...")
set( RUN_SANITIZER_TESTS OFF )
endif()
endif()
if( RUN_SANITIZER_TESTS_OVERRIDE )
message("Overriding sanitizer tests due to RUN_SANITIZER_TESTS_OVERRIDE: ${RUN_SANITIZER_TESTS_OVERRIDE}")
set( RUN_SANITIZER_TESTS ON )
endif()

#
# TSAN-instrumented programs used to crash on starup with certain version of Ubuntu kernel. Seems to be not thecase anymore, so disabling this section.
#
# if( RUN_SANITIZER_TESTS )
# find_program(LSB_RELEASE_EXEC lsb_release)
# execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
# OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
# OUTPUT_STRIP_TRAILING_WHITESPACE
# )
# message("LSB_RELEASE_ID_SHORT: ${LSB_RELEASE_ID_SHORT}")
# if( LSB_RELEASE_ID_SHORT STREQUAL "Ubuntu" )
# message("Disabling sanitizer tests on Ubuntu...")
# set( RUN_SANITIZER_TESTS OFF )
# endif()
# endif()

else()

message("ASAN suport is not detected. Disabling sanitizer tests.")
set( RUN_SANITIZER_TESTS OFF )
set( RUN_SANITIZER_TESTS_OVERRIDE OFF )

if( RUN_SANITIZER_TESTS_OVERRIDE )
message("Overriding sanitizer tests due to RUN_SANITIZER_TESTS_OVERRIDE: ${RUN_SANITIZER_TESTS_OVERRIDE}")
set( RUN_SANITIZER_TESTS ON )
endif()
message( "RUN_SANITIZER_TESTS: ${RUN_SANITIZER_TESTS}" )


endif(NOT _NCBIVDB_CFG_PACKAGING)

if( NOT HAVE_MBEDTLS_F )
Expand Down
1 change: 1 addition & 0 deletions build/san_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main(){}
6 changes: 6 additions & 0 deletions build/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <cstdlib>
int main()
{
//void* p = malloc(1);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ extern "C" {
#if DFLT_ATOMIC_BITS == 32
#define ATOMIC_NAME( suffix ) \
atomic32_ ## suffix
typedef int atomic_int;
#else
#define ATOMIC_NAME( suffix ) \
atomic64_ ## suffix
typedef long int atomic_int;
#endif

typedef struct ATOMIC_NAME ( t ) atomic_t;
Expand Down Expand Up @@ -108,14 +106,16 @@ struct atomic_ptr_t

/* int atomic_read_ptr ( const atomic_ptr_t *v ); */
#define atomic_read_ptr( v ) \
( ( v ) -> ptr )
__atomic_load_n( & ( ( v ) -> ptr ), __ATOMIC_SEQ_CST )

#define atomic_set_ptr( v, s ) \
__atomic_store_n( & ( ( v ) -> ptr ), s, __ATOMIC_SEQ_CST )

static __inline__
void *atomic_test_and_set_ptr ( atomic_ptr_t *v, void *s, void *t )
void *atomic_test_and_set_ptr ( atomic_ptr_t *const v, void *const s, void *const t )
{
void *rtn = v -> ptr;
if ( rtn == t )
v -> ptr = s;
void *rtn = t;
__atomic_compare_exchange_n(&v->ptr, &rtn, s, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return rtn;
}

Expand Down Expand Up @@ -178,6 +178,7 @@ void *atomic_test_and_set_ptr ( atomic_ptr_t *v, void *s, void *t )

#ifdef __cplusplus
}

#endif

#endif /* _h_atomic_ */
Original file line number Diff line number Diff line change
Expand Up @@ -39,64 +39,64 @@ extern "C" {
typedef struct atomic32_t atomic32_t;
struct atomic32_t
{
volatile int counter;
int volatile counter;
};

/* int atomic32_read ( const atomic32_t *v ); */
#define atomic32_read( v ) \
( ( v ) -> counter )
__atomic_load_n(&((v)->counter), __ATOMIC_SEQ_CST)

/* void atomic32_set ( atomic32_t *v, int i ); */
#define atomic32_set( v, i ) \
( ( void ) ( ( ( v ) -> counter ) = ( i ) ) )
__atomic_store_n(&((v)->counter), i, __ATOMIC_SEQ_CST)

/* add to v -> counter and return the prior value */
static __inline__ int atomic32_read_and_add ( atomic32_t *v, int i )
{
return __sync_fetch_and_add( & v -> counter, i );
}
#define atomic32_read_and_add( v, i ) \
__atomic_fetch_add(&((v)->counter), i, __ATOMIC_SEQ_CST)

/* if no read is needed, define the least expensive atomic add */
#define atomic32_add( v, i ) \
atomic32_read_and_add ( v, i )
((void)atomic32_read_and_add(v, i))

/* add to v -> counter and return the result */
static __inline__ int atomic32_add_and_read ( atomic32_t *v, int i )
static __inline__ int atomic32_add_and_read ( atomic32_t *const v, int const i )
{
return __sync_add_and_fetch( & v -> counter, i );
return __atomic_add_fetch(&((v)->counter), i, __ATOMIC_SEQ_CST);
}

/* just don't try to find out what the result was */
static __inline__ void atomic32_inc ( atomic32_t *v )
static __inline__ void atomic32_inc ( atomic32_t *const v )
{
atomic32_add( v, 1 );
}

static __inline__ void atomic32_dec ( atomic32_t *v )
static __inline__ void atomic32_dec ( atomic32_t *const v )
{
atomic32_add( v, -1 );
__atomic_fetch_sub(&((v)->counter), 1, __ATOMIC_SEQ_CST);
}

/* decrement by one and test result for 0 */
static __inline__ int atomic32_dec_and_test ( atomic32_t *v )
static __inline__ int atomic32_dec_and_test ( atomic32_t *const v )
{
return __sync_add_and_fetch( & v -> counter, -1 ) == 0;
return __atomic_sub_fetch(&((v)->counter), 1, __ATOMIC_SEQ_CST) == 0;
}

/* when atomic32_dec_and_test uses predecrement, you want
postincrement to this function. so it isn't very useful */
static __inline__ int atomic32_inc_and_test ( atomic32_t *v )
static __inline__ int atomic32_inc_and_test ( atomic32_t *const v )
{
return __sync_add_and_fetch( & v -> counter, 1 ) == 0;
return atomic32_add_and_read(v, 1) == 0;
}

/* HERE's useful */
#define atomic32_test_and_inc( v ) \
( atomic32_read_and_add ( v, 1 ) == 0 )

static __inline__ int atomic32_test_and_set ( atomic32_t *v, int newval, int oldval )
static __inline__ int atomic32_test_and_set ( atomic32_t *const v, int const newval, int const oldval )
{
return __sync_val_compare_and_swap( & v -> counter, oldval, newval ); //NB: newval/oldval switched around
int expected = oldval;
__atomic_compare_exchange_n(&((v)->counter), &expected, newval, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return expected;
}

/* conditional modifications */
Expand Down
Loading