From 9ca362c3cfe99d65ef9a1a779d0f353421b535d1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 15:17:30 -0600 Subject: [PATCH 01/25] Convert SWMR shell scripts to Windows powershell. --- MANIFEST | 1 + release_docs/RELEASE.txt | 10 + test/CMakeTests.cmake | 9 + test/ShellTests.cmake | 36 ++- test/testswmr.pwsh.in | 538 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 590 insertions(+), 4 deletions(-) create mode 100644 test/testswmr.pwsh.in diff --git a/MANIFEST b/MANIFEST index 0030b6e9a9c..45a75de5078 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1341,6 +1341,7 @@ ./test/testlinks_env.sh.in ./test/testmeta.c ./test/test_mirror.sh.in +./test/testswmr.pwsh.in ./test/testswmr.sh.in ./test/testvds_env.sh.in ./test/testvdsswmr.sh.in diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index fbdbf3f53b6..cdd809f859e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,16 @@ New Features Configuration: ------------- + - CMake will now run the power shell script tests in test/ by default + on Windows. + + The test directory includes several shell script tests that previously + were not run by CMake on Windows. These are now run by default. + If TEST_SHELL_SCRIPTS is ON and PWSH is found, the Powershell scripts + will execute. Similar to the bash scripts on unix platforms. + + (ADB - 2021/11/23) + - Added new configure options to enable dimension scales APIs (H5DS*) to use new object references with the native VOL connector (aka native HDF5 library). New references are always used for non-native terminal VOL diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index b2ed8e866dd..f696167e6c0 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -879,6 +879,15 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* +# find_program(PWSH NAMES pwsh powershell) +# if(PWSH) +# add_test(NAME testswmr +# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") +# elseif(UNIX) +# add_test(NAME testswmr +# COMMAND sh -c "$ < ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt") +# endif() + #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") if (H5_PERL_FOUND) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 732091bfa0e..aedbb59c11b 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -15,8 +15,38 @@ ### T E S T I N G S H E L L S C R I P T S ### ############################################################################## -if (UNIX) - +find_program (PWSH NAMES pwsh powershell) +if (PWSH) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") +# add_test (NAME testswmr +# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") +# add_test (H5SHELL-testflushrefresh ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) +# set_tests_properties (H5SHELL-testflushrefresh PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) +# add_test (H5SHELL-test_usecases ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) +# set_tests_properties (H5SHELL-test_usecases PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) + set (srcdir ${HDF5_TEST_SOURCE_DIR}) + set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) + configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY) + add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) + set_tests_properties (H5SHELL-testswmr PROPERTIES + ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +# add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) +# set_tests_properties (H5SHELL-testvdsswmr PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) +elseif (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) set (srcdir ${HDF5_TEST_SOURCE_DIR}) @@ -35,8 +65,6 @@ if (UNIX) ############################################################################## # copy test programs to test dir ############################################################################## - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") add_custom_command ( TARGET accum_swmr_reader POST_BUILD diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in new file mode 100644 index 00000000000..4383e916f9b --- /dev/null +++ b/test/testswmr.pwsh.in @@ -0,0 +1,538 @@ +#! /bin/bash +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# Tests for the swmr feature. + +$srcdir = '@srcdir@' +$bindir = '@bindir@' +$testdir = '@testdir@' + +############################################################################### +## test parameters +############################################################################### + +$Nreaders = 5 # number of readers to launch +$Nrdrs_spa = 3 # number of sparse readers to launch +$Nrecords = 200000 # number of records to write +$Nrecs_rem = 40000 # number of times to shrink +$Nrecs_spa = 20000 # number of records to write in the sparse test +$Nsecs_add = 5 # number of seconds per read interval +$Nsecs_rem = 3 # number of seconds per read interval +$Nsecs_addrem = 8 # number of seconds per read interval +$nerrors = 0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete + # This should be the same as the define in "./swmr_common.h" +$MESSAGE_TIMEOUT = 300 # Message timeout length in secs + # This should be the same as the define in "./h5test.h" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +function Test-WithSpaces { + $SPACES=' ' + #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $Message is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +function Wait-Message { + [CmdletBinding()] + param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$Message # Get the name of the message file to wait for + ) + + PROCESS { + $message = Join-Path -Path $testdir -ChildPath $Message + $t0 = Get-Date # Get current time + $t1 = $t0 + $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference + $mexist = 0 # Indicate whether the message file is found + while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out + $t1 = Get-Date # Get current time in seconds + $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference + #Write-Output "Check for $message : time=$difft" + if ([System.IO.File]::Exists($message)) { # If message file is found: + $mexist = 1 # indicate the message file is found + Remove-Item $message # remove the message file + break # get out of the while loop + } + } + if ($mexist -eq 0) { + # Issue warning that the writer message file is not found, continue with launching the reader(s) + Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds" + } + else { + Write-Output "$WRITER_MESSAGE is found" + } + } +} + +############################################################################### +## Main +## +## Modifications: +## Vailin Choi; July 2013 +## Add waiting of message file before launching the reader(s). +## Due to the implementation of file locking, coordination +## is needed in file opening for the writer/reader tests +## to proceed as expected. +## +############################################################################### +# The build (current) directory might be different than the source directory. +if (![System.IO.Directory]::Exists($srcdir)) { + $srcdir = Get-Location + Write-Output "Setting srcdir to default: $srcdir" +} + +# If the bindir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($bindir)) { + $bindir = Get-Location + Write-Output "Setting bindir to default: $bindir" +} + +# If the testdir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($testdir)) { + $testdir = Get-Location + Write-Output "Setting testdir to default: $testdir" +} + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe +$rp = Start-Process -FilePath $testprog -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Output "" + Write-Output "The VFD specified by the HDF5_DRIVER environment variable" + Write-Output "does not support SWMR." + Write-Output "" + Write-Output "SWMR acceptance tests skipped" + Write-Output "" + exit 0 +} + +Set-Location -Path swmr_test +$testdir = Join-Path -Path $testdir -ChildPath swmr_test + +# Loop over index types +$IndexTypeLoop = '-i ea', '-i b2' +foreach ($index_type in $IndexTypeLoop) { + # Try with and without compression + $CompressLoop = '', '-c 5' + foreach ($compress in $CompressLoop) { + Write-Output "" + Write-Output "*******************************************************************************" + Write-Output "** Loop testing parameters: $index_type $compress" + Write-Output "*******************************************************************************" + Write-Output "" + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Generator test" + Write-Output "###############################################################################" + # Launch the Generator without SWMR_WRITE + Write-Output "launch the swmr_generator" + $rp = Start-Process -FilePath $bindir\swmr_generator.exe -ArgumentList "$compress $index_type" -PassThru -Wait + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Launch the Generator with SWMR_WRITE + Write-Output "launch the swmr_generator with SWMR_WRITE" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -ArgumentList "-s $compress $index_type" -PassThru -Wait + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + exit 1 + } + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Use H5Fstart_swmr_write() to enable SWMR writing mode" + Write-Output "###############################################################################" + + # Remove any possible writer message file before launching writer + if ([System.IO.File]::Exists($WRITER_MESSAGE)) { # If message file is found + Remove-Item $WRITER_MESSAGE + } + # + # Launch the Writer + Write-Output "launch the swmr_start_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + + # + # Launch the Readers + #declare -a seeds = ( ... ) + Write-Output "launch $Nreaders swmr_readers" + $pid_readers = @() + $n = 0 + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp=Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + #$IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Writer test - test expanding the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + Write-Output "launch the swmr_generator" + $rp=Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "-s $compress $index_type" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # + # Launch the Writer + Write-Output "launch the swmr_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Readers + #declare -a seeds = ( ... ) + Write-Output "launch $Nreaders swmr_readers" + $pid_readers = @() + $n = 0 + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Remove test - test shrinking the dataset" + Write-Output "###############################################################################" + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # Launch the Remove Writer + Write-Output "launch the swmr_remove_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Remove Readers + #declare -a seeds = ( ... ) + $n = 0 + $pid_readers = @() + Write-Output "launch $Nreaders swmr_remove_readers" + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Add/remove test - randomly grow or shrink the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + Write-Output "launch the swmr_generator" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Launch the Writer (not in parallel - just to rebuild the datasets) + Write-Output "launch the swmr_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -Wait -ArgumentList "$Nrecords $seed" + if ($rp.ExitCode -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # + # Launch the Add/Remove Writer + Write-Output "launch the swmr_addrem_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Add/Remove Readers + #declare -a seeds = ( ... ) + $n = 0 + $pid_readers = @() + Write-Output "launch $Nreaders swmr_remove_readers" + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Sparse writer test - test writing to random locations in the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + # NOTE: Random seed is shared between readers and writers and is + # created by the generator. + Write-Output "launch the swmr_generator" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type $seed" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # Launch the Sparse writer + Write-Output "launch the swmr_sparse_writer" + $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.Id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Sparse readers + $n = 0 + $pid_readers = @() + Write-Output "launch $Nrdrs_spa swmr_sparse_readers" + while ($n -lt $Nrdrs_spa) { + # The sparse reader spits out a LOT of data so it's set to 'quiet' + $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Collect exit code of the readers + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + } +} + +############################################################################### +## Report and exit +############################################################################### +cd .. +#Write-Output "nerrors=$nerrors" +if ($nerrors -eq 0) { + Write-Output "SWMR tests passed." +# if test -z "$HDF5_NOCLEANUP"; then +# # delete the test directory +# Remove-Item swmr_test -Recurse +# fi + exit 0 +} +else { + Write-Warning "SWMR tests failed with $nerrors errors." + exit 1 +} + From 17107b72258e4a9e68ddc657c4903ece73738dc3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 15:47:44 -0600 Subject: [PATCH 02/25] Use $LastExitCode instead of $? in script --- test/testswmr.pwsh.in | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 4383e916f9b..0c2635f149e 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -208,7 +208,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -217,7 +217,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -279,7 +279,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -288,7 +288,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -341,7 +341,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -350,7 +350,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -421,7 +421,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -430,7 +430,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -489,7 +489,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -498,7 +498,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } From 5a48427f468a8e1a433166f985fbb58def756d0d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 16:48:41 -0600 Subject: [PATCH 03/25] Prevent execution in a different window --- test/testswmr.pwsh.in | 72 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 0c2635f149e..27efa448ca6 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -146,7 +146,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "###############################################################################" # Launch the Generator without SWMR_WRITE Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir\swmr_generator.exe -ArgumentList "$compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir\swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -154,7 +154,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator with SWMR_WRITE Write-Output "launch the swmr_generator with SWMR_WRITE" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -ArgumentList "-s $compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -ArgumentList "-s $compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -180,7 +180,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer Write-Output "launch the swmr_start_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -NoNewWindow -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -196,7 +196,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp=Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -207,8 +207,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -216,8 +216,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -241,7 +241,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp=Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "-s $compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "-s $compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -253,7 +253,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer Write-Output "launch the swmr_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -268,7 +268,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -278,8 +278,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -287,8 +287,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -315,7 +315,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Remove Writer Write-Output "launch the swmr_remove_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -330,7 +330,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -340,8 +340,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -349,8 +349,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -374,7 +374,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -383,7 +383,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer (not in parallel - just to rebuild the datasets) Write-Output "launch the swmr_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -Wait -ArgumentList "$Nrecords $seed" + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -NoNewWindow -PassThru -Wait -ArgumentList "$Nrecords $seed" if ($rp.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 @@ -395,7 +395,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Add/Remove Writer Write-Output "launch the swmr_addrem_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -410,7 +410,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -420,8 +420,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -429,8 +429,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -457,7 +457,7 @@ foreach ($index_type in $IndexTypeLoop) { # created by the generator. Write-Output "launch the swmr_generator" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type $seed" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "$compress $index_type $seed" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -467,7 +467,7 @@ foreach ($index_type in $IndexTypeLoop) { Remove-Item $WRITER_MESSAGE # Launch the Sparse writer Write-Output "launch the swmr_sparse_writer" - $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out $pid_writer = $rp.Id #Write-Output "pid_writer=$pid_writer" @@ -480,7 +480,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "launch $Nrdrs_spa swmr_sparse_readers" while ($n -lt $Nrdrs_spa) { # The sparse reader spits out a LOT of data so it's set to 'quiet' - $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -NoNewWindow -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -488,8 +488,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -497,8 +497,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the readers foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } From 87940e8c873a8736921603119dc4bf8db30edbbd Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 17 Nov 2021 23:53:00 -0600 Subject: [PATCH 04/25] Github #969 Use stdout instead of file for configure check (#1089) * Use stdout instead of file for configure check * Make change requested by #1157 * Change fortran to use stderr for configure * Correct typo * remove obsolete file check * Fortran statement fix --- config/cmake/ConfigureChecks.cmake | 9 +- config/cmake/HDF5UseFortran.cmake | 71 +++++--------- m4/aclocal_fc.f90 | 21 ++-- m4/aclocal_fc.m4 | 150 +++++++++++------------------ 4 files changed, 93 insertions(+), 158 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 7b9d6036685..483e551ddd8 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -232,7 +232,7 @@ endif () # so this one is used. #----------------------------------------------------------------------------- set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR}) -macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) +macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Detecting C ${FUNCTION_NAME}") endif () @@ -248,7 +248,7 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) RUN_OUTPUT_VARIABLE OUTPUT_VAR ) - set (${RETURN_VAR} ${OUTPUT_VAR}) + set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR}) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") @@ -304,12 +304,11 @@ set (PROG_SRC #define C_LDBL_DIG DECIMAL_DIG\n\ #else\n\ #define C_LDBL_DIG LDBL_DIG\n\ -#endif\n\nint main() {\nFILE *pFile = fopen(\"pac_Cconftest.out\",\"w\")\\\;\nfprintf(pFile, \"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n +#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n " ) -C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES) -file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4) +C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4) message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}") # dnl The output from the above program will be: diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index e192ec4dd65..40027ea8059 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -32,15 +32,10 @@ macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR) endmacro () set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR}) -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - if (HDF5_REQUIRED_LIBRARIES) - set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}") - endif () -else () # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- -macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR) +macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR RETURN_OUTPUT_VAR) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Detecting Fortran ${FUNCTION_NAME}") endif () @@ -52,7 +47,9 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" + RUN_OUTPUT_VARIABLE OUTPUT_VAR ) + set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR}) if (${COMPILE_RESULT_VAR}) set(${RETURN_VAR} ${RUN_RESULT_VAR}) @@ -81,7 +78,6 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 set(${RETURN_VAR} ${COMPILE_RESULT_VAR}) endif () endmacro () -endif () #----------------------------------------------------------------------------- # Check to see C_LONG_DOUBLE is available @@ -130,25 +126,20 @@ endif () #----------------------------------------------------------------------------- READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE) -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_fortran_source_runs (${SOURCE_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90) -else () FORTRAN_RUN ("REAL and INTEGER KINDs" "${SOURCE_CODE}" XX YY FC_AVAIL_KINDS_RESULT + PROG_OUTPUT ) -endif () - # dnl The output from the above program will be: # dnl -- LINE 1 -- valid integer kinds (comma seperated list) # dnl -- LINE 2 -- valid real kinds (comma seperated list) # dnl -- LINE 3 -- max decimal precision for reals # dnl -- LINE 4 -- number of valid integer kinds # dnl -- LINE 5 -- number of valid real kinds - -file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_fconftest.out" PROG_OUTPUT) +# # Convert the string to a list of strings by replacing the carriage return with a semicolon string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") @@ -196,20 +187,14 @@ foreach (KIND ${VAR}) " PROGRAM main USE ISO_C_BINDING + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE INTEGER (KIND=${KIND}) a - OPEN(8,FILE='pac_validIntKinds.${KIND}.out',FORM='formatted') - WRITE(8,'(I0)') ${FC_SIZEOF_A} - CLOSE(8) + WRITE(stderr,'(I0)') ${FC_SIZEOF_A} END " ) - if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_fortran_source_runs (${PROG_SRC_${KIND}} VALIDINTKINDS_RESULT_${KIND} SRC_EXT f90) - else () - FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND}) - endif () - file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.${KIND}.out" PROG_OUTPUT1) + FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND} PROG_OUTPUT1) string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -245,22 +230,16 @@ foreach (KIND ${VAR} ) " PROGRAM main USE ISO_C_BINDING + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE REAL (KIND=${KIND}) a - OPEN(8,FILE='pac_validRealKinds.${KIND}.out',FORM='formatted') - WRITE(8,'(I0)') ${FC_SIZEOF_A} - CLOSE(8) + WRITE(stderr,'(I0)') ${FC_SIZEOF_A} END " ) - if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_fortran_source_runs (${PROG_SRC2_${KIND}} VALIDREALKINDS_RESULT_${KIND} SRC_EXT f90) - else () - FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND}) - endif () - file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.${KIND}.out" PROG_OUTPUT1) - string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") - set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") + FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND} PROG_OUTPUT2) + string (REGEX REPLACE "\n" "" PROG_OUTPUT2 "${PROG_OUTPUT2}") + set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT2},") endforeach () if (pack_real_sizeof STREQUAL "") @@ -293,27 +272,21 @@ set (PROG_SRC3 " PROGRAM main USE ISO_C_BINDING + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE INTEGER a REAL b DOUBLE PRECISION c - OPEN(8,FILE='pac_sizeof_native_kinds.out',FORM='formatted') - WRITE(8,*) ${FC_SIZEOF_A} - WRITE(8,*) kind(a) - WRITE(8,*) ${FC_SIZEOF_B} - WRITE(8,*) kind(b) - WRITE(8,*) ${FC_SIZEOF_C} - WRITE(8,*) kind(c) - CLOSE(8) + WRITE(stderr,*) ${FC_SIZEOF_A} + WRITE(stderr,*) kind(a) + WRITE(stderr,*) ${FC_SIZEOF_B} + WRITE(stderr,*) kind(b) + WRITE(stderr,*) ${FC_SIZEOF_C} + WRITE(stderr,*) kind(c) END " ) -if (NOT CMAKE_VERSION VERSION_LESS "3.14.0") - check_fortran_source_runs (${PROG_SRC3} PAC_SIZEOF_NATIVE_KINDS_RESULT SRC_EXT f90) -else () - FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT) -endif () -file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3) +FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT PROG_OUTPUT3) # dnl The output from the above program will be: # dnl -- LINE 1 -- sizeof INTEGER # dnl -- LINE 2 -- kind of INTEGER @@ -321,7 +294,7 @@ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3 # dnl -- LINE 4 -- kind of REAL # dnl -- LINE 5 -- sizeof DOUBLE PRECISION # dnl -- LINE 6 -- kind of DOUBLE PRECISION - +# # Convert the string to a list of strings by replacing the carriage return with a semicolon string (REGEX REPLACE "\n" ";" PROG_OUTPUT3 "${PROG_OUTPUT3}") diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index e9a11c0ab5f..240a768b7eb 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -82,6 +82,7 @@ END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE !---- START ----- Determine the available KINDs for REALs and INTEGERs PROGRAM FC_AVAIL_KINDS + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE INTEGER :: ik, jk, k, kk, max_decimal_prec INTEGER :: prev_rkind, num_rkinds = 1, num_ikinds = 1 @@ -89,8 +90,6 @@ PROGRAM FC_AVAIL_KINDS INTEGER, DIMENSION(1:10) :: list_rkinds = -1 LOGICAL :: new_kind - OPEN(8, FILE='pac_fconftest.out', FORM='formatted') - ! Find integer KINDs list_ikinds(num_ikinds)=SELECTED_INT_KIND(1) DO ik = 2, 36 @@ -103,11 +102,11 @@ PROGRAM FC_AVAIL_KINDS ENDDO DO k = 1, num_ikinds - WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k) + WRITE(stderr,'(I0)', ADVANCE='NO') list_ikinds(k) IF(k.NE.num_ikinds)THEN - WRITE(8,'(A)',ADVANCE='NO') ',' + WRITE(stderr,'(A)',ADVANCE='NO') ',' ELSE - WRITE(8,'()') + WRITE(stderr,'()') ENDIF ENDDO @@ -140,17 +139,17 @@ PROGRAM FC_AVAIL_KINDS ENDDO prec DO k = 1, num_rkinds - WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k) + WRITE(stderr,'(I0)', ADVANCE='NO') list_rkinds(k) IF(k.NE.num_rkinds)THEN - WRITE(8,'(A)',ADVANCE='NO') ',' + WRITE(stderr,'(A)',ADVANCE='NO') ',' ELSE - WRITE(8,'()') + WRITE(stderr,'()') ENDIF ENDDO - WRITE(8,'(I0)') max_decimal_prec - WRITE(8,'(I0)') num_ikinds - WRITE(8,'(I0)') num_rkinds + WRITE(stderr,'(I0)') max_decimal_prec + WRITE(stderr,'(I0)') num_ikinds + WRITE(stderr,'(I0)') num_rkinds END PROGRAM FC_AVAIL_KINDS !---- END ----- Determine the available KINDs for REALs and INTEGERs diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index e5d664daf40..49ff48586b7 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -68,7 +68,7 @@ AC_DEFUN([PAC_PROG_FC_ISO_FORTRAN_ENV],[ AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV]) TEST_SRC="`sed -n '/PROGRAM PROG_FC_ISO_FORTRAN_ENV/,/END PROGRAM PROG_FC_ISO_FORTRAN_ENV/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes]) - HAVE_ISO_FORTRAN_ENV="yes"], + HAVE_ISO_FORTRAN_ENV="yes"], [AC_MSG_RESULT([no])]) ]) @@ -79,7 +79,7 @@ AC_DEFUN([PAC_PROG_FC_SIZEOF],[ AC_MSG_CHECKING([if Fortran compiler supports intrinsic SIZEOF]) TEST_SRC="`sed -n '/PROGRAM PROG_FC_SIZEOF/,/END PROGRAM PROG_FC_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes]) - HAVE_SIZEOF_FORTRAN="yes"], + HAVE_SIZEOF_FORTRAN="yes"], [AC_MSG_RESULT([no])]) ]) @@ -90,7 +90,7 @@ AC_DEFUN([PAC_PROG_FC_C_SIZEOF],[ AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_SIZEOF]) TEST_SRC="`sed -n '/PROGRAM PROG_FC_C_SIZEOF/,/END PROGRAM PROG_FC_C_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes]) - HAVE_C_SIZEOF_FORTRAN="yes"], + HAVE_C_SIZEOF_FORTRAN="yes"], [AC_MSG_RESULT([no])]) ]) @@ -101,7 +101,7 @@ AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[ AC_MSG_CHECKING([if Fortran compiler supports intrinsic STORAGE_SIZE]) TEST_SRC="`sed -ne '/PROGRAM PROG_FC_STORAGE_SIZE/,/END PROGRAM PROG_FC_STORAGE_SIZE/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes]) - HAVE_STORAGE_SIZE_FORTRAN="yes"], + HAVE_STORAGE_SIZE_FORTRAN="yes"], [AC_MSG_RESULT([no])]) ]) @@ -114,7 +114,7 @@ AC_DEFUN([PAC_PROG_FC_HAVE_C_LONG_DOUBLE],[ TEST_SRC="" TEST_SRC="`sed -n '/PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/,/END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes]) - HAVE_C_LONG_DOUBLE_FORTRAN="yes"], + HAVE_C_LONG_DOUBLE_FORTRAN="yes"], [AC_MSG_RESULT([no])]) ]) @@ -146,8 +146,8 @@ AC_DEFUN([PAC_PROG_FC_HAVE_F2003_REQUIREMENTS],[ dnl ------------------------------------------------------------------------- dnl AC_F9X_MODS() dnl -dnl Check how F9X handles modules. This macro also checks which -dnl command-line option to use to include the module once it's built. +dnl Check how F9X handles modules. This macro also checks which +dnl command-line option to use to include the module once it's built. dnl AC_DEFUN([AC_F9X_MODS], [AC_MSG_CHECKING(what $FC does with modules) @@ -223,7 +223,6 @@ else fi AC_SUBST(F9XMODFLAG) AC_SUBST(F9XMODEXT) -rm -rf conftest* AC_LANG_POP(Fortran) ]) @@ -241,9 +240,9 @@ dnl Change to the Fortran 90 language dnl Try link a simple MPI program. AC_MSG_CHECKING([whether a simple MPI-IO Fortran program can be linked]) AC_LINK_IFELSE([$TEST_SRC], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([unable to link a simple MPI-IO Fortran program])]) + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([unable to link a simple MPI-IO Fortran program])]) dnl Change to the C language AC_LANG_POP(Fortran) @@ -257,51 +256,43 @@ dnl This is a runtime test. dnl AC_DEFUN([PAC_FC_AVAIL_KINDS],[ AC_LANG_PUSH([Fortran]) -rm -f pac_fconftest.out TEST_SRC="`sed -n '/PROGRAM FC_AVAIL_KINDS/,/END PROGRAM FC_AVAIL_KINDS/p' $srcdir/m4/aclocal_fc.f90`" AC_RUN_IFELSE([$TEST_SRC], [ - if test -s pac_fconftest.out ; then - - dnl The output from the above program will be: - dnl -- LINE 1 -- valid integer kinds (comma seperated list) - dnl -- LINE 2 -- valid real kinds (comma seperated list) - dnl -- LINE 3 -- max decimal precision for reals - dnl -- LINE 4 -- number of valid integer kinds - dnl -- LINE 5 -- number of valid real kinds - - pac_validIntKinds="`sed -n '1p' pac_fconftest.out`" - pac_validRealKinds="`sed -n '2p' pac_fconftest.out`" - PAC_FC_MAX_REAL_PRECISION="`sed -n '3p' pac_fconftest.out`" + dnl The output from the above program will be: + dnl -- LINE 1 -- valid integer kinds (comma seperated list) + dnl -- LINE 2 -- valid real kinds (comma seperated list) + dnl -- LINE 3 -- max decimal precision for reals + dnl -- LINE 4 -- number of valid integer kinds + dnl -- LINE 5 -- number of valid real kinds + + pac_validIntKinds=$(./conftest$EXEEXT 2>&1 | sed -n '1p') + pac_validRealKinds=$(./conftest$EXEEXT 2>&1 | sed -n '2p') + PAC_FC_MAX_REAL_PRECISION=$(./conftest$EXEEXT 2>&1 | sed -n '3p') AC_DEFINE_UNQUOTED([PAC_FC_MAX_REAL_PRECISION], $PAC_FC_MAX_REAL_PRECISION, [Define Fortran Maximum Real Decimal Precision]) PAC_FC_ALL_INTEGER_KINDS="{`echo $pac_validIntKinds`}" PAC_FC_ALL_REAL_KINDS="{`echo $pac_validRealKinds`}" - PAC_FORTRAN_NUM_INTEGER_KINDS="`sed -n '4p' pac_fconftest.out`" - H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $PAC_FORTRAN_NUM_INTEGER_KINDS`" - H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds`/)" - H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `sed -n '5p' pac_fconftest.out`" - H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $pac_validRealKinds`/)" + PAC_FORTRAN_NUM_INTEGER_KINDS=$(./conftest$EXEEXT 2>&1 | sed -n '4p') + H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $PAC_FORTRAN_NUM_INTEGER_KINDS`" + H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds`/)" + H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = $(./conftest$EXEEXT 2>&1 | sed -n '5p')" + H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $pac_validRealKinds`/)" - AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs]) - AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_IKIND], $H5CONFIG_F_NUM_IKIND, [Define number of valid Fortran INTEGER KINDs]) - AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs]) - AC_DEFINE_UNQUOTED([H5CONFIG_F_IKIND], $H5CONFIG_F_IKIND, [Define valid Fortran INTEGER KINDs]) + AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs]) + AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_IKIND], $H5CONFIG_F_NUM_IKIND, [Define number of valid Fortran INTEGER KINDs]) + AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs]) + AC_DEFINE_UNQUOTED([H5CONFIG_F_IKIND], $H5CONFIG_F_IKIND, [Define valid Fortran INTEGER KINDs]) AC_MSG_CHECKING([for Number of Fortran INTEGER KINDs]) AC_MSG_RESULT([$PAC_FORTRAN_NUM_INTEGER_KINDS]) AC_MSG_CHECKING([for Fortran INTEGER KINDs]) AC_MSG_RESULT([$PAC_FC_ALL_INTEGER_KINDS]) - AC_MSG_CHECKING([for Fortran REAL KINDs]) - AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS]) - AC_MSG_CHECKING([for Fortran REALs maximum decimal precision]) - AC_MSG_RESULT([$PAC_FC_MAX_REAL_PRECISION]) - else - AC_MSG_RESULT([Error]) - AC_MSG_ERROR([No output from Fortran test program!]) - fi - rm -f pac_fconftest.out + AC_MSG_CHECKING([for Fortran REAL KINDs]) + AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS]) + AC_MSG_CHECKING([for Fortran REALs maximum decimal precision]) + AC_MSG_RESULT([$PAC_FC_MAX_REAL_PRECISION]) ],[ AC_MSG_RESULT([Error]) AC_MSG_ERROR([Failed to run Fortran program to determine available KINDs]) @@ -314,29 +305,22 @@ AC_REQUIRE([PAC_FC_AVAIL_KINDS]) AC_MSG_CHECKING([sizeof of available INTEGER KINDs]) AC_LANG_PUSH([Fortran]) pack_int_sizeof="" -rm -f pac_fconftest.out for kind in `echo $pac_validIntKinds | sed -e 's/,/ /g'`; do AC_LANG_CONFTEST([ AC_LANG_SOURCE([ PROGRAM main USE ISO_C_BINDING + USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE INTEGER (KIND=$kind) a - OPEN(8, FILE='pac_fconftest.out', FORM='formatted') - WRITE(8,'(I0)') $FC_SIZEOF_A - CLOSE(8) + WRITE(stderr,'(I0)') $FC_SIZEOF_A END ]) ]) AC_RUN_IFELSE([],[ - if test -s pac_fconftest.out ; then - sizes="`cat pac_fconftest.out`" - pack_int_sizeof="$pack_int_sizeof $sizes," - else - AC_MSG_ERROR([No output from Fortran test program!]) - fi - rm -f pac_fconftest.out + sizes=$(./conftest$EXEEXT 2>&1) + pack_int_sizeof="$pack_int_sizeof $sizes," ],[ AC_MSG_ERROR([Fortran program fails to build or run!]) ],[ @@ -359,22 +343,16 @@ for kind in `echo $pac_validRealKinds | sed -e 's/,/ /g'`; do AC_LANG_SOURCE([ PROGRAM main USE ISO_C_BINDING + USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE REAL (KIND=$kind) :: a - OPEN(8, FILE='pac_fconftest.out', FORM='formatted') - WRITE(8,'(I0)') $FC_SIZEOF_A - CLOSE(8) + WRITE(stderr,'(I0)') $FC_SIZEOF_A END ]) ]) AC_RUN_IFELSE([],[ - if test -s pac_fconftest.out ; then - sizes="`cat pac_fconftest.out`" - pack_real_sizeof="$pack_real_sizeof $sizes," - else - AC_MSG_ERROR([No output from Fortran test program!]) - fi - rm -f pac_fconftest.out + sizes=$(./conftest$EXEEXT 2>&1) + pack_real_sizeof="$pack_real_sizeof $sizes," ],[ AC_MSG_ERROR([Fortran program fails to build or run!]) ],[ @@ -396,33 +374,27 @@ rm -f pac_fconftest.out AC_LANG_SOURCE([ PROGRAM main USE ISO_C_BINDING + USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT IMPLICIT NONE INTEGER a REAL b DOUBLE PRECISION c - OPEN(8, FILE='pac_fconftest.out', FORM='formatted') - WRITE(8,*) $FC_SIZEOF_A - WRITE(8,*) KIND(a) - WRITE(8,*) $FC_SIZEOF_B - WRITE(8,*) KIND(b) - WRITE(8,*) $FC_SIZEOF_C - WRITE(8,*) KIND(c) - CLOSE(8) + WRITE(stderr,*) $FC_SIZEOF_A + WRITE(stderr,*) KIND(a) + WRITE(stderr,*) $FC_SIZEOF_B + WRITE(stderr,*) KIND(b) + WRITE(stderr,*) $FC_SIZEOF_C + WRITE(stderr,*) KIND(c) END ]) ]) AC_RUN_IFELSE([],[ - if test -s pac_fconftest.out ; then - PAC_FORTRAN_NATIVE_INTEGER_SIZEOF="`sed -n '1p' pac_fconftest.out`" - PAC_FORTRAN_NATIVE_INTEGER_KIND="`sed -n '2p' pac_fconftest.out`" - PAC_FORTRAN_NATIVE_REAL_SIZEOF="`sed -n '3p' pac_fconftest.out`" - PAC_FORTRAN_NATIVE_REAL_KIND="`sed -n '4p' pac_fconftest.out`" - PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF="`sed -n '5p' pac_fconftest.out`" - PAC_FORTRAN_NATIVE_DOUBLE_KIND="`sed -n '6p' pac_fconftest.out`" - else - AC_MSG_ERROR([No output from Fortran test program!]) - fi - rm -f pac_fconftest.out + PAC_FORTRAN_NATIVE_INTEGER_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '1p') + PAC_FORTRAN_NATIVE_INTEGER_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '2p') + PAC_FORTRAN_NATIVE_REAL_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '3p') + PAC_FORTRAN_NATIVE_REAL_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '4p') + PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '5p') + PAC_FORTRAN_NATIVE_DOUBLE_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '6p') ],[ AC_MSG_ERROR([Fortran program fails to build or run!]) ],[ @@ -434,7 +406,6 @@ AC_LANG_POP([Fortran]) AC_DEFUN([PAC_FC_LDBL_DIG],[ AC_MSG_CHECKING([maximum decimal precision for C]) -rm -f pac_Cconftest.out AC_LANG_CONFTEST([ AC_LANG_PROGRAM([ #include @@ -458,19 +429,12 @@ rm -f pac_Cconftest.out #define C_LDBL_DIG LDBL_DIG #endif ],[[ - FILE * pFile; - pFile = fopen("pac_Cconftest.out","w"); - fprintf(pFile, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG); + fprintf(stderr, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG); ]]) ]) AC_RUN_IFELSE([],[ - if test -s pac_Cconftest.out ; then - LDBL_DIG="`sed -n '1p' pac_Cconftest.out`" - FLT128_DIG="`sed -n '2p' pac_Cconftest.out`" - else - AC_MSG_ERROR([No output from C decimal precision program!]) - fi - rm -f pac_Cconftest.out + LDBL_DIG=$(./conftest$EXEEXT 2>&1 | sed -n '1p') + FLT128_DIG=$(./conftest$EXEEXT 2>&1 | sed -n '2p') ],[ AC_MSG_ERROR([C program fails to build or run!]) ],[]) From 2d1f7089e9711a3b174f3f0701dc015cde8f2a95 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Thu, 18 Nov 2021 10:07:29 -0600 Subject: [PATCH 05/25] Don't allow H5Pset(get)_all_coll_metadata_ops for DXPLs (#1201) --- src/H5Pfapl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 70650ecba0a..98f9ed9c21e 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5315,8 +5315,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) /* (Dataset, group, attribute, and named datype access property lists * are sub-classes of link access property lists -QAK) */ - if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* set property to either TRUE if > 0, or FALSE otherwise */ @@ -5367,8 +5366,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) /* (Dataset, group, attribute, and named datype access property lists * are sub-classes of link access property lists -QAK) */ - if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* Get value */ From 2852cf8a07d928590a95642e61050021d167239a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 18 Nov 2021 14:56:32 -0800 Subject: [PATCH 06/25] Fixes const warnings in H5ES package (#1211) --- src/H5ESpublic.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index 4cf71c57387..c8696b32361 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -51,13 +51,13 @@ typedef enum H5ES_status_t { /* Information about operations in an event set */ typedef struct H5ES_op_info_t { /* API call info */ - char *api_name; /* Name of HDF5 API routine called */ - char *api_args; /* "Argument string" for arguments to HDF5 API routine called */ + const char *api_name; /* Name of HDF5 API routine called */ + char * api_args; /* "Argument string" for arguments to HDF5 API routine called */ /* Application info */ - char * app_file_name; /* Name of source file where the HDF5 API routine was called */ - char * app_func_name; /* Name of function where the HDF5 API routine was called */ - unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */ + const char *app_file_name; /* Name of source file where the HDF5 API routine was called */ + const char *app_func_name; /* Name of function where the HDF5 API routine was called */ + unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */ /* Operation info */ uint64_t op_ins_count; /* Counter of operation's insertion into event set */ From 114df8fc7485687e226eedc7a1017dbbb54b87b8 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 18 Nov 2021 14:57:30 -0800 Subject: [PATCH 07/25] Quiets a 'set but not used' warning in h5diff_array.c (#1210) --- tools/lib/h5diff_array.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 362a2f35ee5..1b0d36f98f9 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -1597,6 +1597,9 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, hbool_t both_zero = FALSE; double per; + /* both_zero is set in the PER_UNSIGN macro but not used in this function */ + (void)both_zero; + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar); From 4946dd31b70c4614fe6c719d569ba31ab139738f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 09:22:09 -0600 Subject: [PATCH 08/25] Convert vds swmr test script to powershell --- MANIFEST | 1 + test/testswmr.pwsh.in | 5 +- test/testvdsswmr.pwsh.in | 211 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 test/testvdsswmr.pwsh.in diff --git a/MANIFEST b/MANIFEST index 45a75de5078..7dfe6387ec2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1344,6 +1344,7 @@ ./test/testswmr.pwsh.in ./test/testswmr.sh.in ./test/testvds_env.sh.in +./test/testvdsswmr.pwsh.in ./test/testvdsswmr.sh.in ./test/tfile.c ./test/tgenprop.c diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 27efa448ca6..bec13fbf845 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -35,7 +35,7 @@ $nerrors = 0 ## definitions for message file to coordinate test runs ############################################################################### $WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete - # This should be the same as the define in "./swmr_common.h" + # This should be the same as the define in "$bindir/swmr_common.h" $MESSAGE_TIMEOUT = 300 # Message timeout length in secs # This should be the same as the define in "./h5test.h" @@ -146,7 +146,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "###############################################################################" # Launch the Generator without SWMR_WRITE Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir\swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -201,7 +201,6 @@ foreach ($index_type in $IndexTypeLoop) { $n += 1 } #Write-Output "pid_readers=$pid_readers" - #$IFDEBUG ps # Collect exit code of the readers first because they usually finish # before the writer. diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in new file mode 100644 index 00000000000..de5f23608fd --- /dev/null +++ b/test/testvdsswmr.pwsh.in @@ -0,0 +1,211 @@ +#! /bin/bash +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# Tests for the swmr feature using virtual datasets. +# +# Created: +# Dana Robinson, November 2015 + +$srcdir = '@srcdir@' +$bindir = '@bindir@' +$testdir = '@testdir@' + +############################################################################### +## test parameters +############################################################################### + +$Nwriters = 6 # number of writers (1 per source dataset) +$Nreaders = 5 # number of readers to launch +$nerrors = 0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete + # This should be the same as the define in "$bindir/swmr_common.h" +$MESSAGE_TIMEOUT = 300 # Message timeout length in secs + # This should be the same as the define in "./h5test.h" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +function Test-WithSpaces { + $SPACES=' ' + #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $Message is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +function Wait-Message { + [CmdletBinding()] + param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$Message # Get the name of the message file to wait for + ) + + PROCESS { + $message = Join-Path -Path $testdir -ChildPath $Message + $t0 = Get-Date # Get current time + $t1 = $t0 + $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference + $mexist = 0 # Indicate whether the message file is found + while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out + $t1 = Get-Date # Get current time in seconds + $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference + #Write-Output "Check for $message : time=$difft" + if ([System.IO.File]::Exists($message)) { # If message file is found: + $mexist = 1 # indicate the message file is found + Remove-Item $message # remove the message file + break # get out of the while loop + } + } + if ($mexist -eq 0) { + # Issue warning that the writer message file is not found, continue with launching the reader(s) + Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds" + } + else { + Write-Output "$WRITER_MESSAGE is found" + } + } +} + +############################################################################### +## Main +############################################################################### +# The build (current) directory might be different than the source directory. +if (![System.IO.Directory]::Exists($srcdir)) { + $srcdir = Get-Location + Write-Output "Setting srcdir to default: $srcdir" +} + +# If the bindir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($bindir)) { + $bindir = Get-Location + Write-Output "Setting bindir to default: $bindir" +} + +# If the testdir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($testdir)) { + $testdir = Get-Location + Write-Output "Setting testdir to default: $testdir" +} + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe +$rp = Start-Process -FilePath $testprog -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Output "" + Write-Output "The VFD specified by the HDF5_DRIVER environment variable" + Write-Output "does not support SWMR." + Write-Output "" + Write-Output "SWMR acceptance tests skipped" + Write-Output "" + exit 0 +} + +Set-Location -Path vds_swmr_test +$testdir = Join-Path -Path $testdir -ChildPath vds_swmr_test + +Write-Output "" +Write-Output "###############################################################################" +Write-Output "## Basic VDS SWMR test - writing to a tiled plane" +Write-Output "###############################################################################" + +# Launch the file generator +Write-Output "launch the swmr_generator" +$rp = Start-Process -FilePath $bindir/vds_swmr_gen.exe -NoNewWindow -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 +} + +# Check for error and exit if one occured +#Write-Output "nerrors=$nerrors" +if ($nerrors -ne 0) { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + +# Launch the writers +Write-Output "launch the $Nwriters SWMR VDS writers (1 per source)" +pid_writers = @() +$n = 0 +while ($n -lt $Nwriters) { + $rp = Start-Process -FilePath $bindir/vds_swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "$n" 2>&1 | tee swmr_writer.out.$n + $pid_writers += $rp.id + $n += 1 +} +#Write-Output "pid_writers=$pid_writers" + +# Sleep to ensure that the writers have started +Start-Sleep -Seconds 3 + +# Launch the readers +Write-Output "launch $Nreaders SWMR readers" +$pid_readers = @() +$n = 0 +while ($n -lt $Nreaders) { + $rp = Start-Process -FilePath $bindir/vds_swmr_reader.exe -NoNewWindow -PassThru 2>&1 | tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 +} +#Write-Output "pid_readers=$pid_readers" + +# Collect exit code of the writers +foreach ($xpid in $pid_writers) { + #Write-Output "checked writer $xpid" + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } +} + +# Collect exit code of the readers +# (they usually finish after the writers) +foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } +} + +# Check for error and exit if one occured +#Write-Output "nerrors=$nerrors" +if ($nerrors -ne 0) { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + +############################################################################### +## Report and exit +############################################################################### +cd .. +#Write-Output "nerrors=$nerrors" +if ($nerrors -eq 0) { + Write-Output "VDS SWMR tests passed." +# if test -z "$HDF5_NOCLEANUP"; then +# # delete the test directory +# Remove-Item vds_swmr_test -Recurse +# fi + exit 0 +} +else { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + From 45cc7373c8de04a5fc9742eb5e03b76b42dc6430 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 09:27:19 -0600 Subject: [PATCH 09/25] Enable vdsswmr powershell test --- test/ShellTests.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index aedbb59c11b..c68c724faaf 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -41,11 +41,11 @@ if (PWSH) ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -# add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) -# set_tests_properties (H5SHELL-testvdsswmr PROPERTIES -# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -# ) + add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) + set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) elseif (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) From 15a1f96a11739df174978c14e8aa8d1fee46236c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 10:53:11 -0600 Subject: [PATCH 10/25] Add configure vdsswmr statement --- test/ShellTests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index c68c724faaf..e149830600a 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -41,6 +41,7 @@ if (PWSH) ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1 @ONLY) add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) set_tests_properties (H5SHELL-testvdsswmr PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" From e0ffedc857f23e15f63a97c7c14d04e46721be59 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 11:20:44 -0600 Subject: [PATCH 11/25] Correct powershell script vars --- test/ShellTests.cmake | 2 +- test/testswmr.pwsh.in | 4 ++-- test/testvdsswmr.pwsh.in | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index e149830600a..677bfcedafd 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -33,7 +33,7 @@ if (PWSH) # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST # ) set (srcdir ${HDF5_TEST_SOURCE_DIR}) - set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (bindir ${CMAKE_TEST_OUTPUT_DIRECTORY}) set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY) add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index bec13fbf845..f9c782ee478 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -115,7 +115,7 @@ if (![System.IO.Directory]::Exists($testdir)) { # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe -$rp = Start-Process -FilePath $testprog -PassThru -Wait +$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" Write-Output "The VFD specified by the HDF5_DRIVER environment variable" @@ -373,7 +373,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index de5f23608fd..10bc8f7d179 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -104,7 +104,7 @@ if (![System.IO.Directory]::Exists($testdir)) { # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe -$rp = Start-Process -FilePath $testprog -PassThru -Wait +$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" Write-Output "The VFD specified by the HDF5_DRIVER environment variable" From 4d9aaa8fca602f0b3e29a6e3dd111f428c84db0e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 15:17:30 -0600 Subject: [PATCH 12/25] Convert SWMR shell scripts to Windows powershell. --- MANIFEST | 1 + release_docs/RELEASE.txt | 10 + test/CMakeTests.cmake | 9 + test/ShellTests.cmake | 36 ++- test/testswmr.pwsh.in | 538 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 590 insertions(+), 4 deletions(-) create mode 100644 test/testswmr.pwsh.in diff --git a/MANIFEST b/MANIFEST index 1550a94b24a..22f9c916c7f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1351,6 +1351,7 @@ ./test/testlinks_env.sh.in ./test/testmeta.c ./test/test_mirror.sh.in +./test/testswmr.pwsh.in ./test/testswmr.sh.in ./test/testvds_env.sh.in ./test/testvdsswmr.sh.in diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 017d7503d88..65e1b898478 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,16 @@ New Features Configuration: ------------- + - CMake will now run the power shell script tests in test/ by default + on Windows. + + The test directory includes several shell script tests that previously + were not run by CMake on Windows. These are now run by default. + If TEST_SHELL_SCRIPTS is ON and PWSH is found, the Powershell scripts + will execute. Similar to the bash scripts on unix platforms. + + (ADB - 2021/11/23) + - Added new configure option to support building parallel tools. See Tools below (autotools - CMake): --enable-parallel-tools HDF5_BUILD_PARALLEL_TOOLS diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index b2ed8e866dd..f696167e6c0 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -879,6 +879,15 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* +# find_program(PWSH NAMES pwsh powershell) +# if(PWSH) +# add_test(NAME testswmr +# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") +# elseif(UNIX) +# add_test(NAME testswmr +# COMMAND sh -c "$ < ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt") +# endif() + #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") if (H5_PERL_FOUND) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 732091bfa0e..aedbb59c11b 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -15,8 +15,38 @@ ### T E S T I N G S H E L L S C R I P T S ### ############################################################################## -if (UNIX) - +find_program (PWSH NAMES pwsh powershell) +if (PWSH) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") +# add_test (NAME testswmr +# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") +# add_test (H5SHELL-testflushrefresh ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) +# set_tests_properties (H5SHELL-testflushrefresh PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) +# add_test (H5SHELL-test_usecases ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) +# set_tests_properties (H5SHELL-test_usecases PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) + set (srcdir ${HDF5_TEST_SOURCE_DIR}) + set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) + configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY) + add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) + set_tests_properties (H5SHELL-testswmr PROPERTIES + ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +# add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) +# set_tests_properties (H5SHELL-testvdsswmr PROPERTIES +# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +# ) +elseif (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) set (srcdir ${HDF5_TEST_SOURCE_DIR}) @@ -35,8 +65,6 @@ if (UNIX) ############################################################################## # copy test programs to test dir ############################################################################## - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") add_custom_command ( TARGET accum_swmr_reader POST_BUILD diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in new file mode 100644 index 00000000000..4383e916f9b --- /dev/null +++ b/test/testswmr.pwsh.in @@ -0,0 +1,538 @@ +#! /bin/bash +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# Tests for the swmr feature. + +$srcdir = '@srcdir@' +$bindir = '@bindir@' +$testdir = '@testdir@' + +############################################################################### +## test parameters +############################################################################### + +$Nreaders = 5 # number of readers to launch +$Nrdrs_spa = 3 # number of sparse readers to launch +$Nrecords = 200000 # number of records to write +$Nrecs_rem = 40000 # number of times to shrink +$Nrecs_spa = 20000 # number of records to write in the sparse test +$Nsecs_add = 5 # number of seconds per read interval +$Nsecs_rem = 3 # number of seconds per read interval +$Nsecs_addrem = 8 # number of seconds per read interval +$nerrors = 0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete + # This should be the same as the define in "./swmr_common.h" +$MESSAGE_TIMEOUT = 300 # Message timeout length in secs + # This should be the same as the define in "./h5test.h" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +function Test-WithSpaces { + $SPACES=' ' + #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $Message is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +function Wait-Message { + [CmdletBinding()] + param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$Message # Get the name of the message file to wait for + ) + + PROCESS { + $message = Join-Path -Path $testdir -ChildPath $Message + $t0 = Get-Date # Get current time + $t1 = $t0 + $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference + $mexist = 0 # Indicate whether the message file is found + while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out + $t1 = Get-Date # Get current time in seconds + $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference + #Write-Output "Check for $message : time=$difft" + if ([System.IO.File]::Exists($message)) { # If message file is found: + $mexist = 1 # indicate the message file is found + Remove-Item $message # remove the message file + break # get out of the while loop + } + } + if ($mexist -eq 0) { + # Issue warning that the writer message file is not found, continue with launching the reader(s) + Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds" + } + else { + Write-Output "$WRITER_MESSAGE is found" + } + } +} + +############################################################################### +## Main +## +## Modifications: +## Vailin Choi; July 2013 +## Add waiting of message file before launching the reader(s). +## Due to the implementation of file locking, coordination +## is needed in file opening for the writer/reader tests +## to proceed as expected. +## +############################################################################### +# The build (current) directory might be different than the source directory. +if (![System.IO.Directory]::Exists($srcdir)) { + $srcdir = Get-Location + Write-Output "Setting srcdir to default: $srcdir" +} + +# If the bindir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($bindir)) { + $bindir = Get-Location + Write-Output "Setting bindir to default: $bindir" +} + +# If the testdir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($testdir)) { + $testdir = Get-Location + Write-Output "Setting testdir to default: $testdir" +} + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe +$rp = Start-Process -FilePath $testprog -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Output "" + Write-Output "The VFD specified by the HDF5_DRIVER environment variable" + Write-Output "does not support SWMR." + Write-Output "" + Write-Output "SWMR acceptance tests skipped" + Write-Output "" + exit 0 +} + +Set-Location -Path swmr_test +$testdir = Join-Path -Path $testdir -ChildPath swmr_test + +# Loop over index types +$IndexTypeLoop = '-i ea', '-i b2' +foreach ($index_type in $IndexTypeLoop) { + # Try with and without compression + $CompressLoop = '', '-c 5' + foreach ($compress in $CompressLoop) { + Write-Output "" + Write-Output "*******************************************************************************" + Write-Output "** Loop testing parameters: $index_type $compress" + Write-Output "*******************************************************************************" + Write-Output "" + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Generator test" + Write-Output "###############################################################################" + # Launch the Generator without SWMR_WRITE + Write-Output "launch the swmr_generator" + $rp = Start-Process -FilePath $bindir\swmr_generator.exe -ArgumentList "$compress $index_type" -PassThru -Wait + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Launch the Generator with SWMR_WRITE + Write-Output "launch the swmr_generator with SWMR_WRITE" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -ArgumentList "-s $compress $index_type" -PassThru -Wait + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + exit 1 + } + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Use H5Fstart_swmr_write() to enable SWMR writing mode" + Write-Output "###############################################################################" + + # Remove any possible writer message file before launching writer + if ([System.IO.File]::Exists($WRITER_MESSAGE)) { # If message file is found + Remove-Item $WRITER_MESSAGE + } + # + # Launch the Writer + Write-Output "launch the swmr_start_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + + # + # Launch the Readers + #declare -a seeds = ( ... ) + Write-Output "launch $Nreaders swmr_readers" + $pid_readers = @() + $n = 0 + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp=Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + #$IFDEBUG ps + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Writer test - test expanding the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + Write-Output "launch the swmr_generator" + $rp=Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "-s $compress $index_type" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # + # Launch the Writer + Write-Output "launch the swmr_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Readers + #declare -a seeds = ( ... ) + Write-Output "launch $Nreaders swmr_readers" + $pid_readers = @() + $n = 0 + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Remove test - test shrinking the dataset" + Write-Output "###############################################################################" + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # Launch the Remove Writer + Write-Output "launch the swmr_remove_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Remove Readers + #declare -a seeds = ( ... ) + $n = 0 + $pid_readers = @() + Write-Output "launch $Nreaders swmr_remove_readers" + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Add/remove test - randomly grow or shrink the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + Write-Output "launch the swmr_generator" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Launch the Writer (not in parallel - just to rebuild the datasets) + Write-Output "launch the swmr_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -Wait -ArgumentList "$Nrecords $seed" + if ($rp.ExitCode -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # + # Launch the Add/Remove Writer + Write-Output "launch the swmr_addrem_writer" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Add/Remove Readers + #declare -a seeds = ( ... ) + $n = 0 + $pid_readers = @() + Write-Output "launch $Nreaders swmr_remove_readers" + while ($n -lt $Nreaders) { + #seed = "-r ${seeds[$n]}" + $seed = "" + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the readers first because they usually finish + # before the writer. + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + + Write-Output "" + Write-Output "###############################################################################" + Write-Output "## Sparse writer test - test writing to random locations in the dataset" + Write-Output "###############################################################################" + + # Launch the Generator + # NOTE: Random seed is shared between readers and writers and is + # created by the generator. + Write-Output "launch the swmr_generator" + $seed = "" # Put -r command here + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type $seed" + if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 + } + + # Remove any possible writer message file before launching writer + Remove-Item $WRITER_MESSAGE + # Launch the Sparse writer + Write-Output "launch the swmr_sparse_writer" + $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out + $pid_writer = $rp.Id + #Write-Output "pid_writer=$pid_writer" + + # Wait for message from writer process before starting reader(s) + Wait-Message $WRITER_MESSAGE + # + # Launch the Sparse readers + $n = 0 + $pid_readers = @() + Write-Output "launch $Nrdrs_spa swmr_sparse_readers" + while ($n -lt $Nrdrs_spa) { + # The sparse reader spits out a LOT of data so it's set to 'quiet' + $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 + } + #Write-Output "pid_readers=$pid_readers" + + # Collect exit code of the writer + #Write-Output "checked writer $pid_writer" + Wait-Process -Id $pid_writer + if ($? -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } + + # Collect exit code of the readers + foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + Wait-Process -Id $xpid + if ($? -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } + } + + # Check for error and exit if one occured + #Write-Output "nerrors=$nerrors" + if ($nerrors -ne 0) { + Write-Warning "SWMR tests failed with $nerrors errors." + Write-Warning "(Writer and reader output preserved)" + exit 1 + } + + # Clean up output files + Remove-Item swmr_writer.out + Remove-Item swmr_reader.out.* + } +} + +############################################################################### +## Report and exit +############################################################################### +cd .. +#Write-Output "nerrors=$nerrors" +if ($nerrors -eq 0) { + Write-Output "SWMR tests passed." +# if test -z "$HDF5_NOCLEANUP"; then +# # delete the test directory +# Remove-Item swmr_test -Recurse +# fi + exit 0 +} +else { + Write-Warning "SWMR tests failed with $nerrors errors." + exit 1 +} + From 12d921a6c70a5df859af81da4b4823a3be51fe7a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 15:47:44 -0600 Subject: [PATCH 13/25] Use $LastExitCode instead of $? in script --- test/testswmr.pwsh.in | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 4383e916f9b..0c2635f149e 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -208,7 +208,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -217,7 +217,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -279,7 +279,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -288,7 +288,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -341,7 +341,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -350,7 +350,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -421,7 +421,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -430,7 +430,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -489,7 +489,7 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" Wait-Process -Id $pid_writer - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -498,7 +498,7 @@ foreach ($index_type in $IndexTypeLoop) { foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" Wait-Process -Id $xpid - if ($? -ne 0) { + if ($LastExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } From 0f8c84d804538bb167251727753229b8ebeb4255 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Nov 2021 16:48:41 -0600 Subject: [PATCH 14/25] Prevent execution in a different window --- test/testswmr.pwsh.in | 72 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 0c2635f149e..27efa448ca6 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -146,7 +146,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "###############################################################################" # Launch the Generator without SWMR_WRITE Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir\swmr_generator.exe -ArgumentList "$compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir\swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -154,7 +154,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator with SWMR_WRITE Write-Output "launch the swmr_generator with SWMR_WRITE" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -ArgumentList "-s $compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -ArgumentList "-s $compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -180,7 +180,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer Write-Output "launch the swmr_start_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_start_write.exe -NoNewWindow -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -196,7 +196,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp=Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -207,8 +207,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -216,8 +216,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -241,7 +241,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp=Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "-s $compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "-s $compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -253,7 +253,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer Write-Output "launch the swmr_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -268,7 +268,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_reader.exe -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -278,8 +278,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -287,8 +287,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -315,7 +315,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Remove Writer Write-Output "launch the swmr_remove_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_remove_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -330,7 +330,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -340,8 +340,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -349,8 +349,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -374,7 +374,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -383,7 +383,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Writer (not in parallel - just to rebuild the datasets) Write-Output "launch the swmr_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_writer.exe -PassThru -Wait -ArgumentList "$Nrecords $seed" + $rp = Start-Process -FilePath $bindir/swmr_writer.exe -NoNewWindow -PassThru -Wait -ArgumentList "$Nrecords $seed" if ($rp.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 @@ -395,7 +395,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Add/Remove Writer Write-Output "launch the swmr_addrem_writer" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_addrem_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out $pid_writer = $rp.id #Write-Output "pid_writer=$pid_writer" @@ -410,7 +410,7 @@ foreach ($index_type in $IndexTypeLoop) { while ($n -lt $Nreaders) { #seed = "-r ${seeds[$n]}" $seed = "" - $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -420,8 +420,8 @@ foreach ($index_type in $IndexTypeLoop) { # before the writer. foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } @@ -429,8 +429,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -457,7 +457,7 @@ foreach ($index_type in $IndexTypeLoop) { # created by the generator. Write-Output "launch the swmr_generator" $seed = "" # Put -r command here - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -PassThru -Wait -ArgumentList "$compress $index_type $seed" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "$compress $index_type $seed" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -467,7 +467,7 @@ foreach ($index_type in $IndexTypeLoop) { Remove-Item $WRITER_MESSAGE # Launch the Sparse writer Write-Output "launch the swmr_sparse_writer" - $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out + $rp = Start-Process -FilePath $bindir/swmr_sparse_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out $pid_writer = $rp.Id #Write-Output "pid_writer=$pid_writer" @@ -480,7 +480,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "launch $Nrdrs_spa swmr_sparse_readers" while ($n -lt $Nrdrs_spa) { # The sparse reader spits out a LOT of data so it's set to 'quiet' - $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n + $rp = Start-Process -FilePath $bindir/swmr_sparse_reader.exe -NoNewWindow -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n $pid_readers += $rp.id $n += 1 } @@ -488,8 +488,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the writer #Write-Output "checked writer $pid_writer" - Wait-Process -Id $pid_writer - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $pid_writer + if ($result.ExitCode -ne 0) { Write-Warning "writer had error" $nerrors += 1 } @@ -497,8 +497,8 @@ foreach ($index_type in $IndexTypeLoop) { # Collect exit code of the readers foreach ($xpid in $pid_readers) { #Write-Output "checked reader $xpid" - Wait-Process -Id $xpid - if ($LastExitCode -ne 0) { + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { Write-Warning "reader had error" $nerrors += 1 } From 518c561dd960f29466836b604893120441b6241f Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 17 Nov 2021 23:53:00 -0600 Subject: [PATCH 15/25] Github #969 Use stdout instead of file for configure check (#1089) * Use stdout instead of file for configure check * Make change requested by #1157 * Change fortran to use stderr for configure * Correct typo * remove obsolete file check * Fortran statement fix --- config/cmake/HDF5UseFortran.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 0d05e205fde..bf22bd7f718 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -195,7 +195,11 @@ foreach (KIND ${VAR}) " ) FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND} PROG_OUTPUT1) +<<<<<<< Upstream, based on branch 'develop' of https://github.com/HDFGroup/hdf5.git string (REGEX REPLACE "[\r\n]+" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") +======= + string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") +>>>>>>> 87940e8 Github #969 Use stdout instead of file for configure check (#1089) set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") endforeach () @@ -238,7 +242,11 @@ foreach (KIND ${VAR} ) " ) FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND} PROG_OUTPUT2) +<<<<<<< Upstream, based on branch 'develop' of https://github.com/HDFGroup/hdf5.git string (REGEX REPLACE "[\r\n]+" "" PROG_OUTPUT2 "${PROG_OUTPUT2}") +======= + string (REGEX REPLACE "\n" "" PROG_OUTPUT2 "${PROG_OUTPUT2}") +>>>>>>> 87940e8 Github #969 Use stdout instead of file for configure check (#1089) set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT2},") endforeach () From feed5c74d9af0cdaf87448d32d9e7d25183579fc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 09:22:09 -0600 Subject: [PATCH 16/25] Convert vds swmr test script to powershell --- MANIFEST | 1 + test/testswmr.pwsh.in | 5 +- test/testvdsswmr.pwsh.in | 211 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 test/testvdsswmr.pwsh.in diff --git a/MANIFEST b/MANIFEST index 22f9c916c7f..42f555edce4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1354,6 +1354,7 @@ ./test/testswmr.pwsh.in ./test/testswmr.sh.in ./test/testvds_env.sh.in +./test/testvdsswmr.pwsh.in ./test/testvdsswmr.sh.in ./test/tfile.c ./test/tgenprop.c diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 27efa448ca6..bec13fbf845 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -35,7 +35,7 @@ $nerrors = 0 ## definitions for message file to coordinate test runs ############################################################################### $WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete - # This should be the same as the define in "./swmr_common.h" + # This should be the same as the define in "$bindir/swmr_common.h" $MESSAGE_TIMEOUT = 300 # Message timeout length in secs # This should be the same as the define in "./h5test.h" @@ -146,7 +146,7 @@ foreach ($index_type in $IndexTypeLoop) { Write-Output "###############################################################################" # Launch the Generator without SWMR_WRITE Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir\swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 @@ -201,7 +201,6 @@ foreach ($index_type in $IndexTypeLoop) { $n += 1 } #Write-Output "pid_readers=$pid_readers" - #$IFDEBUG ps # Collect exit code of the readers first because they usually finish # before the writer. diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in new file mode 100644 index 00000000000..de5f23608fd --- /dev/null +++ b/test/testvdsswmr.pwsh.in @@ -0,0 +1,211 @@ +#! /bin/bash +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# Tests for the swmr feature using virtual datasets. +# +# Created: +# Dana Robinson, November 2015 + +$srcdir = '@srcdir@' +$bindir = '@bindir@' +$testdir = '@testdir@' + +############################################################################### +## test parameters +############################################################################### + +$Nwriters = 6 # number of writers (1 per source dataset) +$Nreaders = 5 # number of readers to launch +$nerrors = 0 + +############################################################################### +## definitions for message file to coordinate test runs +############################################################################### +$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete + # This should be the same as the define in "$bindir/swmr_common.h" +$MESSAGE_TIMEOUT = 300 # Message timeout length in secs + # This should be the same as the define in "./h5test.h" + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +function Test-WithSpaces { + $SPACES=' ' + #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# To wait for the writer message file or till the maximum # of seconds is reached +# $Message is the message file to wait for +# This performs similar function as the routine h5_wait_message() in test/h5test.c +function Wait-Message { + [CmdletBinding()] + param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$Message # Get the name of the message file to wait for + ) + + PROCESS { + $message = Join-Path -Path $testdir -ChildPath $Message + $t0 = Get-Date # Get current time + $t1 = $t0 + $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference + $mexist = 0 # Indicate whether the message file is found + while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out + $t1 = Get-Date # Get current time in seconds + $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference + #Write-Output "Check for $message : time=$difft" + if ([System.IO.File]::Exists($message)) { # If message file is found: + $mexist = 1 # indicate the message file is found + Remove-Item $message # remove the message file + break # get out of the while loop + } + } + if ($mexist -eq 0) { + # Issue warning that the writer message file is not found, continue with launching the reader(s) + Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds" + } + else { + Write-Output "$WRITER_MESSAGE is found" + } + } +} + +############################################################################### +## Main +############################################################################### +# The build (current) directory might be different than the source directory. +if (![System.IO.Directory]::Exists($srcdir)) { + $srcdir = Get-Location + Write-Output "Setting srcdir to default: $srcdir" +} + +# If the bindir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($bindir)) { + $bindir = Get-Location + Write-Output "Setting bindir to default: $bindir" +} + +# If the testdir directory is not set just use current (.). +if (![System.IO.Directory]::Exists($testdir)) { + $testdir = Get-Location + Write-Output "Setting testdir to default: $testdir" +} + +# Check to see if the VFD specified by the HDF5_DRIVER environment variable +# supports SWMR. +$testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe +$rp = Start-Process -FilePath $testprog -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Output "" + Write-Output "The VFD specified by the HDF5_DRIVER environment variable" + Write-Output "does not support SWMR." + Write-Output "" + Write-Output "SWMR acceptance tests skipped" + Write-Output "" + exit 0 +} + +Set-Location -Path vds_swmr_test +$testdir = Join-Path -Path $testdir -ChildPath vds_swmr_test + +Write-Output "" +Write-Output "###############################################################################" +Write-Output "## Basic VDS SWMR test - writing to a tiled plane" +Write-Output "###############################################################################" + +# Launch the file generator +Write-Output "launch the swmr_generator" +$rp = Start-Process -FilePath $bindir/vds_swmr_gen.exe -NoNewWindow -PassThru -Wait +if ($rp.ExitCode -ne 0) { + Write-Warning "generator had error" + $nerrors += 1 +} + +# Check for error and exit if one occured +#Write-Output "nerrors=$nerrors" +if ($nerrors -ne 0) { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + +# Launch the writers +Write-Output "launch the $Nwriters SWMR VDS writers (1 per source)" +pid_writers = @() +$n = 0 +while ($n -lt $Nwriters) { + $rp = Start-Process -FilePath $bindir/vds_swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "$n" 2>&1 | tee swmr_writer.out.$n + $pid_writers += $rp.id + $n += 1 +} +#Write-Output "pid_writers=$pid_writers" + +# Sleep to ensure that the writers have started +Start-Sleep -Seconds 3 + +# Launch the readers +Write-Output "launch $Nreaders SWMR readers" +$pid_readers = @() +$n = 0 +while ($n -lt $Nreaders) { + $rp = Start-Process -FilePath $bindir/vds_swmr_reader.exe -NoNewWindow -PassThru 2>&1 | tee swmr_reader.out.$n + $pid_readers += $rp.id + $n += 1 +} +#Write-Output "pid_readers=$pid_readers" + +# Collect exit code of the writers +foreach ($xpid in $pid_writers) { + #Write-Output "checked writer $xpid" + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { + Write-Warning "writer had error" + $nerrors += 1 + } +} + +# Collect exit code of the readers +# (they usually finish after the writers) +foreach ($xpid in $pid_readers) { + #Write-Output "checked reader $xpid" + $result = Wait-Process -Id $xpid + if ($result.ExitCode -ne 0) { + Write-Warning "reader had error" + $nerrors += 1 + } +} + +# Check for error and exit if one occured +#Write-Output "nerrors=$nerrors" +if ($nerrors -ne 0) { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + +############################################################################### +## Report and exit +############################################################################### +cd .. +#Write-Output "nerrors=$nerrors" +if ($nerrors -eq 0) { + Write-Output "VDS SWMR tests passed." +# if test -z "$HDF5_NOCLEANUP"; then +# # delete the test directory +# Remove-Item vds_swmr_test -Recurse +# fi + exit 0 +} +else { + Write-Warning "VDS SWMR tests failed with $nerrors errors." + exit 1 +} + From 59df326d0788d81cc6fa2651bc531e215d4d0ec4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 09:27:19 -0600 Subject: [PATCH 17/25] Enable vdsswmr powershell test --- test/ShellTests.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index aedbb59c11b..c68c724faaf 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -41,11 +41,11 @@ if (PWSH) ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -# add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) -# set_tests_properties (H5SHELL-testvdsswmr PROPERTIES -# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -# ) + add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) + set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) elseif (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) From 9a04e8362cc0a93c4c40c6252d84d503fd5cd3e6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 10:53:11 -0600 Subject: [PATCH 18/25] Add configure vdsswmr statement --- test/ShellTests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index c68c724faaf..e149830600a 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -41,6 +41,7 @@ if (PWSH) ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1 @ONLY) add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) set_tests_properties (H5SHELL-testvdsswmr PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" From b86e1f249ac53653666e8f5b1cecb4ff8fc97e34 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 19 Nov 2021 11:20:44 -0600 Subject: [PATCH 19/25] Correct powershell script vars --- test/ShellTests.cmake | 2 +- test/testswmr.pwsh.in | 4 ++-- test/testvdsswmr.pwsh.in | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index e149830600a..677bfcedafd 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -33,7 +33,7 @@ if (PWSH) # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST # ) set (srcdir ${HDF5_TEST_SOURCE_DIR}) - set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (bindir ${CMAKE_TEST_OUTPUT_DIRECTORY}) set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY) add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index bec13fbf845..f9c782ee478 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -115,7 +115,7 @@ if (![System.IO.Directory]::Exists($testdir)) { # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe -$rp = Start-Process -FilePath $testprog -PassThru -Wait +$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" Write-Output "The VFD specified by the HDF5_DRIVER environment variable" @@ -373,7 +373,7 @@ foreach ($index_type in $IndexTypeLoop) { # Launch the Generator Write-Output "launch the swmr_generator" - $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" + $rp = Start-Process -FilePath $bindir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type" if ($rp.ExitCode -ne 0) { Write-Warning "generator had error" $nerrors += 1 diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index de5f23608fd..10bc8f7d179 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -104,7 +104,7 @@ if (![System.IO.Directory]::Exists($testdir)) { # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $testprog = Join-Path -Path $bindir -ChildPath swmr_check_compat_vfd.exe -$rp = Start-Process -FilePath $testprog -PassThru -Wait +$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" Write-Output "The VFD specified by the HDF5_DRIVER environment variable" From 2b7a0f75f6f57f3b706a3740a8739e79643237fd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Dec 2021 11:36:25 -0600 Subject: [PATCH 20/25] Cleanup review issues --- release_docs/RELEASE.txt | 7 ++----- test/CMakeTests.cmake | 9 --------- test/ShellTests.cmake | 23 +---------------------- test/testswmr.pwsh.in | 2 -- test/testvdsswmr.pwsh.in | 2 -- 5 files changed, 3 insertions(+), 40 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b8a96daf4a9..5fae0815275 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,25 +47,22 @@ New Features Configuration: ------------- - - CMake will now run the power shell script tests in test/ by default + - CMake will now run the PowerShell script tests in test/ by default on Windows. The test directory includes several shell script tests that previously were not run by CMake on Windows. These are now run by default. - If TEST_SHELL_SCRIPTS is ON and PWSH is found, the Powershell scripts + If TEST_SHELL_SCRIPTS is ON and PWSH is found, the PowerShell scripts will execute. Similar to the bash scripts on unix platforms. (ADB - 2021/11/23) -<<<<<<< HEAD - Added new configure option to support building parallel tools. See Tools below (autotools - CMake): --enable-parallel-tools HDF5_BUILD_PARALLEL_TOOLS (RAW - 2021/10/25) -======= ->>>>>>> branch 'develop-pwsh' of https://github.com/byrnHDF/hdf5.git - Added new configure options to enable dimension scales APIs (H5DS*) to use new object references with the native VOL connector (aka native HDF5 library). New references are always used for non-native terminal VOL diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index f696167e6c0..b2ed8e866dd 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -879,15 +879,6 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# find_program(PWSH NAMES pwsh powershell) -# if(PWSH) -# add_test(NAME testswmr -# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") -# elseif(UNIX) -# add_test(NAME testswmr -# COMMAND sh -c "$ < ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt") -# endif() - #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") if (H5_PERL_FOUND) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 677bfcedafd..26dce218d25 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -20,18 +20,7 @@ if (PWSH) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") -# add_test (NAME testswmr -# COMMAND ${PWSH} -c \"Get-Content ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt | $\") -# add_test (H5SHELL-testflushrefresh ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) -# set_tests_properties (H5SHELL-testflushrefresh PROPERTIES -# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -# ) -# add_test (H5SHELL-test_usecases ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) -# set_tests_properties (H5SHELL-test_usecases PROPERTIES -# ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" -# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -# ) + set (srcdir ${HDF5_TEST_SOURCE_DIR}) set (bindir ${CMAKE_TEST_OUTPUT_DIRECTORY}) set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) @@ -73,15 +62,6 @@ elseif (UNIX) ARGS -E copy_if_different "${HDF5_SOURCE_DIR}/bin/output_filter.sh" "${HDF5_TEST_BINARY_DIR}/H5TEST/bin/output_filter.sh" ) - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") - - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") - - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") - ############################################################################## ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -137,6 +117,5 @@ elseif (UNIX) ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - endif () endif () diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index f9c782ee478..1895c436ec8 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -1,5 +1,3 @@ -#! /bin/bash -# # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index 10bc8f7d179..f054a4f8b9f 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -1,5 +1,3 @@ -#! /bin/bash -# # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. From 921ef710844899888c2e07b8751102d63e382d2c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Dec 2021 13:07:51 -0600 Subject: [PATCH 21/25] Fix variable assignment --- test/testvdsswmr.pwsh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index f054a4f8b9f..75697d1300c 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -138,7 +138,7 @@ if ($nerrors -ne 0) { # Launch the writers Write-Output "launch the $Nwriters SWMR VDS writers (1 per source)" -pid_writers = @() +$pid_writers = @() $n = 0 while ($n -lt $Nwriters) { $rp = Start-Process -FilePath $bindir/vds_swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "$n" 2>&1 | tee swmr_writer.out.$n From 621168987ef766262cd0fd11f555ff3106e92a16 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 1 Dec 2021 14:33:22 -0600 Subject: [PATCH 22/25] Change the wait function to pass in the path --- test/testswmr.pwsh.in | 14 ++++++++------ test/testvdsswmr.pwsh.in | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 1895c436ec8..9876ef8b7cb 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -51,12 +51,14 @@ function Test-WithSpaces { function Wait-Message { [CmdletBinding()] param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$TestPath, # Get the path of the message file to wait for [Parameter(Mandatory, ValueFromPipeline)] [string]$Message # Get the name of the message file to wait for ) PROCESS { - $message = Join-Path -Path $testdir -ChildPath $Message + $message = Join-Path -Path $TestPath -ChildPath $Message $t0 = Get-Date # Get current time $t1 = $t0 $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference @@ -183,7 +185,7 @@ foreach ($index_type in $IndexTypeLoop) { #Write-Output "pid_writer=$pid_writer" # Wait for message from writer process before starting reader(s) - Wait-Message $WRITER_MESSAGE + Wait-Message $testdir $WRITER_MESSAGE # # Launch the Readers @@ -255,7 +257,7 @@ foreach ($index_type in $IndexTypeLoop) { #Write-Output "pid_writer=$pid_writer" # Wait for message from writer process before starting reader(s) - Wait-Message $WRITER_MESSAGE + Wait-Message $testdir $WRITER_MESSAGE # # Launch the Readers #declare -a seeds = ( ... ) @@ -317,7 +319,7 @@ foreach ($index_type in $IndexTypeLoop) { #Write-Output "pid_writer=$pid_writer" # Wait for message from writer process before starting reader(s) - Wait-Message $WRITER_MESSAGE + Wait-Message $testdir $WRITER_MESSAGE # # Launch the Remove Readers #declare -a seeds = ( ... ) @@ -397,7 +399,7 @@ foreach ($index_type in $IndexTypeLoop) { #Write-Output "pid_writer=$pid_writer" # Wait for message from writer process before starting reader(s) - Wait-Message $WRITER_MESSAGE + Wait-Message $testdir $WRITER_MESSAGE # # Launch the Add/Remove Readers #declare -a seeds = ( ... ) @@ -469,7 +471,7 @@ foreach ($index_type in $IndexTypeLoop) { #Write-Output "pid_writer=$pid_writer" # Wait for message from writer process before starting reader(s) - Wait-Message $WRITER_MESSAGE + Wait-Message $testdir $WRITER_MESSAGE # # Launch the Sparse readers $n = 0 diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index 75697d1300c..73071af17e5 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -48,12 +48,14 @@ function Test-WithSpaces { function Wait-Message { [CmdletBinding()] param ( + [Parameter(Mandatory, ValueFromPipeline)] + [string]$TestPath, # Get the path of the message file to wait for [Parameter(Mandatory, ValueFromPipeline)] [string]$Message # Get the name of the message file to wait for ) PROCESS { - $message = Join-Path -Path $testdir -ChildPath $Message + $message = Join-Path -Path $TestPath -ChildPath $Message $t0 = Get-Date # Get current time $t1 = $t0 $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference From 49a0ac8a01a43e42f5b08fd0620e97964f59e98e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 2 Dec 2021 13:02:29 -0600 Subject: [PATCH 23/25] Disable actual test execution until programs fixed --- test/ShellTests.cmake | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 26dce218d25..a6fda8725ee 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -25,17 +25,19 @@ if (PWSH) set (bindir ${CMAKE_TEST_OUTPUT_DIRECTORY}) set (testdir ${HDF5_TEST_BINARY_DIR}/H5TEST) configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1 @ONLY) - add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) - set_tests_properties (H5SHELL-testswmr PROPERTIES - ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) + # test commented out as currently the programs are not allowing another access to the data file + #add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1) + #set_tests_properties (H5SHELL-testswmr PROPERTIES + # ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + #) configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1 @ONLY) - add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) - set_tests_properties (H5SHELL-testvdsswmr PROPERTIES - ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST - ) + # test commented out as currently the programs are not allowing another access to the data file + #add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1) + #set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + # ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + #) elseif (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) From ec9a15234546bdb753b71bc27c9a4af922cfccde Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Dec 2021 10:31:39 -0600 Subject: [PATCH 24/25] Adjust copyright text --- test/testswmr.pwsh.in | 1 - test/testvdsswmr.pwsh.in | 1 - 2 files changed, 2 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 9876ef8b7cb..7568063898d 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -1,5 +1,4 @@ # Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. # # This file is part of HDF5. The full HDF5 copyright notice, including diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index 73071af17e5..764bd137a4a 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -1,5 +1,4 @@ # Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. # # This file is part of HDF5. The full HDF5 copyright notice, including From df65f84fe0d9a351bd2a8f892eff8e087b117c38 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 8 Dec 2021 10:48:04 -0600 Subject: [PATCH 25/25] Fix spelling --- test/testswmr.pwsh.in | 12 ++++++------ test/testvdsswmr.pwsh.in | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/testswmr.pwsh.in b/test/testswmr.pwsh.in index 7568063898d..c2cc97e8993 100644 --- a/test/testswmr.pwsh.in +++ b/test/testswmr.pwsh.in @@ -159,7 +159,7 @@ foreach ($index_type in $IndexTypeLoop) { $nerrors += 1 } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." @@ -220,7 +220,7 @@ foreach ($index_type in $IndexTypeLoop) { $nerrors += 1 } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." @@ -291,7 +291,7 @@ foreach ($index_type in $IndexTypeLoop) { $nerrors += 1 } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." @@ -353,7 +353,7 @@ foreach ($index_type in $IndexTypeLoop) { $nerrors += 1 } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." @@ -433,7 +433,7 @@ foreach ($index_type in $IndexTypeLoop) { $nerrors += 1 } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." @@ -502,7 +502,7 @@ foreach ($index_type in $IndexTypeLoop) { } } - # Check for error and exit if one occured + # Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "SWMR tests failed with $nerrors errors." diff --git a/test/testvdsswmr.pwsh.in b/test/testvdsswmr.pwsh.in index 764bd137a4a..4e066497f22 100644 --- a/test/testvdsswmr.pwsh.in +++ b/test/testvdsswmr.pwsh.in @@ -130,7 +130,7 @@ if ($rp.ExitCode -ne 0) { $nerrors += 1 } -# Check for error and exit if one occured +# Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "VDS SWMR tests failed with $nerrors errors." @@ -183,7 +183,7 @@ foreach ($xpid in $pid_readers) { } } -# Check for error and exit if one occured +# Check for error and exit if one occurred #Write-Output "nerrors=$nerrors" if ($nerrors -ne 0) { Write-Warning "VDS SWMR tests failed with $nerrors errors."