Commit Graph

4152 Commits

Author SHA1 Message Date
Quincey Koziol
97e1ed4fc8
Refactor allocation of API context (#4942)
Since each API context is local to a thread, use the stack to
store the context instead of allocating & releasing it each time.
This improves performance (slightly), reduces alloc/free calls,
and eliminates the H5FL package from the push & pop operations,
which helps simplify threadsafe operation.

One effect of this change is that the H5VLstart_lib_state /
H5VLfinish_lib_state API routines for pass through connector
authors now require a parameter that can be used to store
the library's context. It was probably a mistake to assume
that these two routines would not do this previously, so this
is essentially a bug fix for them.

Some other minor things:

 * Added API context push+pop operations to cache tests
  (I'm not actually certain why this was working before) and
  a few other places
* Cleaned up a bunch of warnings in test code (calloc args, mainly)
* Made header file inclusions more standard in some source files
2024-10-24 10:09:22 -07:00
Allen Byrne
1b72a1bca0
Add support for native zlib-ng in the library and compression references (#4935)
* Correct compile defs for zip_perf program
2024-10-23 16:20:15 -05:00
Quincey Koziol
ed4419cc52
Remove another couple of H5E_clear_stack calls (#4968)
Also cleans up the links test, which had a ton of copy-and-pasted incorrect negative error checks (Calling TEST_ERROR within H5E_BEGIN_TRY / H5E_END_TRY pairs will goto out of the pair, leaving errors suppressed).
2024-10-23 10:13:57 -07:00
Allen Byrne
baa1e8e292
Prefix remaining CMake options except for CMake BUILD* variables (#4990) 2024-10-22 15:40:54 -07:00
Dana Robinson
7f1e49206d
Renamed COPYING to LICENSE (#4978)
This is where most people will expect to find license information. The
COPYING_LBNL_HDF5 file has also been renamed to LICENSE_LBNL_HDF5.
The licenses are unchanged.
2024-10-18 21:13:04 -07:00
jhendersonHDF
0559ba6881
Remove FALSE from some API tests (#4977) 2024-10-18 12:02:51 -07:00
Dana Robinson
1c23395bd6
Remove TRUE and FALSE from H5private.h (#4969)
* Remove TRUE and FALSE from H5private.h

* Replace hbool_t with bool in test code
2024-10-18 07:57:34 -07:00
vchoi-hdfgroup
9df4c0dad4
Fix for issue #4849 that settings in fapl libver bounds causes unexpe… (#4939)
* Fix for issue #4849 that settings in fapl libver bounds causes unexpected H5Fopen failures.
File with non-SWMR-write access can now be opened without regard for superblock version.
Due to the fix, H5Fstart_swmr_write() also needs to be modified as well as the tests for libver bounds.
The "RFC: Setting Bounds for Object Creation in HDF5 1.10.0" is also updated to reflect the changes.

* Fix c++ libver bound test failure.
2024-10-11 07:38:22 -05:00
jhendersonHDF
302ba0a7f7
Minor refactoring of testframe.c testing framework (#4930)
Added setup and cleanup callback parameters to TestInit() to perform
setup and cleanup tasks once for whole test program

Removed TestCleanup() function since its functionality is covered by
PerformTests()

Added check of the HDF5_NOCLEANUP environment variable in
GetTestCleanup()
2024-10-07 12:27:09 -05:00
Dana Robinson
54f8f12ed9
Update clang-format to 17 (#4931)
Also bump the clang-format GitHub actions to 17
2024-10-04 19:49:35 -07:00
jhendersonHDF
33d9fa8e62
Use H5VLcmp_connector_cls to compare VOL connector IDs in API tests (#4929) 2024-10-04 12:31:14 -07:00
Quincey Koziol
767282f68a
VOL refactor and cleanup (#4856)
Cleanup and prepare for thread-safety changes.

Big ideas:

* Wrap H5VL_class_t with H5VL_connector_t, so use of the class can be refcounted within the H5VL package, instead of relying on storing an ID within the H5VL_t struct and incrementing & decrementing the ID's refcount.
* Register H5VL_connector_t* for VOL connector IDs, instead of the H5VL_class_t*
* Stop other packages from rummaging around inside H5VL_connector_t and H5VL_object_t data structures, so that the H5VL package can change implementation details without coupled changes throughout the library

Small things:

* Simplified the coding for creating links
* Moved some routines into more logical locations
2024-10-03 12:19:33 -07:00
Quincey Koziol
626f639850
Remove H5E_clear_stack() from H5SM code (#4861)
Introduces 'try' flag for H5B2_modify() call
2024-10-02 21:55:37 -05:00
github-actions
6ede7e5fb2 Committing clang-format changes 2024-10-02 19:53:38 -05:00
Allen Byrne
22650f7cbd add missing filename 2024-10-02 19:53:38 -05:00
Allen Byrne
07756c87f5 Update develop to 1.18 API 2024-10-02 19:53:38 -05:00
jhendersonHDF
34d6ef545a
Refactor h5test.c, testframe.c and testpar.h testing frameworks (#4891)
Added new testframe.h header to document testing framework functions and
split them away from h5test.h and from test programs that don't
integrate with the testframe.c testing framework

Added new test setup callback to testframe.c testing framework

Added parameters to AddTest() to specify size of test parameters so they
can be copied for later use

Enabled HDF5 error stacks in testframe.c framework by default and added
some error stack suppressions to some testhdf5 tests

Added new maxthreads option to testframe.c framework to allow specifying
the maximum number of threads a multi-threaded test can use

Moved TestExpress functionality out of testframe.c and into more general
h5test.c for wider use by tests through getter and setter

Updated some tests to not mix and match functionality between h5test.c/h
and testframe.c/h

Moved some functionality from testphdf5.h into testpar.h for parallel
tests that aren't part of testphdf5

Added new parallel test library that contains common shared
functionality for parallel tests (similar to h5test library)
2024-10-01 16:10:03 -05:00
Matt L
e2da35371b
Clean up thread-local error stacks in all threads (#4852)
* Clean up error stacks from secondary threads
2024-10-01 08:53:53 -07:00
bmribler
c2baceab9a
Fixed a memory leak from H5FL_blk_malloc (#4882)
In H5F__accum_reset(), when H5F__accum_flush() failed, the freeing of
f_sh->accum.buf was never reached, causing resource leak.

@fortnern added the third argument to H5F__accum_reset() so we can free
f_sh->accum.buf when we close the file, that is, when H5F__accum_reset()
is called from the H5F__dest() route, and can leave the accumulator in place
otherwise.
2024-09-26 16:05:50 -05:00
mattjala
39fdf5d075
Fix missing routine on MacOS ttsafe test (#4863) 2024-09-23 05:36:54 -05:00
Quincey Koziol
52d42fdb93
Reduce test iterations, etc. to keep time down on sower systems (#4853)
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
2024-09-19 01:46:29 -07:00
mattjala
d1cfe5295b
Fix memory leaks in ttsafe tests (#4842) 2024-09-18 10:35:45 -05:00
Larry Knox
901a8db2a2
Fix copyright notice urls in new test/ttsafe* files. (#4824)
* Update obsolete COPYING file URLs in copyright headers.
2024-09-12 15:23:31 -05:00
Dana Robinson
66cfc803ff
Add mirror VFD to serial -Werror CI action (#4753)
* Add mirror VFD to serial -Werror CI action

* NUL terminate mirror_vfd.c strings
2024-09-07 16:27:44 -07:00
Quincey Koziol
92532bbec8
Rename and add more locking infrastructure (#4729)
Rename existing recursive R/W locks from H5TS_rw_lock_t to H5TS_rec_rwlock_t, so it's more obvious that they are recursive.

Add non-recursive R/W lock, H5TS_rwlock_t

Add spinlock, H5TS_spinlock_t

Add an atomic void pointer, H5TS_atomic_voidp_t
2024-09-07 10:38:46 -07:00
bmribler
a75542b3e7
Detect invalid ID to H5Gmove2 (#4765)
User's application segfaulted because the returned value H5I_BADID wasn't
detected when H5I_get_type() was called.  This PR adds checks for invalid
file/group identifiers passed into H5Gmove2.

This defect occurs in many other places, hence, issue GH-4764.

Fixes #4737
2024-09-06 08:50:10 -07:00
Quincey Koziol
e66ec4f5ee
Resolve race around single counter by using two counters (#4792) 2024-08-30 14:11:01 -05:00
H. Joe Lee
90b07416a6
Remove dummy comments that repeat function names. (#4775) 2024-08-27 09:06:40 -07:00
mattjala
ff14dee3e9
Remove early test exit (#4757)
* Don't skip file tests

* Remove test with invalid flag for H5Fopen

* Verify that create/open of unseekable file fails

* Remove failure verification
2024-08-26 13:29:13 -05:00
bmribler
d0fe57624f
Replace non-VOL calls with VOL calls - part 3 (#4756)
This PR switches H5I_object_verify() to H5VL_vol_object_verify() in the H5G API
and removes unnecessary casts.
2024-08-26 09:04:18 -07:00
Quincey Koziol
c38064b7f7
Another try at correcting the ping pong semaphore test (#4754)
* Add ifdef around prototype

* Add casts to make MSVC happy

* Fix missing atomic load
2024-08-24 21:39:56 -05:00
Dana Robinson
5c5b727127
Restore rand_r in a few parallel tests (#4749)
The t_pmulti_dset and t_select_io_dset tests rely on the behavior
of the previous private rand_r-like implementation to get the
correct sequence of random numbers to pass. This has been restored
using a fully private rand_r-like implementation that doesn't
rely on rand_r and will work on Windows and other platforms
where rand_r doesn't exist.
2024-08-23 17:22:40 -05:00
bmribler
9adacb54a6
Replace non-VOL calls with VOL calls - part 2 (#4748)
This PR switches H5I_object_verify() to H5VL_vol_object_verify() in the H5F API
and fixes documentation of H5Fmount and H5Funmount.

* More on H5F API
2024-08-23 11:44:48 -05:00
bmribler
379a5baa0f
Fix inconsistent documentation of get_name functions (#4715)
- Verified that the listed functions do not include null terminator in the returned length
- Improved some of the tests
- Corrected documentation

Fixes GH-4704

* Casted a positive int to size_t
2024-08-23 11:17:35 -05:00
bmribler
aea4c53654
Fix incorrect VOL vs. non-VOL calls partially (#4733)
* Fix incorrect VOL vs. non-VOL calls

H5Lget_info2() called H5I_object() instead of H5VL_vol_object() crashed
user application.
This is a wide-spread issue (GH-4730) but this PR only addresses GH-4705.

* Remove an incorrect change
2024-08-20 19:36:40 -05:00
Quincey Koziol
adc3a37e96
Fix semaphore test (#4725)
* Make counter in semaphore test an atomic variable

* Revert using atomic counter and fix counter access outside of semaphore
2024-08-19 08:53:10 -05:00
bmribler
b4731e4a85
Cleanup up tests (#4724) 2024-08-19 08:02:13 -05:00
mattjala
d25cc7d41b
Test creating unseekable file (#4720) 2024-08-19 07:35:40 -05:00
bmribler
d875f749e5
Add tests for H5R get name APIs (#4657)
Added functionality tests for the following APIs:
H5Rget_file_name
H5Rget_obj_name
H5Rget_attr_name

Also removed "+1" when returning a name length in H5R__get_attr_name().
The exter "+1" gave an incorrect value for the length of the referenced
object's attribute name.

Fixed GH-4447

* Fix Fortran test

The C API H5Rget_attr_name incorrectly added 1 to the length of the
referenced object's attribute name, so the Fortran API h5rget_attr_name_f
removed 1 from the returned value to accommodate the incorrectness.
This PR fixes H5Rget_attr_name so this workaround in h5rget_attr_name_f
is no longer needed.

* Add test H5Aget_name against H5Rget_attr_name
2024-08-12 09:40:48 -05:00
Allen Byrne
695c0f2907
Use local variable in btree2 and print value (#4679)
* Correct logic

* Technically, level 1 Express could skip tests
2024-08-08 21:57:22 -05:00
bmribler
5c39fddb92
Add check of returned value from API calls. (#4702)
These were found while investigating GH-4672, but they were not related
to GH-4672.
2024-08-08 07:38:25 -05:00
Quincey Koziol
eede36f0cd
Remove another H5E_BEGIN/END_TRY within the library (#4675)
* Update logic for (deprecated) H5Gget_objinfo() call to eliminate H5E_BEGIN_TRY

* Handle case for '.' at the end of a path
2024-08-06 06:21:07 -05:00
Allen Byrne
f77b70859f
Rework Dynamic Analysis and sanitize testing (#4681)
* Ignore predetermined failing test and check pointer before use

* Rework Analysis process
2024-08-05 09:53:53 -05:00
Quincey Koziol
6061296fc7
Remove racey condition for starting threads (#4693)
Signed-off-by: Quincey Koziol <quincey@koziol.cc>
2024-08-05 07:36:47 -05:00
Allen Byrne
1be198decf
Correct the properties for using THREADS library (#4690) 2024-08-02 10:57:20 -05:00
Allen Byrne
0f620e91be
CMake link line needs to use new HDF5_ENABLE_THREADS (#4685) 2024-08-01 22:29:44 -05:00
Quincey Koziol
9fd88560d5
Refactor threading and other concurrency support (#4469)
Complete overhaul of the concurrency-related aspects of the library (threading, atomics, locking, etc.), adding private routines in the H5TS package to allow internal algorithms to use all of these capabilities.

Adds many new features & components in the H5TS package that are equivalent to common concurrency data structures and capabilities: "regular" and recursive mutices, condition variables, semaphores, thread barriers, 'once' support, thread pools, atomic variables, thread-local keys, and spawning & joining internal threads.

Now supports C11, pthreads, and Windows threading for all H5TS capabilities, except the recursive readers/writers lock, which is not supported on Windows (because Windows threads don't provide a callback on thread-local variable deletion).

The "global" API lock is switched to use a recursive mutex from the H5TS package, instead of its own variant.

API context code (H5CX package) and error stacks (H5E package) now use the common thread-local info, instead of their own variants.

Subfiling code is switched from using Mercury threading features to the new internal H5TS features.

Removes the mercury threading code.

Adds a configure option (--enable-threads / HDF5_ENABLE_THREADS), enabled by default, to control whether threading is enabled within the library.
2024-07-31 12:34:43 -05:00
Larry Knox
f54abf7032
Remove outdated line from Copyright header in new files. (#4676) 2024-07-29 12:57:36 -05:00
bmribler
9fd4fd0b58
Replace incorrect use of an internal function (#4668)
* Replace incorrect use of an internal function

In some API functions, the internal function H5I_object() was used instead
of H5I_object_verify(), which verifies the type of an ID argument.  So
when an inappropriate ID was passed in to the affected API, it was accepted.
This behavior can cause issues at a later time, including a segfault, as
reported in issue #GH-4656.

The fix was applied to the following functions:
H5Fget_intent()
H5Fget_fileno()
H5Fget_freespace()
H5Fget_create_plist()
H5Fget_access_plist()
H5Fget_vfd_handle()
H5Dvlen_get_buf_size()
H5Fget_mdc_config()
H5Fset_mdc_config()
H5Freset_mdc_hit_rate_stats()

Fixes GH-4662
2024-07-24 10:42:58 -05:00
Scot Breitenfeld
8d50786f7a
Reworked cleaning up API test files (#4626)
* Reworked cleaning up test files, only removing test files if present to account for skipped tests

* changed to using H5Fis_accessible

* update to full use of remove_test_file
2024-07-05 12:38:26 -07:00