Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ts_h5i' into ts_h5i_2
Browse files Browse the repository at this point in the history
  • Loading branch information
qkoziol committed Dec 24, 2024
2 parents 64bd28c + 011e1ff commit 657eed2
Show file tree
Hide file tree
Showing 8 changed files with 745 additions and 4 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/h5py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Spack
uses: actions/checkout@v4.1.7
uses: actions/checkout@v4.2.2
with:
repository: spack/spack
path: ./spack
Expand All @@ -27,10 +27,8 @@ jobs:
./spack/bin/spack spec py-h5py@master+mpi ^[email protected]
./spack/bin/spack install py-h5py@master+mpi ^[email protected]
./spack/bin/spack install py-pytest
./spack/bin/spack install py-ipython
./spack/bin/spack install py-pytest-mpi
spack load py-h5py
spack load py-pytest
spack load py-ipython
spack load py-pytest-mpi
python -c "import h5py; h5py.run_tests(); print(h5py.version.info);"
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ set (ttsafe_SOURCES
${HDF5_TEST_SOURCE_DIR}/ttsafe_thread_id.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_thread_pool.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_error_stacks.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_h5fl.c
)

set (H5_EXPRESS_TESTS
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ LDADD=libh5test.la $(LIBHDF5)
ttsafe_SOURCES=ttsafe.c ttsafe_acreate.c ttsafe_atomic.c ttsafe_attr_vlen.c \
ttsafe_cancel.c ttsafe_dcreate.c ttsafe_develop.c ttsafe_error.c \
ttsafe_rwlock.c ttsafe_rec_rwlock.c ttsafe_semaphore.c \
ttsafe_thread_id.c ttsafe_thread_pool.c ttsafe_error_stacks.c
ttsafe_thread_id.c ttsafe_thread_pool.c ttsafe_error_stacks.c \
ttsafe_h5fl.c
cache_image_SOURCES=cache_image.c genall5.c
mirror_vfd_SOURCES=mirror_vfd.c genall5.c

Expand Down
38 changes: 38 additions & 0 deletions test/h5test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2242,3 +2242,41 @@ h5_local_srand(unsigned int seed)
{
next_g = seed;
}

/*****************************************************************************
*
* Function h5_setup_local_rand()
*
* Purpose: Either use gettimeofday() to obtain a seed or a predefined seed
* for h5_local_rand(), print the seed to stdout, and then pass it
* to h5_local_srand().
*
* Return: void.
*
*****************************************************************************/
void
h5_setup_local_rand(const char *test_name, unsigned predefined_seed)
{
unsigned seed;

if (0 != predefined_seed)
seed = predefined_seed;
else {
struct timeval tv;

if (HDgettimeofday(&tv, NULL) != 0) {
fprintf(stdout, "\n%s: gettimeofday() failed -- srand() not called.\n\n", test_name);
fflush(stdout);

return;
}

seed = (unsigned)tv.tv_usec;
}

fprintf(stdout, "%s: seed = %d\n", test_name, seed);
fflush(stdout);

h5_local_srand(seed);

} /* h5_setup_local_rand() */
17 changes: 17 additions & 0 deletions test/h5test.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,23 @@ H5TEST_DLL int h5_local_rand(void);
*/
H5TEST_DLL void h5_local_srand(unsigned int seed);

/**
* --------------------------------------------------------------------------
* \ingroup H5TEST
*
* \brief Set up h5_local_rand() with a unique or predefined seed.
*
* \return none
*
* \details Either use gettimeofday() to obtain a seed or a predefined seed
* for h5_local_rand(), print the seed to stdout, and then pass it
* to h5_local_srand().
*
* \see h5_local_srand()
*
*/
H5TEST_DLL void h5_setup_local_rand(const char *test_name, unsigned predefined_seed);

#ifdef H5_HAVE_FILTER_SZIP
/**
* --------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions test/ttsafe.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ main(int argc, char *argv[])

#endif /* H5_HAVE_THREADSAFE_API */

#ifdef H5_HAVE_CONCURRENCY
/* Test library packages' threadsafety */
AddTest("h5fl", tts_h5fl, NULL, NULL, NULL, 0, "Multithreaded H5FL package");
#else /* H5_HAVE_CONCURRENCY */
/* Test library packages' threadsafety */
AddTest("-h5fl", tts_h5fl, NULL, NULL, NULL, 0, "Multithreaded H5FL package");
#endif /* H5_HAVE_CONCURRENCY */

#else /* H5_HAVE_THREADS */

printf("Most threading tests skipped because THREADS not enabled\n");
Expand Down
3 changes: 3 additions & 0 deletions test/ttsafe.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ void cleanup_acreate(void *);
void cleanup_attr_vlen(void *);

#endif /* H5_HAVE_THREADSAFE_API */

/* Threadsafe package testing routines */
void tts_h5fl(const void *);
#endif /* H5_HAVE_THREADS */
#endif /* TTSAFE_H */
Loading

0 comments on commit 657eed2

Please sign in to comment.