1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
|
#!/us/bin/env bash
#
# Copyright by Akadio, Inc.
#
# 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 vfd swmr feature.
###############################################################################
# VFD SWMR concurrent tests which are modified from existing swmr concurrent tests.
# This is copied and modified from testswmr.sh.in
#
###############################################################################
srcdir=@srcdir@
. ${srcdir}/supervise.subr
utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@
###############################################################################
## test parameters
###############################################################################
nerrors=0
nsofterrors=0 # soft errors are expected to occur some of the time
# on a couple of nondeterministic tests.
###############################################################################
## test parameters for vfd_swmr_bigset_writer.c and vfd_swmr_group_writer.c
## based on HDF5TestExpress:
## 0: Exhaustive run: Tests take a long time to run.
## 1: Default run.
## 2+: Quick run
###############################################################################
#
if [[ -z $HDF5TestExpress ]]; then # Set to default when not set
HDF5TestExpress=1
fi
###############################################################################
## For legacy tests:
## definitions for message file to coordinate test runs
###############################################################################
#
WRITER_MESSAGE=VFD_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"
###############################################################################
## For attrdset test: definitions for fifo files to coordinate test runs
###############################################################################
#
ATTRDSET_FIFO_WRITER_TO_READER=fifo_attrdset_writer_to_reader
ATTRDSET_FIFO_READER_TO_WRITER=fifo_attrdset_reader_to_writer
###############################################################################
## For dsetops test: definitions for fifo files to coordinate test runs
###############################################################################
#
DSETOPS_FIFO_WRITER_TO_READER=fifo_dsetops_writer_to_reader
DSETOPS_FIFO_READER_TO_WRITER=fifo_dsetops_reader_to_writer
###############################################################################
## For dsetchks test: definitions for fifo files to coordinate test runs
###############################################################################
#
DSETCHKS_FIFO_WRITER_TO_READER=fifo_dsetchks_writer_to_reader
DSETCHKS_FIFO_READER_TO_WRITER=fifo_dsetchks_reader_to_writer
###############################################################################
## For gfail{1,2,3,4} test: definitions for fifo files to coordinate test runs
###############################################################################
#
GFAIL_FIFO_WRITER_TO_READER=fifo_group_writer_to_reader
GFAIL_FIFO_READER_TO_WRITER=fifo_group_reader_to_writer
###############################################################################
## Was the aux process built?
###############################################################################
#
USING_AUX_PROCESS=@AUX_PROCESS@
###############################################################################
## short hands and function definitions
###############################################################################
#
DPRINT=: # Set to "echo Debug:" for debugging printing,
# else ":" for noop.
IFDEBUG=: # Set to null to turn on debugging, else ":" for noop.
# For legacy tests:
# To wait for the writer message file or till the maximum # of seconds is reached
# $1 is the message file to wait for
# This performs similar function as the routine h5_wait_message() in test/h5test.c
WAIT_MESSAGE() {
message=$1 # Get the name of the message file to wait for
t0=`date +%s` # Get current time in seconds
difft=0 # Initialize the time difference
mexist=0 # Indicate whether the message file is found
while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do
t1=`date +%s` # Get current time in seconds
difft=`expr $t1 - $t0` # Calculate the time difference
if [ -e $message ]; then # If message file is found:
mexist=1 # indicate the message file is found
rm $message # remove the message file
break # get out of the while loop
fi
done;
if test $mexist -eq 0; then
# Issue warning that the writer message file is not found, continue with launching the reader(s)
echo warning: $WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds
else
echo $WRITER_MESSAGE is found
fi
}
###############################################################################
## 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 test -z "$srcdir"; then
srcdir=.
fi
# Check to see if the VFD specified by the HDF5_DRIVER environment variable
# supports SWMR.
$utils_testdir/swmr_check_compat_vfd
rc=$?
if [ $rc -ne 0 ] ; then
echo
echo "The VFD specified by the HDF5_DRIVER environment variable"
echo "does not support SWMR."
echo
echo "SWMR acceptance tests skipped"
echo
exit 0
fi
all_tests="generator expand shrink expand_shrink sparse vlstr_null vlstr_oob zoo"
all_tests="${all_tests} groups groups_attrs groups_ops few_big many_small"
# For exhaustive run, add:
# attrdset, dsetops, dsetops_ref, dsetchks
# os_groups_attrs, os_groups_ops, os_groups_seg, independ_wr,
# gfail_entry_length, gfail_checksum, gfail_page_size, gfail_index_space
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
all_tests="${all_tests} attrdset dsetops dsetops_ref dsetchks"
all_tests="${all_tests} os_groups_attrs os_groups_ops os_groups_seg independ_wr"
all_tests="${all_tests} gfail_entry_length gfail_checksum gfail_page_size gfail_index_space"
fi
tests=${all_tests}
if [ $# -gt 0 ]; then
tests=
fi
for t; do
if ! echo $all_tests | grep -q "\<${t}\>"; then
echo "$t: Unknown test, ${t}"
exit 1
fi
tests="${tests} ${t}"
done
echo tests=${tests}
for t in ${tests}; do
eval do_${t}=yes
done
# HDF5 has several tests that create and delete signal files to communicate
# between processes, and it seems that even though the names of the files are
# different, occasionally the wrong file is deleted, interrupting the flow of
# the test. Running each of these tests in its own directory should eliminate
# the problem.
rm -rf vfd_swmr_test
mkdir vfd_swmr_test
## With the --disable-shared option, swmr program files are built in the test
## directory, otherwise they are in test/.libs with a corresponding wrapper
## script in the test directory. The programs or wrapper scripts in test should
## always be copied, swmr files in .libs should be copied only if they exists.
#if [ -f .libs/vfd_swmr ]; then
# mkdir vfd_swmr_test/.libs
# for FILE in .libs/vfd_swmr*; do
# case "$FILE" in
# *.o) continue ;; ## don't copy the .o files
# esac
# cp $FILE vfd_swmr_test/.libs
# done
#fi
cd vfd_swmr_test
###############################################################################
#
# Legacy SWMR tests
#
###############################################################################
#
#
# Default setting
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
compress_list=("") # No filter for default and quick runs
#
#
# Setting for exhaustive run
if [[ "$HDF5TestExpress" -eq 0 ]] ; then
Nrecords=400000 # Increase the number of records to write
compress_list=("" "-c 5") # Enable filter
fi
#
#
# Loop over index types
for index_type in "-i ea" "-i b2"
do
# Try without compression, only; uncomment "-c 5" to try with compression.
for compress in "${compress_list[@]}";
do
echo
echo "** Loop testing parameters: $index_type $compress"
echo
if [ ${do_generator:-no} = yes ]; then
echo
echo "## Generator test"
# Launch the Generator without VFD SWMR write
echo launch the vfd_swmr_generator
../vfd_swmr_generator $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
fi
# Launch the Generator with VFD SWMR write
echo launch the vfd_swmr_generator with VFD SWMR write
../vfd_swmr_generator -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
fi
fi
if [ ${do_expand:-no} = yes ]; then
echo
echo "## Writer test - test expanding the dataset"
# Launch the Generator
echo launch the vfd_swmr_generator with VFD SWMR write
../vfd_swmr_generator -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
rm -f $WRITER_MESSAGE
#
# Launch the Writer
echo launch the vfd_swmr_writer
seed="" # Put -r <random seed> command here
catch_out_err_and_rc vfd_swmr_writer \
../vfd_swmr_writer -q -o $Nrecords $seed &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
#
# Launch the Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
echo launch $Nreaders vfd_swmr_readers ......may take some time......
pid_readers=""
n=0
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
catch_out_err_and_rc vfd_swmr_reader.$n \
../vfd_swmr_reader -q $Nsecs_add $seed &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
$DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Wait for the readers to finish before signalling the
# writer to quit: the writer holds the file open so that the
# readers will find the shadow file when they reopen
# the .h5 file.
wait $pid_readers
kill -USR1 $(cat vfd_swmr_writer.pid)
wait $pid_writer
# Collect exit codes of the readers
n=0
while [ $n -lt $Nreaders ]; do
if [ $(cat vfd_swmr_reader.$n.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
n=$((n + 1))
done
# Collect exit code of the writer
$DPRINT checked writer $pid_writer
if [ $(cat vfd_swmr_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_writer.{out,rc}
rm -f vfd_swmr_reader.*.{out,rc}
fi
if [ ${do_shrink:-no} = yes ]; then
if [ ${do_expand:-no} != yes ]; then
echo "Cancelling the 'shrink' test: it depends on the .h5 file left behind by the 'expand' test." 1>&2
exit 1
fi
echo
echo "## Remove test - test shrinking the dataset"
# Remove any possible writer message file before launching writer
rm -f $WRITER_MESSAGE
# Launch the Remove Writer
echo launch the vfd_swmr_remove_writer
seed="" # Put -r <random seed> command here
catch_out_err_and_rc vfd_swmr_writer \
../vfd_swmr_remove_writer -q -o $Nrecs_rem $seed &
pid_writer=$!
$DPRINT 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=(<seed1> <seed2> <seed3> ... )
n=0
pid_readers=""
echo launch $Nreaders swmr_remove_readers ......may take some time ......
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
catch_out_err_and_rc vfd_swmr_reader.$n \
../vfd_swmr_remove_reader -q $Nsecs_rem $seed &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
$DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Wait for the readers to finish before signalling the
# writer to quit: the writer holds the file open so that the
# readers will find the shadow file when they reopen
# the .h5 file.
wait $pid_readers
kill -USR1 $(cat vfd_swmr_writer.pid)
wait $pid_writer
# Collect exit codes of the readers
n=0
while [ $n -lt $Nreaders ]; do
if [ $(cat vfd_swmr_reader.$n.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
n=$((n + 1))
done
# Collect exit code of the writer
$DPRINT checked writer $pid_writer
if [ $(cat vfd_swmr_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_writer.{out,rc}
rm -f vfd_swmr_reader.*.{out,rc}
fi
if [ ${do_expand_shrink:-no} = yes ]; then
echo
echo "## Expand/shrink test - randomly grow or shrink the dataset"
# Launch the Generator
echo launch the vfd_swmr_generator with VFD SWMR write
../vfd_swmr_generator -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
fi
# Launch the Writer (not in parallel - just to rebuild the datasets)
echo launch the vfd_swmr_writer
seed="" # Put -r <random seed> command here
../vfd_swmr_writer -q -W $Nrecords $seed
if test $? -ne 0; then
echo writer had error
nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
rm -f $WRITER_MESSAGE
#
# Launch the Add/Remove Writer
echo launch the vfd_swmr_addrem_writer
seed="" # Put -r <random seed> command here
catch_out_err_and_rc vfd_swmr_writer \
../vfd_swmr_addrem_writer -q $Nrecords $seed &
pid_writer=$!
$DPRINT 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=(<seed1> <seed2> <seed3> ... )
n=0
pid_readers=""
echo launch $Nreaders vfd_swmr_remove_readers ...... may take some time ......
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
catch_out_err_and_rc vfd_swmr_reader.$n \
../vfd_swmr_remove_reader -q $Nsecs_addrem $seed &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
$DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Wait for the readers to finish before signalling the
# writer to quit: the writer holds the file open so that the
# readers will find the shadow file when they reopen
# the .h5 file.
wait $pid_readers
kill -USR1 $(cat vfd_swmr_writer.pid)
wait $pid_writer
# Collect exit codes of the readers
n=0
while [ $n -lt $Nreaders ]; do
if [ $(cat vfd_swmr_reader.$n.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
n=$((n + 1))
done
# Collect exit code of the writer
$DPRINT checked writer $pid_writer
if [ ! -e vfd_swmr_writer.rc ] ||
[ $(cat vfd_swmr_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_writer.{out,rc}
rm -f vfd_swmr_reader.*.{out,rc}
fi
if [ ${do_sparse:-no} = yes ]; then
echo
echo "## Sparse writer test - write random dataset locations"
# Launch the Generator
# NOTE: Random seed is shared between readers and writers and is
# created by the generator.
echo launch the vfd_swmr_generator with VFD SWMR write
seed="" # Put -r <random seed> command here
../vfd_swmr_generator -s $compress $index_type $seed
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
rm -f $WRITER_MESSAGE
# Launch the Sparse writer
echo launch the vfd_swmr_sparse_writer
catch_out_err_and_rc vfd_swmr_writer nice -n 20 \
../vfd_swmr_sparse_writer -q $Nrecs_spa &
pid_writer=$!
$DPRINT 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=""
echo launch $Nrdrs_spa vfd_swmr_sparse_readers ..... may take some time ......
while [ $n -lt $Nrdrs_spa ]; do
# The sparse reader spits out a LOT of data so it's set to 'quiet'
catch_out_err_and_rc vfd_swmr_reader.$n \
../vfd_swmr_sparse_reader -q $Nrecs_spa &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
$DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Wait for the readers and the writer to finish.
echo "pid_readers=$pid_readers"
echo "pid_writer=$pid_writer"
# Wait for the readers to finish before signalling the
# writer to quit: the writer holds the file open so that the
# readers will find the shadow file when they reopen
# the .h5 file.
wait $pid_readers
kill -USR1 $(cat vfd_swmr_writer.pid)
wait $pid_writer
# Collect exit codes of the readers
n=0
while [ $n -lt $Nrdrs_spa ]; do
if [ $(cat vfd_swmr_reader.$n.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
n=$((n + 1))
done
# Collect exit code of the writer
$DPRINT checked writer $pid_writer
if [ $(cat vfd_swmr_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_writer.{out,rc}
rm -f vfd_swmr_reader.*.{out,rc}
fi
done
done
###############################################################################
#
# "vlstr_null" and "vlstr_oob" tests
#
# Test variable-length strings, expecting errors.
#
###############################################################################
#
#
for ty in null oob; do
if [ ${ty} = null ]; then
[ ${do_vlstr_null:-no} = no ] && continue
echo
echo "## VL string 1 - expect to read NULL"
else
[ ${do_vlstr_oob:-no} = no ] && continue
echo
echo "## VL string 2 - expect out-of-bounds access"
fi
echo launch vfd_swmr_vlstr_writer ..... may take some time ......
catch_out_err_and_rc vfd_swmr_vlstr_writer \
../vfd_swmr_vlstr_writer -n 500 -q -t ${ty} &
pid_writer=$!
# pause?
catch_out_err_and_rc vfd_swmr_vlstr_reader \
../vfd_swmr_vlstr_reader -n 500 -q -t ${ty} &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
kill -USR1 $(cat vfd_swmr_vlstr_writer.pid)
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_vlstr_reader.rc) -ne 0 ]; then
echo reader had error
nsofterrors=$((nsofterrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_vlstr_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_vlstr_writer.{out,rc}
rm -f vfd_swmr_vlstr_reader.*.{out,rc}
done
###############################################################################
#
# "zoo" tests
#
# Make sure that a "zoo"---the variety of HDF5 object types---can be
# read and written by VFD SWMR.
#
###############################################################################
#
#
if [ ${do_zoo:-no} = yes ]; then
rm -f ./shared_tick_num
echo launch vfd_swmr_zoo_writer
catch_out_err_and_rc vfd_swmr_zoo_writer \
../vfd_swmr_zoo_writer -q &
pid_writer=$!
# -l is the expected maximal number of ticks from the writer's finishing zoo creation or deletion
# to the reader's finishing validation of zoo creation or deletion
catch_out_err_and_rc vfd_swmr_zoo_reader \
../vfd_swmr_zoo_reader -l 4 -q &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_zoo_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_zoo_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_zoo_writer.{out,rc}
rm -f vfd_swmr_zoo_reader.*.{out,rc}
fi
###############################################################################
#
# "groups" test
#
# Make sure that we can create GROUP_n groups
# (10, 20, or 400 depending on the HDF5TestExpress level)
# while a reader waits for each to appear.
#
###############################################################################
#
#
# Default setting
#
GROUP_n=20 # -n option: # of groups (for "groups" test)
#
#
# Setting for exhaustive and quick runs
#
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
GROUP_n=400
elif [[ "$HDF5TestExpress" -gt 1 ]]; then # quick run
GROUP_n=10
fi
#
#
if [ ${do_groups:-no} = yes ]; then
echo launch vfd_swmr_group_writer ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -c 10 -n $GROUP_n &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -c 10 -n $GROUP_n -u 5 &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_group_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
rm -f vfd_swmr_group_reader.*.{out,rc}
fi
###############################################################################
#
# "groups_attrs" test
#
# The group attribute test takes longer.
# So for standard run and quick run, we shorten the number of tests.
# The standard run covers all the features we need to test.
# The quick run doesn't cover the attribute storage change
# between dense and compact.
# The exhaustive run tries to test a feature per test from scratch.
#
###############################################################################
#
#
# Default setting
#
GROUP_attr_n=1 # -n option: # of groups (for group attribute test)
grp_attr_list=(
"dense-del-to-compact"
"modify"
"remove-vstr"
"modify-vstr"
"del-ohr-block"
)
#
#
# Setting for exhaustive and quick runs
#
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
GROUP_attr_n=2
grp_attr_list=(
"compact"
"dense"
"compact-del"
"dense-del"
"compact-add-to-dense"
"dense-del-to-compact"
"modify"
"add-vstr"
"remove-vstr"
"modify-vstr"
"add-ohr-block"
"del-ohr-block"
)
elif [[ "$HDF5TestExpress" -gt 1 ]] ; then # quick run
grp_attr_list=(
"dense"
"modify"
"remove-vstr"
"modify-vstr"
"del-ohr-block"
)
fi
#
#
for options in ${grp_attr_list[*]}; do
if [ ${do_groups_attrs:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group attribute: $options ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_group_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
rm -f vfd_swmr_group_reader.*.{out,rc}
done
###############################################################################
#
# "os_groups_attrs" test
#
# Only for exhaustive run
#
# The following tests are for add/del/modify attributes for
# groups created with the old-style.
# Check https://portal.hdfgroup.org/display/HDF5/Groups for
# the detailed group implementation note.
# The 'compact' and 'compact-del' are the attribute addition
# and deletion tests. Other test names have the same meaning
# as those of the new-style group tests.
#
###############################################################################
#
#
os_grp_attr_list=(
"compact"
"compact-del"
"modify"
"add-vstr"
"remove-vstr"
"modify-vstr"
"add-ohr-block"
"del-ohr-block"
)
#
#
for options in ${os_grp_attr_list[*]}; do
if [ ${do_os_groups_attrs:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group attribute with old-style group: $options ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -G -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -G -c 1 -n $GROUP_attr_n -a 1 -A $options &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_group_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
rm -f vfd_swmr_group_reader.*.{out,rc}
done
###############################################################################
#
# "groups_ops" tests
#
# The group operation test takes longer.
# So for the quick run, we shorten the number of tests.
# The essential features are covered.
#
###############################################################################
#
#
# Default setting
#
GROUP_op_n=1 # -n option: # of groups (for group operation test)
grp_op_list=(
"grp-creation"
"grp-deletion"
"grp-move"
"grp-compact-t-dense"
"grp-dense-t-compact"
)
#
#
# Setting for exhaustive and quick run
#
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
GROUP_op_n=2
grp_op_list=(
"grp-creation"
"grp-deletion"
"grp-move"
"grp-ins-links"
"grp-del-links"
"grp-compact-t-dense"
"grp-dense-t-compact"
)
elif [[ "$HDF5TestExpress" -gt 1 ]] ; then # quick run
grp_op_list=(
"grp-move"
"grp-dense-t-compact"
)
fi
#
#
for options in ${grp_op_list[*]}; do
if [ ${do_groups_ops:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group operations: $options ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -c 1 -n $GROUP_op_n -O $options &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -c 1 -n $GROUP_op_n -O $options &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_group_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
rm -f vfd_swmr_group_reader.*.{out,rc}
done
###############################################################################
#
# Setting for "os_groups_ops" test
#
# Only for exhaustive run
#
# Test the group operations for old-style
#
###############################################################################
#
#
os_grp_op_list=(
"grp-creation"
"grp-deletion"
"grp-move"
"grp-ins-links"
"grp-del-links"
)
#
#
for options in ${os_grp_op_list[*]}; do
if [ ${do_os_groups_ops:-no} = no ]; then
continue
fi
echo launch vfd_swmr_group operations with old-style group: $options ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -G -c 1 -n $GROUP_op_n -O $options &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_group_reader -q -G -c 1 -n $GROUP_op_n -O $options &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_group_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
rm -f vfd_swmr_group_reader.*.{out,rc}
done
###############################################################################
#
# Setting for "os_groups_seg" test
#
# Only for exhaustive run
#
# Verify the segmentation fault is fixed when running with:
# --1,000,000 groups
# --as writer only
#
###############################################################################
#
#
GROUP_seg_n=1000000 # Number of groups when segmentation fault occurs
#
if [ ${do_os_groups_seg:-no} != no ]; then
echo launch vfd_swmr_group operations with old-style group: $GROUP_seg_n groups ......may take some time......
catch_out_err_and_rc vfd_swmr_group_writer \
../vfd_swmr_group_writer -q -N -G -n $GROUP_seg_n -a $GROUP_seg_n
# Collect exit code of the writer
if [ $(cat vfd_swmr_group_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_group_writer.{out,rc}
fi
###############################################################################
#
# Setting for bigset (few_big and many_small) tests
#
###############################################################################
#
#
# Default setting
#
BIGSET_n=25 # -n option: # of iterations
BIGSET_few_s=10 # -s option: # of datasets (for few_big test)
BIGSET_many_s=50 # -s option: # of datasets (for many_small test)
#
#
# Setting for exhaustive and quick runs
#
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
BIGSET_n=100
BIGSET_few_s=25
BIGSET_many_s=100
elif [[ "$HDF5TestExpress" -gt 1 ]]; then # quick run
BIGSET_n=10
BIGSET_few_s=3
BIGSET_many_s=25
fi
#
#
for options in "-d 1" "-d 1 -F" "-d 2 -l 16" "-d 2 -F -l 16" "-d 1 -t" "-d 1 -t -F" "-d 1 -t -R" "-d 1 -V" "-d 1 -M" "-d 1 -V -F" "-d 1 -M -F"; do
if [ ${do_many_small:-no} = no ]; then
continue
fi
#
# Test many small datasets of two or three dimensions.
#
# Perform 25 iterations on 100 extensible datasets configured with
# 2D 16x16 chunks or 3D 1x16x16 chunks of 32-bit unsigned integer elements,
# expanding each dataset by a chunk in one dimension (up to 25x1
# 16x16 chunks) on each iteration.
#
# Perform the test again, extending each dataset
# in *two* dimensions (up to 25x25 16x16 chunks).
#
# If testing 3D datasets (-t option), extending each dataset along the
# first dimension (up to 25 1x16x16)
#
# Launch the auxiliary process for testing NFS if the --enable-aux-process option is enabled for configuration.
# If it isn't enabled, the auxiliary process simply exit without executing any code. For the testing case of
# VDS across multiple files (-M option), the program also skips for future support.
if test "X$USING_AUX_PROCESS" = "Xyes"; then
if [[ $options == *"-M"* ]]; then
catch_out_err_and_rc aux_process ../../utils/vfd_swmr/aux_process -a mdfile bigset_updater &
else
catch_out_err_and_rc aux_process ../../utils/vfd_swmr/aux_process mdfile bigset_updater &
fi
pid_aux_proc=$!
fi
echo launch vfd_swmr_bigset_writer many small, options $options
catch_out_err_and_rc vfd_swmr_bigset_writer \
../vfd_swmr_bigset_writer -n $BIGSET_n $options -s $BIGSET_many_s -e 1 -r 16 -c 16 -q &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_bigset_reader \
../vfd_swmr_bigset_reader -n $BIGSET_n $options -s $BIGSET_many_s -e 1 -r 16 -c 16 -q &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file. Also wait for the auxiliary process to finish.
if test "X$USING_AUX_PROCESS" = "Xyes"; then
wait $pid_aux_proc
fi
wait $pid_reader
wait $pid_writer
# Collect exit code of the auxiliary process
if test "X$USING_AUX_PROCESS" = "Xyes"; then
if [ $(cat aux_process.rc) -ne 0 ]; then
echo the auxiliary process had error
nerrors=$((nerrors + 1))
fi
fi
# Collect exit code of the reader
if [ $(cat vfd_swmr_bigset_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_bigset_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_bigset_writer.{out,rc}
rm -f vfd_swmr_bigset_reader.*.{out,rc}
rm -f aux_process.{out,rc}
rm -f mdfile bigset_updater.* bigset-shadow-*
done
# bigset test for bigger chunks
for options in "-d 1" "-d 1 -F" "-d 2 -l 10" "-d 2 -F -l 10" "-d 1 -t -l 10" "-d 1 -t -F -l 10" "-d 1 -t -R" "-d 1 -V" "-d 1 -M" "-d 1 -V -F" "-d 1 -M -F"; do
#
# Test a few big datasets of two or three dimensions.
#
# Perform 25 iterations on 10 extensible datasets configured with
# 2D 256x256 chunks or 3D 8x256x256 of 32-bit unsigned integer elements,
# expanding each dataset by a chunk in one dimension (up to 25x1
# 256x256 chunks) on each iteration.
#
# Perform the test again, extending each dataset
# in *two* dimensions (up to 25x25 256x256 chunks).
#
# If testing 3D datasets (-t option), extending each dataset along the
# first dimension (up to 25 8x256x256)
#
if [ ${do_few_big:-no} = no ]; then
continue
fi
echo launch vfd_swmr_bigset_writer few big, options $options ......may take some time......
# Launch the auxiliary process for testing NFS if the --enable-aux-process option is enabled for configuration.
# If it isn't enabled, the auxiliary process simply exit without executing any code. For the testing case of
# VDS across multiple files (-M option), the program also skips for future support.
if test "X$USING_AUX_PROCESS" = "Xyes"; then
if [[ $options == *"-M"* ]]; then
catch_out_err_and_rc aux_process ../../utils/vfd_swmr/aux_process -a mdfile bigset_updater &
else
catch_out_err_and_rc aux_process ../../utils/vfd_swmr/aux_process mdfile bigset_updater &
fi
pid_aux_proc=$!
fi
catch_out_err_and_rc vfd_swmr_bigset_writer \
../vfd_swmr_bigset_writer -n $BIGSET_n $options -s $BIGSET_few_s -e 8 -r 256 -c 256 -q &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_bigset_reader \
../vfd_swmr_bigset_reader -n $BIGSET_n $options -s $BIGSET_few_s -e 8 -r 256 -c 256 -q &
pid_reader=$!
# Wait for the reader to finish before signalling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file. Also wait for the auxiliary process to finish.
if test "X$USING_AUX_PROCESS" = "Xyes"; then
wait $pid_aux_proc
fi
wait $pid_reader
wait $pid_writer
# Collect exit code of the auxiliary process
if test "X$USING_AUX_PROCESS" = "Xyes"; then
if [ $(cat aux_process.rc) -ne 0 ]; then
echo the auxiliary process had error
nerrors=$((nerrors + 1))
fi
fi
# Collect exit code of the reader
if [ $(cat vfd_swmr_bigset_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_bigset_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_bigset_writer.{out,rc}
rm -f vfd_swmr_bigset_reader.*.{out,rc}
rm -f aux_process.{out,rc}
rm -f mdfile bigset_updater.* bigset-shadow-*
done
###############################################################################
#
# "attrdset" test
#
###############################################################################
#
#
# Default setting
#
attrdset_list=(
"-g -a 8 -v -m -d 8 -c 3 -u 5 -q"
)
#
#
# Setting for exhaustive
#
if [[ "$HDF5TestExpress" -eq 0 ]] ; then # exhaustive run
attrdset_list=(
"-p -g -a 10 -v -m -d 10 -c 3 -u 5 -q"
"-k -a 20 -v -m -d 5 -q"
)
fi
#
#
for options in "${attrdset_list[@]}"; do
if [ ${do_attrdset:-no} = no ]; then
continue
fi
# Clean up any existing fifo files from previous runs
if [ -e ./$ATTRDSET_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$ATTRDSET_FIFO_WRITER_TO_READER
fi
if [ -e ./$ATTRDSET_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$ATTRDSET_FIFO_READER_TO_WRITER
fi
echo launch vfd_swmr_attrdset_writer attrdset, options $options ......may take some time......
catch_out_err_and_rc vfd_swmr_attrdset_writer \
../vfd_swmr_attrdset_writer $options &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_attrdset_reader \
../vfd_swmr_attrdset_reader $options &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_attrdset_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_attrdset_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_attrdset_writer.{out,rc}
rm -f vfd_swmr_attrdset_reader.*.{out,rc}
done
###############################################################################
#
# "dsetops" test
#
# Only for exhaustive run
#
###############################################################################
#
#
# Loop with flushing of raw data and then without
for flush in "" "-U"; do
# Loop with different operations
for options in "-p -e 20 -t -q" "-g -m 5 -n 2 -s 10 -w 7 -q" "-k -m 10 -n 5 -r 5 -l 10 -q"; do
#
#
if [ ${do_dsetops:-no} = no ]; then
continue
fi
# Clean up any existing fifo files from previous runs
if [ -e ./$DSETOPS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$DSETOPS_FIFO_WRITER_TO_READER
fi
if [ -e ./$DSETOPS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$DSETOPS_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_dsetops_writer dsetops, options $options $flush......may take some time......
catch_out_err_and_rc vfd_swmr_dsetops_writer \
../vfd_swmr_dsetops_writer $options $flush &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_dsetops_reader \
../vfd_swmr_dsetops_reader $options $flush &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_dsetops_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_dsetops_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_dsetops_writer.{out,rc}
rm -f vfd_swmr_dsetops_reader.*.{out,rc}
done
done
###############################################################################
#
# "dsetops_ref" test (this is the dsetops test with options added for testing references)
# --test object (-O) and region (-R) references
# --test with raw data flush only
# --test without flush will result in error because the references are not there
# to continue further testing
#
# Only for exhaustive run
#
###############################################################################
#
#
# Loop with
for ref in "-O" "-R" "-O -R"; do
# Loop with different operations
for options in "-p -e 20 -t -g -q" "-g -m 5 -n 2 -s 10 -w 7 -q" "-k -m 10 -n 5 -r 5 -l 10 -q"; do
#
#
if [ ${do_dsetops_ref:-no} = no ]; then
continue
fi
# Clean up any existing fifo files from previous runs
if [ -e ./$DSETOPS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$DSETOPS_FIFO_WRITER_TO_READER
fi
if [ -e ./$DSETOPS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$DSETOPS_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_dsetops_writer dsetops, options $options $ref......may take some time......
catch_out_err_and_rc vfd_swmr_dsetops_writer \
../vfd_swmr_dsetops_writer $options $ref &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_dsetops_reader \
../vfd_swmr_dsetops_reader $options $ref &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_dsetops_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_dsetops_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_dsetops_writer.{out,rc}
rm -f vfd_swmr_dsetops_reader.*.{out,rc}
done
done
###############################################################################
#
# "dsetchks" test
#
# Only for exhaustive run
#
###############################################################################
#
#
dsetchks_list=(
"-s -m 8 -n 3 -g 1 -q"
"-i -o -g 3 -q"
"-f -p 4 -q"
"-e -m 3 -n 5 -t 1 -q"
"-r -m 11 -n 5 -l 7 -q"
"-f -x 5 -y 2 -q"
)
#
#
# Loop with flushing of raw data and then without
for flush in "" "-U"; do
for options in "${dsetchks_list[@]}"; do
#
#
if [ ${do_dsetchks:-no} = no ]; then
continue
fi
# Clean up any existing fifo files from previous runs
if [ -e ./$DSETCHKS_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$DSETCHKS_FIFO_WRITER_TO_READER
fi
if [ -e ./$DSETCHKS_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$DSETCHKS_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_dsetchks_writer dsetchks, options $options $flush ......may take some time......
catch_out_err_and_rc vfd_swmr_dsetchks_writer \
../vfd_swmr_dsetchks_writer $options $flush &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_dsetchks_reader \
../vfd_swmr_dsetchks_reader $options $flush &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_dsetchks_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_dsetchks_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_dsetchks_writer.{out,rc}
rm -f vfd_swmr_dsetchks_reader.*.{out,rc}
done
done
if [ ${do_independ_wr:-no} = yes ]; then
echo launch vfd_swmr_indep_wr_p0 ..... process 0 ......
echo launch vfd_swmr_indep_wr_p1 ..... process 1 ......
catch_out_err_and_rc vfd_swmr_indep_wr_p0 \
../vfd_swmr_indep_wr_p0 &
pid_writer=$!
catch_out_err_and_rc vfd_swmr_group_reader \
../vfd_swmr_indep_wr_p1 &
pid_reader=$!
wait $pid_reader
wait $pid_writer
# Clean up output files
rm -f vfd_swmr_indep_wr_p0.{out,rc}
rm -f vfd_swmr_indep_wr_p1.{out,rc}
fi
###############################################################################
#
# "gfail_entry_length" test
#
# Only for exhaustive run
#
# Verify that the assertion failure for old and new entry length is fixed.
# (See issue #1 in Kent's documentation "Designed to Fail Tests and Issues".
#
###############################################################################
#
#
if [ ${do_gfail_entry_length:-no} = yes ]; then
#
# Clean up any existing fifo files from previous runs
if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$GFAIL_FIFO_WRITER_TO_READER
fi
if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$GFAIL_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_gfail_writer -q -m 10 -n 340000
catch_out_err_and_rc vfd_swmr_gfail_entry_length_writer \
../vfd_swmr_gfail_writer -q -m 10 -n 340000 &
pid_writer=$!
echo launch vfd_swmr_gfail_reader -m 10 -n 340000
catch_out_err_and_rc vfd_swmr_gfail_entry_length_reader \
../vfd_swmr_gfail_reader -m 10 -n 340000 &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_gfail_entry_length_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_gfail_entry_length_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_gfail_entry_length_writer.{out,rc}
rm -f vfd_swmr_gfail_entry_length_reader.*.{out,rc}
fi
###############################################################################
#
# "gfail_checksum" test
#
# Only for exhaustive run
#
# Verify that meaningful message about increasing max_lag is printed when
# incorrect metadata checksum error is encountered when loading the cache entry.
#
# Note that there will be messages from the error stack printed out for this test.
# This is expected.
#
# (See issue #2 in Kent's documentation "Designed to Fail Tests and Issues".
#
###############################################################################
#
#
if [ ${do_gfail_checksum:-no} = yes ]; then
#
# Clean up any existing fifo files from previous runs
if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$GFAIL_FIFO_WRITER_TO_READER
fi
if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$GFAIL_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_gfail_writer -q -n 420000 ......may take some time......
catch_out_err_and_rc vfd_swmr_gfail_checksum_writer \
../vfd_swmr_gfail_writer -q -m 50 -t 10 -n 4000000 &
pid_writer=$!
echo launch vfd_swmr_gfail_reader -n 420000 ......may take some time......
catch_out_err_and_rc vfd_swmr_gfail_checksum_reader \
../vfd_swmr_gfail_reader -q -m 50 -t 10 -n 4000000 &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_gfail_checksum_reader.rc) -ne 0 ]; then
grep "suggest to increase the value of max_lag" vfd_swmr_gfail_checksum_reader.out >/dev/null 2>&1
if test $? -ne 0; then
echo reader had error
nerrors=$((nerrors + 1))
fi
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_gfail_checksum_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_gfail_checksum_writer.{out,rc}
rm -f vfd_swmr_gfail_checksum_reader.*.{out,rc}
fi
###############################################################################
#
# "gfail_page_size" test
#
# Only for exhaustive run
#
# Verify that the assertion failure is fixed when non-default page size is set.
# (See issue #3 in Kent's documentation "Designed to Fail Tests and Issues".
#
###############################################################################
#
#
if [ ${do_gfail_page_size:-no} = yes ]; then
#
# Clean up any existing fifo files from previous runs
if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$GFAIL_FIFO_WRITER_TO_READER
fi
if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$GFAIL_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_gfail_writer -q -m 10 -B 8192 -s 8192 -n 320000
catch_out_err_and_rc vfd_swmr_gfail_page_size_writer \
../vfd_swmr_gfail_writer -q -m 10 -B 8192 -s 8192 -n 320000 &
pid_writer=$!
echo launch vfd_swmr_gfail_reader -m 10 -B 8192 -s 8192 -n 320000
catch_out_err_and_rc vfd_swmr_gfail_page_size_reader \
../vfd_swmr_gfail_reader -m 10 -B 8192 -s 8192 -n 320000 &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_gfail_page_size_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_gfail_page_size_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_gfail_page_size_writer.{out,rc}
rm -f vfd_swmr_gfail_page_size_reader.*.{out,rc}
fi
###############################################################################
#
# "gfail_index_space" test
#
# Only for exhaustive run
#
# Verify that the failure is fixed when there is not enough space to copy the index.
# (See issue #4 in Kent's documentation "Designed to Fail Tests and Issues".
#
###############################################################################
#
#
if [ ${do_gfail_index_space:-no} = yes ]; then
#
# Clean up any existing fifo files from previous runs
if [ -e ./$GFAIL_FIFO_WRITER_TO_READER ]; then # If writer fifo file is found
rm -f ./$GFAIL_FIFO_WRITER_TO_READER
fi
if [ -e ./$GFAIL_FIFO_READER_TO_WRITER ]; then # If reader fifo file is found
rm -f ./$GFAIL_FIFO_READER_TO_WRITER
fi
#
echo launch vfd_swmr_gfail_writer -q -m 50 -t 10 -n 1000000 ......may take some time......
catch_out_err_and_rc vfd_swmr_gfail_index_space_writer \
../vfd_swmr_gfail_writer -q -m 50 -t 10 -n 1000000 &
pid_writer=$!
echo launch vfd_swmr_gfail_reader -m 50 -t 10 -n 1000000 ......may take some time......
catch_out_err_and_rc vfd_swmr_gfail_index_space_reader \
../vfd_swmr_gfail_reader -m 50 -t 10 -n 1000000 &
pid_reader=$!
# Wait for the reader to finish before signaling the
# writer to quit: the writer holds the file open so that the
# reader will find the shadow file when it opens
# the .h5 file.
wait $pid_reader
wait $pid_writer
# Collect exit code of the reader
if [ $(cat vfd_swmr_gfail_index_space_reader.rc) -ne 0 ]; then
echo reader had error
nerrors=$((nerrors + 1))
fi
# Collect exit code of the writer
if [ $(cat vfd_swmr_gfail_index_space_writer.rc) -ne 0 ]; then
echo writer had error
nerrors=$((nerrors + 1))
fi
# Clean up output files
rm -f vfd_swmr_gfail_index_space_writer.{out,rc}
rm -f vfd_swmr_gfail_index_space_reader.*.{out,rc}
fi
###############################################################################
## Report and exit
###############################################################################
cd ..
$DPRINT nerrors $nerrors nsofterrors $nsofterrors
if test $nerrors -eq 0 ; then
echo "VFD SWMR tests passed."
if test $nsofterrors -ne 0 ; then
echo
echo "${nsofterrors} expected errors occurred. Expected errors are ok."
fi
if test -z "$HDF5_NOCLEANUP"; then
# delete the test directory
rm -rf vfd_swmr_test
fi
exit 0
else
echo -n "VFD SWMR tests failed with $nerrors unexpected errors "
echo "and $nsofterrors expected errors. Expected errors are ok."
echo "Please report unexpected errors, they may indicate a bug."
exit 1
fi
|